mrpt.nav

Package Contents

class mrpt.nav.CLogFileRecord

C++ API: class mrpt::nav::CLogFileRecord

One navigation step of the reactive navigator log.

class TInfoPerPTG

Log data of one PTG in one navigation step.

property PTG_desc: str

Short description of the PTG

property TP_Obstacles: list[float]

Distance to obstacles in TP-Space (pseudometers), for directions from -pi to pi

property TP_Robot: mrpt.math.TPoint2D

Robot location in TP-Space (normally the origin)

property TP_Targets: list[mrpt.math.TPose2D]

Target(s) in TP-Space

property desiredDirection: float

Direction chosen by the holonomic method [rad]

property desiredSpeed: float

Speed chosen by the holonomic method

property evalFactors: dict[str, float]

Evaluation factors, by name

property evaluation: float

Final score of this candidate

property timeForHolonomicMethod: float

Time spent in the holonomic method [s]

property timeForTPObsTransformation: float

Time to transform obstacles into TP-Space [s]

WS_targets_relative: list[mrpt.math.TPose2D]
infoPerPTG: list[CLogFileRecord]
nPTGs: int
relPoseSense: mrpt.math.TPose2D
relPoseVelCmd: mrpt.math.TPose2D
robotPoseLocalization: mrpt.math.TPose2D
robotPoseOdometry: mrpt.math.TPose2D
class mrpt.nav.CParameterizedTrajectoryGenerator

C++ API: class mrpt::nav::CParameterizedTrajectoryGenerator

Base class for all Parameterized Trajectory Generators (PTGs).

static CreatePTG(ptg_class_name: str, ini_text: str, section: str, key_prefix: str = '') → CParameterizedTrajectoryGenerator

Factory: create a PTG from INI-format string, section, and key prefix.

PTG_IsIntoDomain(x: float, y: float) → bool

Returns true if (x, y) is within the PTG domain.

alpha2index(alpha: float) → int

Discrete path index for the direction alpha (radians).

deinitialize() → None

De-initializes the PTG, so its parameters can be changed.

directionToMotionCommand(k: int) → mrpt.kinematics.CVehicleVelCmd

Velocity command (a mrpt.kinematics.CVehicleVelCmd subclass) to follow path k.

getAlphaValuesCount() → int

Get the number of different, discrete paths in this family.

getDescription() → str

Gets a short textual description of the PTG and its parameters.

getMaxAngVel() → float

Maximum angular velocity of this PTG (rad/s).

getMaxLinVel() → float

Maximum linear velocity of this PTG (m/s).

getPathCount() → int

Get the number of different, discrete paths in this family.

getPathDist(k: int, step: int) → float

Distance traveled along path k at a step, in pseudometers (not normalized).

getPathPose(k: int, step: int) → mrpt.math.TPose2D

Pose of the vehicle (TPose2D) at a step of path k, relative to its start.

getPathStepCount(k: int) → int

Number of discrete steps of path k.

getPathStepDuration() → float

Duration of each path step, in seconds.

getPathStepForDist(k: int, dist: float) → int | None

Largest step of path k with a traveled distance < dist (pseudometers), or None if there is none.

getPathTwist(k: int, step: int) → mrpt.math.TTwist2D

Velocity (TTwist2D) at a step of path k, in the frame of the start of the path.

getRefDistance() → float

Reference distance (meters): the length of the paths, used to normalize TP-Space distances.

index2alpha(k: int) → float

Direction alpha (radians, in [-pi, pi]) of the discrete path index k.

initTPObstacleSingle(k: int) → float

Returns the initial TP-Obstacle of path k, as initTPObstacles().

initTPObstacles() → list[float]

Returns the initial TP-Obstacles, one per path: the collision-free distance of each path without obstacles (pseudometers).

initialize(cacheFilename: str = '', verbose: bool = False) → None

Initializes the PTG; call after setting all its parameters and before using it. PTGs based on collision grids (CPTG_DiffDrive_*) load their grid from cacheFilename, or compute and save it there; an empty name means “cache_<description>.bin.gz” in the current directory. Other PTGs ignore it.

inverseMap_WS2TP(x: float, y: float, tolerance_dist: float = 0.1) → tuple[int, float] | None

Map a WS point to (k, normalized_d). Returns None if no path found.

isInitialized() → bool

Returns true if initialize() has been called and there was no errors, so the PTG is ready to be queried for paths, obstacles, etc.

loadFromConfigFile(ini_text: str, section: str) → None

Loads the PTG parameters from a configuration file section.

setRefDistance(refDist: float) → None

Sets the reference distance (meters).

updateTPObstacle(ox: float, oy: float, tp_obstacles: list[float]) → list[float]

Returns tp_obstacles (from initTPObstacles()) updated with an obstacle point (ox, oy), relative to the origin of the PTG: the collision-free distance of each path.

updateTPObstacleSingle(ox: float, oy: float, k: int, tp_obstacle_k: float) → float

Like updateTPObstacle(), for path k only: returns tp_obstacle_k (from initTPObstacleSingle()) updated with the obstacle point (ox, oy).

class mrpt.nav.TWaypoint

C++ API: struct mrpt::nav::TWaypoint

TWaypoint(target_x: float, target_y: float, allowed_distance: float, allow_skip: bool = True)

A single navigation waypoint within a TWaypointSequence.

allow_skip: bool
allowed_distance: float
speed_ratio: float
target: mrpt.math.TPoint2D
target_frame_id: str
target_heading: float | None
getAsText() → str

Get in human-readable format.

isValid() → bool

Check whether all the minimum mandatory fields have been filled by the user.

class mrpt.nav.TWaypointSequence

C++ API: struct mrpt::nav::TWaypointSequence

A sequence of waypoints for the waypoints navigator.

waypoints: list[TWaypoint]
append(waypoint: TWaypoint) → None

Appends a waypoint to the sequence.

clear() → None

Removes all waypoints.

getAsText() → str

Gets navigation params as a human-readable format.

class mrpt.nav.TWaypointStatus

C++ API: struct mrpt::nav::TWaypointStatus

Bases: TWaypoint

A TWaypoint augmented with runtime execution status fields.

reached: bool
skipped: bool