SensorConfiguration#
A simple coordinate system that allows for storing sensor and target offsets.
Supported sensors are:
compass: Affects
Sensordata.heading
with 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.SensordataUTM
object will cause compute_target_position to returndatastructures.GeolocationUTM
A
datastructures.SensordataLatLon
will 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
Overloaded function.
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)
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 (e.g. MBES) with given target_ids and offsets to the sensor position system
- Parameter
targets
: map<target_id, target_offsets> of target offsets
- Parameter
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
Overloaded function.
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
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
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
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
return a copy using the c++ default copy constructor
create T_CLASS object from bytearray
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
- Parameter
target_id
: name of the registered target
- Returns:
const datastructures::PositionalOffsets& offsets of the target
- Parameter
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.
- Parameter
target_id
: The ID of the target to check for.
- Returns:
True if the sensor configuration has the target, false otherwise.
- Parameter
hash function implemented using binary_hash
Return object information as string
Print object information
Remove the target with the specified target_id
- Parameter
target_id
: name of the registered target
- Parameter
Remove all stored targets
Overloaded function.
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)
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)
Overloaded function.
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)
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)
Overloaded function.
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)
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)
Overloaded function.
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)
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 the waterline offset Negative waterline offset means that z=0 is below the waterline
Parameter
waterline_offset
:
hash function implemented using slow_hash
convert object to bytearray
Return the SensorConfiguration object without registered targets
- Returns:
SensorConfiguration