SensorConfiguration#
A simple coordinate system that allows for storing sensor and target offsets.
Supported sensors are:
compass: Affects
Sensordata.headingwith yaw offsetposition 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.
A
datastructures.SensordataUTMobject will cause compute_target_position to returndatastructures.GeolocationUTMA
datastructures.SensordataLatLonwill cause compute_target_position to returndatastructures.GeolocationLatLon… and so on
Example usage#
# 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#
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
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, target_offsets: PositionalOffsets) None
Overloaded function.
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)
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 (e.g. MBES) with given target_ids and offsets to the sensor position system
- Parameters:
targets – map<target_id, target_offsets> of target offsets
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: 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.
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
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
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
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
return a copy using the c++ default copy constructor
Get the attitude sensor offsets
- Returns:
const datastructures::PositionalOffsets& offsets of the attitude sensor
Get the registered depth sensor offsets
- Returns:
const datastructures::PositionalOffsets& offsets of the depth sensor
Get the registered compass offsets
- Returns:
const datastructures::PositionalOffsets& offsets of the compass
Get the registered position system offsets
- Returns:
const datastructures::PositionalOffsets& offsets of the position system
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 the ids of the registered targets
- Returns:
std::vector<std::string_view>
Get the map of stored target offsets objects
- Returns:
const std::unordered_map<std::string, datastructures::PositionalOffsets>&
Get the waterline offset Negative waterline offset means that z=0 is below the waterline
- Returns:
waterline_offset
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 function implemented using binary_hash
Return object information as string
Print object information
Remove the target with the specified target_id
- Parameters:
target_id – name of the registered target
Remove all stored targets
- set_attitude_source(self, sensor_offsets: PositionalOffsets) None
Overloaded function.
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)
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, sensor_offsets: PositionalOffsets) None
Overloaded function.
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)
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, sensor_offsets: PositionalOffsets) None
Overloaded function.
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)
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, sensor_offsets: PositionalOffsets) None
Overloaded function.
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)
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 the waterline offset Negative waterline offset means that z=0 is below the waterline
- Parameters:
waterline_offset
convert object to bytearray
Return the SensorConfiguration object without registered targets
- Returns:
SensorConfiguration