SensorConfiguration#

A simple coordinate system that allows for storing sensor and target offsets.

Supported sensors are:

  • compass: Affects Sensordata.heading with yaw offset

  • position system: Affects Sensordata gps variables with x,y and z offset

  • depth sensor: Affects Sensordata.depth variables with x,y and z offset

  • attitude system: Affects Sensordata imu variables with yaw, pitch and roll offset

The class allows for registering multiple targets (e.g. “MBES” and “SBES”) with respective PositionOffsets. Once targets are registered, the system can be used to compute the georeferenced of the targets using a Sensordata object. (see usage below)

Note 1: The returned Geolocation object type depends on the input Sensordata object.

Example usage#

https://mybinder.org/badge_logo.svg
# import this module
import themachinethatgoesping.navigation as nav

# initialize
scs = nav.SensorConfiguration()

# add sensor offsets
scs.set_heading_source("compass",yaw=9)
scs.set_depth_source("altimeter",0, 0, 1)
scs.set_position_source("gps",1, 2, 3)
scs.set_attitude_source("mru",10, -10, -30)

# add a target with target offsets
scs.add_target(
   target_id = "mbes",
   x = 1,
   y = 2,
   z = 3,
   yaw = 0,
   pitch = 0,
   roll = 0)

# create a object that contains sensor data
sensor_data = nav.datastructures.SensordataLatLon(
   latitude = 53,
   longitude = 10,
   depth = 3,
   heave = -1,
   heading = 45,
   roll = 2,
   pitch = -3)

# compute target position from the specified sensor data
target_position = scs.compute_target_position("mbes", sensor_data)

#print georeferenced target position
print(target_position)

# GeolocationLatLon
# *****************
# - latitude:  53°0'0.0"N  [ddd°mm',ss.s''N/S]
# - longitude: 53°0'0.0"E  [ddd°mm',ss.s''E/W]
# - z:         6.51        [positive downwards, m]
# - yaw:       36.00       [90 ° at east]
# - pitch:     10.72       [° positive bow up]
# - roll:      30.90       [° positive port up]

Module API#

class SensorConfiguration#

A coordinate system that allows for specifying sensor offsets (e.g. gps antenna and attitude sensor) and target offsets (e.g. MBES). Call the class and specify target_id and current sensor data to derive the geolocation and attitude of the specified targets

__init__(self: SensorConfiguration, default_sensor_name: str = 'zero-referenced') None#

Construct a new, empty Sensor Coordinate System object After construction: add sensor offsets and targets (offsets) Then compute target positions for sensor data

add_target(*args, **kwargs)#

Overloaded function.

  1. add_target(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, x: float, y: float, z: float, yaw: float, pitch: float, roll: float) -> None

add a target (e.g. MBES) with offsets to the sensor position system

Parameter target_id:

name of the target for reference

Parameter x:

x-offset of the target (in meters, positive forward)

Parameter y:

y-offset of the target (in meters, positive starboard)

Parameter z:

z-offset of the target (in meters, positive down)

Parameter yaw:

yaw offset of the target (right-handed around the z-axis) (in degrees, 90° = east)

Parameter pitch:

pitch offset of the target (right-handed around the y-axis) (in degrees, positive = bow up)

Parameter roll:

roll offset of the target (right-handed around the x-axis) (in degrees, positive = port up)

  1. add_target(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, target_offsets: themachinethatgoesping.navigation.datastructures.PositionalOffsets) -> None

add a target (e.g. MBES) with offsets to the sensor position system

Parameter target_id:

name of the target for reference

Parameter target_offsets:

mounting offsets of the target

add_targets(self: SensorConfiguration, targets: Dict[str, PositionalOffsets]) None#

add targets (e.g. MBES) with given target_ids and offsets to the sensor position system

Parameter targets:

map<target_id, target_offsets> of target offsets

can_merge_targets_with(self: SensorConfiguration, other: SensorConfiguration) bool#

Check if the given SensorConfiguration includes a target (offsets) that is incompatible with the given SensorConfiguration targets

Returns:

