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(*args, **kwargs)#

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, 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(self, target_id: str, x: float, y: float, z: float, yaw: float, pitch: float, roll: float) None#
add_target(self, target_id: str, target_offsets: PositionalOffsets) None

Overloaded function.

  1. add_target(self, 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

Parameters:
  • target_id – name of the target for reference

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

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

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

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

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

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

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

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

Parameters:
  • target_id – name of the target for reference

  • target_offsets – mounting offsets of the target

add_targets(self, targets: std::map<std::__cxx11::basic_string<char, std: :char_traits<char>, std: :allocator<char> >, themachinethatgoesping: :navigation::datastructures::PositionalOffsets, std: :less<std::__cxx11::basic_string<char, std: :char_traits<char>, std: :allocator<char> > >, std: :allocator<std::pair<std::__cxx11::basic_string<char, std: :char_traits<char>, std: :allocator<char> > const, themachinethatgoesping: :navigation::datastructures::PositionalOffsets> > >) None#

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

Parameters:

targets – map<target_id, target_offsets> of target offsets

can_merge_targets_with(self, 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(self, target_id: str, sensor_data: SensordataLatLon) GeolocationLatLon#
compute_target_position(self, target_id: str, sensor_data: SensordataUTM) GeolocationUTM
compute_target_position(self, target_id: str, sensor_data: SensordataLocal) GeolocationLocal
compute_target_position(self, target_id: str, sensor_data: Sensordata) GeolocationLocal

Overloaded function.

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

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

Parameters:
  • target_id – name of the target (e.g. “MBES”)

  • 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, target_id: str, sensor_data: themachinethatgoesping.navigation_nanopy.datastructures.SensordataUTM) -> themachinethatgoesping.navigation_nanopy.datastructures.GeolocationUTM

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

Parameters:
  • target_id – name of the target (e.g. “MBES”)

  • 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, target_id: str, sensor_data: themachinethatgoesping.navigation_nanopy.datastructures.SensordataLocal) -> themachinethatgoesping.navigation_nanopy.datastructures.GeolocationLocal

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

Parameters:
  • target_id – name of the target (e.g. “MBES”)

  • 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, target_id: str, sensor_data: themachinethatgoesping.navigation_nanopy.datastructures.Sensordata) -> themachinethatgoesping.navigation_nanopy.datastructures.GeolocationLocal

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

Parameters:
  • target_id – name of the target (e.g. “MBES”)

  • 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#

return a copy using the c++ default copy constructor

from_binary = <nanobind.nb_func object>#
get_attitude_source(self) PositionalOffsets#

Get the attitude sensor offsets

Returns:

const datastructures::PositionalOffsets& offsets of the attitude sensor

get_depth_source(self) PositionalOffsets#

Get the registered depth sensor offsets

Returns:

const datastructures::PositionalOffsets& offsets of the depth sensor

get_heading_source(self) PositionalOffsets#

Get the registered compass offsets

Returns:

const datastructures::PositionalOffsets& offsets of the compass

get_position_source(self) PositionalOffsets#

Get the registered position system offsets

Returns:

const datastructures::PositionalOffsets& offsets of the position system

get_target(self, target_id: str) PositionalOffsets#

Get stored target offsets of a specified target

Parameters:

target_id – name of the registered target

Returns:

const datastructures::PositionalOffsets& offsets of the target

get_target_ids(self) list[str]#

Get the ids of the registered targets

Returns:

std::vector<std::string_view>

get_targets(self) std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, themachinethatgoesping::navigation::datastructures::PositionalOffsets, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, themachinethatgoesping::navigation::datastructures::PositionalOffsets> > >#

Get the map of stored target offsets objects

Returns:

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

get_waterline_offset(self) float#

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

Returns:

waterline_offset

has_target(self, target_id: str) bool#

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

Parameters:

target_id – The ID of the target to check for.

Returns:

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

hash(self) int#

hash function implemented using binary_hash

info_string(self, float_precision: int = 3, superscript_exponents: bool = True) str#

Return object information as string

print(self, float_precision: int = 3, superscript_exponents: bool = True) None#

Print object information

remove_target(self, target_id: str) None#

Remove the target with the specified target_id

Parameters:

target_id – name of the registered target

remove_targets(self) None#

Remove all stored targets

set_attitude_source(self, name: str, yaw: float, pitch: float, roll: float) None#
set_attitude_source(self, sensor_offsets: PositionalOffsets) None

Overloaded function.

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

Set the attitude sensor offsets

Parameters:

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

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

Set the attitude sensor offsets

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

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

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

set_depth_source(self, name: str, x: float, y: float, z: float) None#
set_depth_source(self, sensor_offsets: PositionalOffsets) None

Overloaded function.

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

Set the depth sensor offsets

Parameters:
  • x – x-offset of the depth sensor (in meters, positive forward)

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

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

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

Set the depth sensor offsets

Parameters:

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

set_heading_source(self, name: str, yaw: float) None#
set_heading_source(self, sensor_offsets: PositionalOffsets) None

Overloaded function.

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

Set the compass offsets

Parameters:

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

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

Set the compass offsets

Parameters:

sensor_offsets – offsets structure (only yaw is used)

set_position_source(self, name: str, x: float, y: float, z: float) None#
set_position_source(self, sensor_offsets: PositionalOffsets) None

Overloaded function.

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

Set the position system offsets

Parameters:
  • x – x-offset of the depth sensor (in meters, positive forward)

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

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

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

Set the position system offsets

Parameters:

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

set_waterline_offset(self, z: float) None#

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

Parameters:

waterline_offset

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

convert object to bytearray

without_targets(self) SensorConfiguration#

Return the SensorConfiguration object without registered targets

Returns:

SensorConfiguration