mrpt.obs

mrpt.obs — Python bindings for MRPT sensor observations and actions.

Package Contents

class mrpt.obs.CAction

C++ API: class mrpt::obs::CAction

Bases: mrpt.serialization.CSerializable

Base class of robot actions (e.g. odometry increments), stored in rawlogs.

timestamp: datetime.timedelta
GetRuntimeClass() → mrpt.rtti.TRuntimeClassId

Returns information about the class of an object in runtime.

class mrpt.obs.CActionCollection

C++ API: class mrpt::obs::CActionCollection

Bases: mrpt.serialization.CSerializable

A collection of robot actions, stored in rawlogs.

clear() → None

Erase all actions from the list.

get(arg0: int) → CAction

Returns the i-th action.

getBestMovementEstimation() → CActionRobotMovement2D

Returns the CActionRobotMovement2D with the best estimation method, or None

insert(arg0: CAction) → None

Add a new object to the list, making a deep copy.

size() → int

Returns the actions count in the collection.

class mrpt.obs.CActionRobotMovement2D

C++ API: class mrpt::obs::CActionRobotMovement2D

Bases: CAction

Represents a probabilistic 2D movement of the robot mobile base.

class TDrawSampleMotionModel(value: int)

Members:

mmGaussian

mmThrun

property name: str
property value: int
mmGaussian: ClassVar[CActionRobotMovement2D]
mmThrun: ClassVar[CActionRobotMovement2D]
class TEstimationMethod(value: int)

Members:

emOdometry

emScan2DMatching

property name: str
property value: int
emOdometry: ClassVar[CActionRobotMovement2D]
emScan2DMatching: ClassVar[CActionRobotMovement2D]
class TMotionModelOptions

Options of the probabilistic 2D motion models.

class TOptions_GaussianModel
class TOptions_GaussianModel(a1: float, a2: float, a3: float, a4: float, minStdXY: float, minStdPHI: float)

Parameters of the Gaussian motion model.

a1: float
a2: float
a3: float
a4: float
minStdPHI: float
minStdXY: float
class TOptions_ThrunModel

Parameters of the particle-based motion model (Thrun et al.).

additional_std_XY: float
additional_std_phi: float
alfa1_rot_rot: float
alfa2_rot_trans: float
alfa3_trans_trans: float
alfa4_trans_rot: float
nParticlesCount: int
gaussianModel: CActionRobotMovement2D
modelSelection: CActionRobotMovement2D
thrunModel: CActionRobotMovement2D
property poseChange: mrpt.poses.CPosePDF

The 2D pose change probabilistic estimation (a CPosePDF)

property rawOdometryIncrementReading: mrpt.poses.CPose2D

Raw odometry reading (increment since last step)

emOdometry: ClassVar[CActionRobotMovement2D]
emScan2DMatching: ClassVar[CActionRobotMovement2D]
estimationMethod: CActionRobotMovement2D
hasVelocities: bool
mmGaussian: ClassVar[CActionRobotMovement2D]
mmThrun: ClassVar[CActionRobotMovement2D]
motionModelConfiguration: CActionRobotMovement2D
velocityLocal: mrpt.math.TTwist2D
GetRuntimeClass() → mrpt.rtti.TRuntimeClassId

Returns information about the class of an object in runtime.

computeFromOdometry(odometryIncrement: mrpt.poses.CPose2D, options: CActionRobotMovement2D) → None

Computes poseChange from an odometry increment and a motion model

drawSingleSample() → mrpt.poses.CPose2D

Draws a sample from the motion model

class mrpt.obs.CActionRobotMovement3D

C++ API: class mrpt::obs::CActionRobotMovement3D

Bases: CAction

Represents a probabilistic motion increment in SE(3).

class TMotionModelOptions

Options of the probabilistic 3D motion models.

class TOptions_6DOFModel

Parameters of the particle-based 6DOF motion model.

a1: float
a10: float
a2: float
a3: float
a4: float
a5: float
a6: float
a7: float
a8: float
a9: float
additional_std_XYZ: float
additional_std_angle: float
nParticlesCount: int
mm6DOFModel: CActionRobotMovement3D
property poseChange: mrpt.poses.CPose3DPDFGaussian