false if the same target_id is registered with different offsets, true otherwise

compute_target_position(*args, **kwargs)#

Overloaded function.

  1. compute_target_position(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, sensor_data: themachinethatgoesping.navigation.datastructures.SensordataLatLon) -> themachinethatgoesping.navigation.datastructures.GeolocationLatLon

Compute the position of the target “target_id” based on the sensor data “sensor_data”

Parameter target_id:

name of the target (e.g. “MBES”)

Parameter sensor_data:

SensordataLatLon / this structure includes latitude and longitude information

Returns:

datastructures::GeolocationLatLon / this structure includes latitude and longitude information

  1. compute_target_position(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, sensor_data: themachinethatgoesping.navigation.datastructures.SensordataUTM) -> themachinethatgoesping.navigation.datastructures.GeolocationUTM

Compute the position of the target “target_id” based on the sensor data “sensor_data”

Parameter target_id:

name of the target (e.g. “MBES”)

Parameter sensor_data:

SensordataUTM / this structure includes northing/easting and utm zone or hemisphere information

Returns:

datastructures::GeolocationUTM / this structure includes northing/easting and utm zone or hemisphere information

  1. compute_target_position(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, sensor_data: themachinethatgoesping.navigation.datastructures.SensordataLocal) -> themachinethatgoesping.navigation.datastructures.GeolocationLocal

Compute the position of the target “target_id” based on the sensor data “sensor_data”

Parameter target_id:

name of the target (e.g. “MBES”)

Parameter sensor_data:

SensordataLocal / this structure includes northing/easting but no zone or hemisphere information

Returns:

datastructures::GeolocationLocal / this structure includes northing/easting but no zone or hemisphere information

  1. compute_target_position(self: themachinethatgoesping.navigation.SensorConfiguration, target_id: str, sensor_data: themachinethatgoesping.navigation.datastructures.Sensordata) -> themachinethatgoesping.navigation.datastructures.GeolocationLocal

Compute the position of the target “target_id” based on the sensor data “sensor_data”

Parameter target_id:

name of the target (e.g. “MBES”)

Parameter sensor_data:

Sensordata / this structure includes no coordinate information

Returns:

datastructures::GeolocationLocal / this structure includes northing and east, which are set relative to the sensor coordinate system center

copy(self: SensorConfiguration) SensorConfiguration#

return a copy using the c++ default copy constructor

static from_binary(buffer: bytes, check_buffer_is_read_completely: bool = True) SensorConfiguration#

create T_CLASS object from bytearray

get_attitude_source(self: SensorConfiguration) PositionalOffsets#

Get the attitude sensor offsets

Returns:

const datastructures::PositionalOffsets& offsets of the attitude sensor

get_depth_source(self: SensorConfiguration) PositionalOffsets#

Get the registered depth sensor offsets

Returns:

const datastructures::PositionalOffsets& offsets of the depth sensor

get_heading_source(self: SensorConfiguration) PositionalOffsets#

Get the registered compass offsets

Returns:

const datastructures::PositionalOffsets& offsets of the compass

get_position_source(self: SensorConfiguration) PositionalOffsets#

Get the registered position system offsets

Returns:

const datastructures::PositionalOffsets& offsets of the position system

get_target(self: SensorConfiguration, target_id: str) PositionalOffsets#

Get stored target offsets of a specified target

Parameter target_id:

name of the registered target

Returns:

const datastructures::PositionalOffsets& offsets of the target

get_target_ids(self: SensorConfiguration) List[str]#

Get the ids of the registered targets

Returns:

std::vector<std::string_view>

get_targets(self: SensorConfiguration) Dict[str, PositionalOffsets]#

Get the map of stored target offsets objects

Returns:

const std::unordered_map<std::string, datastructures::PositionalOffsets>&

get_waterline_offset(self: SensorConfiguration) float#

Get the waterline offset Negative waterline offset means that z=0 is below the waterline

Returns:

waterline_offset

has_target(self: SensorConfiguration, target_id: str) bool#

Checks if the sensor configuration has a target with the specified ID.