Pose change as a CPose3DPDFGaussian

rawOdometryIncrementReading: mrpt.poses.CPose3D
computeFromOdometry(odometryIncrement: mrpt.poses.CPose3D, options: CActionRobotMovement3D) → None

Computes poseChange from an odometry increment and a motion model

class mrpt.obs.CObservation

C++ API: class mrpt::obs::CObservation

Bases: mrpt.serialization.CSerializable

Base class of all sensor observations: a timestamp, a sensor label and data.

sensorLabel: str
timestamp: datetime.timedelta
GetRuntimeClass() → mrpt.rtti.TRuntimeClassId

Returns information about the class of an object in runtime.

getSensorPose() → mrpt.poses.CPose3D

Returns the sensor pose (6D) relative to the robot

getTimeStamp() → datetime.timedelta

Returns the observation timestamp.

load() → None

Loads externally-stored data (e.g. images), if any

unload() → None

Frees externally-stored data from memory, if any

class mrpt.obs.CObservation2DRangeScan

C++ API: class mrpt::obs::CObservation2DRangeScan

Bases: CObservation

A “CObservation”-derived class that represents a 2D range scan measurement (typically from a laser scanner).

property aperture: float

Field-of-view in radians

property maxRange: float

Maximum sensor range in meters

property rightToLeft: bool

Scan direction: True=CCW, False=CW

property sensorPose: mrpt.poses.CPose3D

Sensor 6D pose relative to robot base

getScanRange(arg0: int) → float

Returns the range of the i-th ray, in meters.

getScanRangeValidity(arg0: int) → bool

Returns whether the i-th ray has a valid range (false: no echo).

getScanRangesAsNumpy() → numpy.ndarray

Returns all scan ranges as a 1D float32 numpy array

getScanSize() → int

Get number of scan rays.

getValidRangesAsNumpy() → numpy.ndarray

Returns validity flags as a 1D bool numpy array

resizeScan(arg0: int) → None

Resizes all data vectors to allocate a given number of scan rays.

setScanRange(arg0: int, arg1: float) → None

Sets the range of the i-th ray, in meters.

setScanRangeValidity(arg0: int, arg1: bool) → None

Sets whether the i-th ray has a valid range.

class mrpt.obs.CObservation3DRangeScan

C++ API: class mrpt::obs::CObservation3DRangeScan

Bases: CObservation

A depth or RGB+D image from a time-of-flight or structured-light sensor.

property cameraParams: mrpt.img.TCamera

Depth camera intrinsics

property cameraParamsIntensity: mrpt.img.TCamera

Intensity camera intrinsics

property rangeUnits: float

Meters per unit in the raw range image

property range_is_depth: bool

True: ranges are depth (Z); False: distances along each pixel ray

confidenceImage: mrpt.img.CImage
hasConfidenceImage: bool
hasIntensityImage: bool
hasPoints3D: bool
hasRangeImage: bool
intensityImage: mrpt.img.CImage
maxRange: float
relativePoseIntensityWRTDepth: mrpt.poses.CPose3D
sensorPose: mrpt.poses.CPose3D
stdError: float
getPoints3DAsNumpy() → numpy.ndarray

Returns the 3D points as an Nx3 float32 array (see unprojectInto())

getRangeImageAsNumpy() → numpy.ndarray

Returns the range image as an HxW float32 array, in meters (0 = invalid)

getRangeImageRawAsNumpy() → numpy.ndarray

Returns the raw range image as an HxW uint16 array (multiply by rangeUnits for meters)

getScanSize() → int

Number of 3D points (if hasPoints3D)

setRangeImageFromNumpy(ranges: numpy.ndarray) → None

Sets the range image from an HxW array of ranges in meters. NaN or infinite values are stored as 0 (invalid).

unprojectInto(params: T3DPointsProjectionParams = ...) → None

Computes the 3D points (points3D_*) from the range image and camera intrinsics

class mrpt.obs.CObservationGPS

C++ API: class mrpt::obs::CObservationGPS

Bases: CObservation

This class stores messages from GNSS or GNSS+IMU devices, from consumer-grade inexpensive GPS receivers to Novatel/Topcon/… advanced RTK solutions.

property covariance_enu: mrpt.math.CMatrixDouble33 | None

Optional 3x3 ENU position covariance (m^2), or None

fix_type: GnssFixType
has_satellite_timestamp: bool
originalReceivedTimestamp: datetime.timedelta
sensorPose: mrpt.poses.CPose3D
clear() → None

Removes all GNSS messages

getGGA() → gnss.Message_NMEA_GGA | None

Returns a copy of the NMEA GGA message, or None

getRMC() → gnss.Message_NMEA_RMC | None

Returns a copy of the NMEA RMC message, or None

hasGGA() → bool

True if the observation has an NMEA GGA message

hasRMC() → bool

True if the observation has an NMEA RMC message

setGGA(msg: gnss.Message_NMEA_GGA) → None

Stores (or replaces) the NMEA GGA message

setRMC(msg: gnss.Message_NMEA_RMC) → None

Stores (or replaces) the NMEA RMC message

class mrpt.obs.CObservationIMU

C++ API: class mrpt::obs::CObservationIMU

Bases: CObservation

Measurements of an inertial measurement unit (IMU): orientation, angular velocity, accelerations, etc.

get(idx: TIMUDataIndex) → float

Returns one measurement (it must have been set).

getRawMeasurementsAsNumpy() → numpy.ndarray

Returns raw IMU measurements as 1D float64 numpy array

set(idx: TIMUDataIndex, value: float) → None

Sets one measurement and marks it as valid.

class mrpt.obs.CObservationImage

C++ API: class mrpt::obs::CObservationImage

Bases: CObservation

An image from a camera, along with its pose on the robot and intrinsic parameters.

cameraParams: mrpt.img.TCamera
cameraPose: mrpt.poses.CPose3D
image: mrpt.img.CImage
class mrpt.obs.CObservationOdometry

C++ API: class mrpt::obs::CObservationOdometry

Bases: CObservation

An observation of the current (cumulative) odometry for a wheeled robot.

odometry: mrpt.poses.CPose2D
class mrpt.obs.CObservationRobotPose

C++ API: class mrpt::obs::CObservationRobotPose

Bases: CObservation

An observation providing an alternative robot pose from an external source.

pose: mrpt.poses.CPose3DPDFGaussian
class mrpt.obs.CRawlog

C++ API: class mrpt::obs::CRawlog

Bases: mrpt.serialization.CSerializable

The main class for loading and processing robotics datasets, or “rawlogs”.

class TEntryType(value: int)

Members:

etSensoryFrame

etActionCollection

etObservation

etOther

property name: str
property value: int
etActionCollection: ClassVar[CRawlog]
etObservation: ClassVar[CRawlog]
etOther: ClassVar[CRawlog]
etSensoryFrame: ClassVar[CRawlog]
etActionCollection: ClassVar[CRawlog]
etObservation: ClassVar[CRawlog]
etOther: ClassVar[CRawlog]
etSensoryFrame: ClassVar[CRawlog]
static ReadFromArchive(archive: mrpt.serialization.CArchive, entry: int = 0) → tuple

Reads the next entry from a rawlog stream (see mrpt.io.archiveFrom()). Returns (readOk, nextEntryIndex, actions, sensoryFrame, observation): either (actions, sensoryFrame) or observation are None, depending on the rawlog format. readOk is False at the end of the stream.

clear() → None

Removes all entries.

static detectImagesDirectory(rawlogFilename: str) → str

Returns the directory of externally-stored images for a given rawlog file

empty() → bool

Returns true if the rawlog is empty.

getAsAction(index: int) → CActionCollection

Returns entry i as a CActionCollection. Raises if it has a different type.

getAsGeneric(index: int) → mrpt.serialization.CSerializable

Returns entry i, whatever its type

getAsObservation(index: int) → CObservation

Returns entry i as a CObservation. Raises if it has a different type.

getAsObservations(index: int) → CSensoryFrame

Returns entry i as a CSensoryFrame. Raises if it has a different type.

getCommentText() → str

Returns the embedded comment text, if any

getType(index: int) → CRawlog

Returns the type of a given element.

insert(obj: mrpt.serialization.CSerializable) → None

Appends an object (CSensoryFrame, CActionCollection, CObservation, …). The object is stored by reference, not copied.