Parameter target_id:

The ID of the target to check for.

Returns:

True if the sensor configuration has the target, false otherwise.

hash(self: SensorConfiguration) int#

hash function implemented using binary_hash

info_string(self: SensorConfiguration, float_precision: int = 2) str#

Return object information as string

print(self: SensorConfiguration, float_precision: int = 2) None#

Print object information

remove_target(self: SensorConfiguration, target_id: str) None#

Remove the target with the specified target_id

Parameter target_id:

name of the registered target

remove_targets(self: SensorConfiguration) None#

Remove all stored targets

set_attitude_source(*args, **kwargs)#

Overloaded function.

  1. set_attitude_source(self: themachinethatgoesping.navigation.SensorConfiguration, name: str, yaw: float, pitch: float, roll: float) -> None

Set the attitude sensor offsets

Parameter sensor_offsets:

offsets structure (only yaw, pitch and roll are used)

  1. set_attitude_source(self: themachinethatgoesping.navigation.SensorConfiguration, sensor_offsets: themachinethatgoesping.navigation.datastructures.PositionalOffsets) -> None

Set the attitude sensor offsets

Parameter yaw:

yaw offset of the attitude sensor (right-handed around the z-axis) (in degrees, 90° = east)

Parameter pitch:

pitch offset of the attitude sensor (right-handed around the y-axis) (in degrees, positive = bow up)

Parameter roll:

roll offset of the attitude sensor (right-handed around the x-axis) (in degrees, positive = port up)

set_depth_source(*args, **kwargs)#

Overloaded function.

  1. set_depth_source(self: themachinethatgoesping.navigation.SensorConfiguration, name: str, x: float, y: float, z: float) -> None

Set the depth sensor offsets

Parameter x:

x-offset of the depth sensor (in meters, positive forward)

Parameter y:

y-offset of the depth sensor (in meters, positive starboard)

Parameter z:

z-offset of the depth sensor (in meters, positive down)

  1. set_depth_source(self: themachinethatgoesping.navigation.SensorConfiguration, sensor_offsets: themachinethatgoesping.navigation.datastructures.PositionalOffsets) -> None

Set the depth sensor offsets

Parameter sensor_offsets:

offsets structure (only x, y and z are used)

set_heading_source(*args, **kwargs)#

Overloaded function.

  1. set_heading_source(self: themachinethatgoesping.navigation.SensorConfiguration, name: str, yaw: float) -> None

Set the compass offsets

Parameter yaw:

yaw offset of the compass (right-handed around the z-axis) (in degrees, 90° = east)

  1. set_heading_source(self: themachinethatgoesping.navigation.SensorConfiguration, sensor_offsets: themachinethatgoesping.navigation.datastructures.PositionalOffsets) -> None

Set the compass offsets

Parameter sensor_offsets:

offsets structure (only yaw is used)

set_position_source(*args, **kwargs)#

Overloaded function.

  1. set_position_source(self: themachinethatgoesping.navigation.SensorConfiguration, name: str, x: float, y: float, z: float) -> None

Set the position system offsets

Parameter x:

x-offset of the depth sensor (in meters, positive forward)

Parameter y:

y-offset of the depth sensor (in meters, positive starboard)

Parameter z:

z-offset of the depth sensor (in meters, positive down)

  1. set_position_source(self: themachinethatgoesping.navigation.SensorConfiguration, sensor_offsets: themachinethatgoesping.navigation.datastructures.PositionalOffsets) -> None

Set the position system offsets

Parameter sensor_offsets:

offsets structure (only x, y and z are used)

set_waterline_offset(self: SensorConfiguration, z: float) None#

Set the waterline offset Negative waterline offset means that z=0 is below the waterline

Parameter waterline_offset:

slow_hash(self: SensorConfiguration) int#

hash function implemented using slow_hash

to_binary(self: SensorConfiguration, resize_buffer: bool = True) bytes#

convert object to bytearray

without_targets(self: SensorConfiguration) SensorConfiguration#

Return the SensorConfiguration object without registered targets

Returns:

SensorConfiguration