loadFromRawLogFile(fileName: str, non_obs_objects_are_legal: bool = False) → bool

Loads a .rawlog file (possibly compressed). Returns False on error.

remove(index: int) → None

Removes the entry at the given index.

saveToRawLogFile(fileName: str) → bool

Saves to a .rawlog file. Returns False on error.

setCommentText(text: str) → None

Changes the block of comment text for the rawlog.

size() → int

Returns the number of actions / observations object in the sequence.

class mrpt.obs.CSensoryFrame

C++ API: class mrpt::obs::CSensoryFrame

Bases: mrpt.serialization.CSerializable

A “sensory frame” is a set of observations taken by the robot approximately at the same time, so they can be considered as a multi-sensor “snapshot” of the environment.

clear() → None

Clear the container, so it holds no observations.

insert(arg0: CObservation) → None

Appends an observation.

size() → int

Returns the number of observations in the list.

class mrpt.obs.CSimpleMap

Bases: mrpt.serialization.CSerializable

A view-based map: a set of poses and what the robot saw from those poses.

class Keyframe
class Keyframe(pose: mrpt.poses.CPose3DPDF, sf: CSensoryFrame, localTwist: mrpt.math.TTwist3D | None = None)

One keyframe of a CSimpleMap: a pose PDF, a sensory frame and an optional twist.

localTwist: mrpt.math.TTwist3D | None
pose: mrpt.poses.CPose3DPDF
sf: CSensoryFrame
changeCoordinatesOrigin(newOrigin: mrpt.poses.CPose3D) → None

Transforms all keyframe poses so the old origin becomes newOrigin

clear() → None

Remove all stored keyframes.

empty() → bool

Returns true if the map has no keyframes.

get(index: int) → CSimpleMap

Returns the i-th keyframe.

insert(pose: mrpt.poses.CPose3DPDF, sf: CSensoryFrame, localTwist: mrpt.math.TTwist3D | None = None) → None
insert(keyframe: CSimpleMap) → None

Appends a keyframe (pose PDF and sensory frame).

loadFromFile(fileName: str) → bool

Loads a .simplemap file (possibly compressed). Returns False on error.

remove(index: int) → None

Removes the i-th keyframe.

saveToFile(fileName: str) → bool

Saves to a .simplemap file. Returns False on error.

size() → int

Returns the number of keyframes in the map.

class mrpt.obs.GnssFixType(value: int)

Members:

UNKNOWN

NO_FIX

AUTONOMOUS

SBAS

GBAS

DGPS

RTK_FLOAT

RTK_FIXED

PPP

DEAD_RECKONING

SIMULATION

property name: str
property value: int
AUTONOMOUS: ClassVar[GnssFixType]
DEAD_RECKONING: ClassVar[GnssFixType]
DGPS: ClassVar[GnssFixType]
GBAS: ClassVar[GnssFixType]
NO_FIX: ClassVar[GnssFixType]
PPP: ClassVar[GnssFixType]
RTK_FIXED: ClassVar[GnssFixType]
RTK_FLOAT: ClassVar[GnssFixType]
SBAS: ClassVar[GnssFixType]
SIMULATION: ClassVar[GnssFixType]
UNKNOWN: ClassVar[GnssFixType]
class mrpt.obs.T3DPointsProjectionParams

C++ API: struct mrpt::obs::T3DPointsProjectionParams

Options of CObservation3DRangeScan.unprojectInto().

MAKE_ORGANIZED: bool
decimation: int
layer: str
robotPoseInTheWorld: mrpt.poses.CPose3D | None
takeIntoAccountSensorPoseOnRobot: bool
class mrpt.obs.TIMUDataIndex(value: int)

Index of each measurement in CObservationIMU

Members:

IMU_X_ACC

IMU_Y_ACC

IMU_Z_ACC

IMU_YAW_VEL

IMU_WZ

IMU_PITCH_VEL

IMU_WY

IMU_ROLL_VEL

IMU_WX

IMU_X_VEL

IMU_Y_VEL

IMU_Z_VEL

IMU_YAW

IMU_PITCH

IMU_ROLL

IMU_X

IMU_Y

IMU_Z

IMU_MAG_X

IMU_MAG_Y

IMU_MAG_Z

IMU_PRESSURE

IMU_ALTITUDE

IMU_TEMPERATURE

IMU_ORI_QUAT_X

IMU_ORI_QUAT_Y

IMU_ORI_QUAT_Z

IMU_ORI_QUAT_W

IMU_YAW_VEL_GLOBAL

IMU_PITCH_VEL_GLOBAL

IMU_ROLL_VEL_GLOBAL

IMU_X_ACC_GLOBAL

IMU_Y_ACC_GLOBAL

IMU_Z_ACC_GLOBAL

property name: str
property value: int
IMU_ALTITUDE: ClassVar[TIMUDataIndex]
IMU_MAG_X: ClassVar[TIMUDataIndex]
IMU_MAG_Y: ClassVar[TIMUDataIndex]
IMU_MAG_Z: ClassVar[TIMUDataIndex]
IMU_ORI_QUAT_W: ClassVar[TIMUDataIndex]
IMU_ORI_QUAT_X: ClassVar[TIMUDataIndex]
IMU_ORI_QUAT_Y: ClassVar[TIMUDataIndex]
IMU_ORI_QUAT_Z: ClassVar[TIMUDataIndex]
IMU_PITCH: ClassVar[TIMUDataIndex]
IMU_PITCH_VEL: ClassVar[TIMUDataIndex]
IMU_PITCH_VEL_GLOBAL: ClassVar[TIMUDataIndex]
IMU_PRESSURE: ClassVar[TIMUDataIndex]
IMU_ROLL: ClassVar[TIMUDataIndex]
IMU_ROLL_VEL: ClassVar[TIMUDataIndex]
IMU_ROLL_VEL_GLOBAL: ClassVar[TIMUDataIndex]
IMU_TEMPERATURE: ClassVar[TIMUDataIndex]
IMU_WX: ClassVar[TIMUDataIndex]
IMU_WY: ClassVar[TIMUDataIndex]
IMU_WZ: ClassVar[TIMUDataIndex]
IMU_X: ClassVar[TIMUDataIndex]
IMU_X_ACC: ClassVar[TIMUDataIndex]
IMU_X_ACC_GLOBAL: ClassVar[TIMUDataIndex]
IMU_X_VEL: ClassVar[TIMUDataIndex]
IMU_Y: ClassVar[TIMUDataIndex]
IMU_YAW: ClassVar[TIMUDataIndex]
IMU_YAW_VEL: ClassVar[TIMUDataIndex]
IMU_YAW_VEL_GLOBAL: ClassVar[TIMUDataIndex]
IMU_Y_ACC: ClassVar[TIMUDataIndex]
IMU_Y_ACC_GLOBAL: ClassVar[TIMUDataIndex]
IMU_Y_VEL: ClassVar[TIMUDataIndex]
IMU_Z: ClassVar[TIMUDataIndex]
IMU_Z_ACC: ClassVar[TIMUDataIndex]
IMU_Z_ACC_GLOBAL: ClassVar[TIMUDataIndex]
IMU_Z_VEL: ClassVar[TIMUDataIndex]
class mrpt.obs.TMapGenericParams

Bases: mrpt.config.CLoadableOptions, mrpt.serialization.CSerializable

Parameters common to all metric maps.

enableObservationInsertion: bool
enableObservationLikelihood: bool
enableSaveAs3DObject: bool
class mrpt.obs.TMetricMapInitializer

Bases: mrpt.config.CLoadableOptions

Base class of the definitions of one metric map (its type and parameters).

genericMapParams: TMapGenericParams
static factory(mapClassName: str) → TMetricMapInitializer

Creates the definition of a map by its class name, e.g. ‘COccupancyGridMap2D’. Requires importing mrpt.maps first, which registers the map types.

getMetricMapClassName() → str

Returns the C++ class name of the map this definition creates

class mrpt.obs.TSetOfMetricMapInitializers

Bases: mrpt.config.CLoadableOptions

A set of map definitions, used to build a CMultiMetricMap.

clear() → None

Removes all map definitions.

push_back(mapDefinition: TMetricMapInitializer) → None

Appends a map definition.

size() → int

Returns the number of map definitions.