mrpt.poses

mrpt-poses Python API.

Package Contents

class mrpt.poses.CPoint2D

C++ API: class mrpt::poses::CPoint2D

CPoint2D(x: float, y: float)

Bases: mrpt.serialization.CSerializable

A class used to store a 2D point.

x: float
y: float
asString() → str

Returns a text representation, e.g. “[0.02 1.04]”.

asTPoint() → mrpt.math.TPoint2D

Convert to lightweight mrpt.math.TPoint2D

static fromTPoint(arg0: mrpt.math.TPoint2D) → CPoint2D

Construct CPoint2D from a lightweight mrpt.math.TPoint2D

class mrpt.poses.CPoint3D

C++ API: class mrpt::poses::CPoint3D

CPoint3D(x: float, y: float, z: float)

Bases: mrpt.serialization.CSerializable

A class used to store a 3D point.

x: float
y: float
z: float
asString() → str

Returns a text representation, e.g. “[0.02 1.04 -0.80]”.

asTPoint() → mrpt.math.TPoint3D

Convert to lightweight mrpt.math.TPoint3D

static fromTPoint(arg0: mrpt.math.TPoint3D) → CPoint3D

Construct CPoint3D from a lightweight mrpt.math.TPoint3D

class mrpt.poses.CPose2D

C++ API: class mrpt::poses::CPose2D

CPose2D(x: float, y: float, phi: float) CPose2D(p: CPose3D)

Bases: mrpt.serialization.CSerializable

SE(2) rigid-body pose (x, y, phi).

property phi: float

Phi orientation (radians)

property x: float

X coordinate

property y: float

Y coordinate

asString() → str

Returns human-readable string [x y phi]

asTPose() → mrpt.math.TPose2D

Convert to lightweight mrpt.math.TPose2D

fromString(arg0: str) → None

Set value from string

static fromTPose(arg0: mrpt.math.TPose2D) → CPose2D

Construct CPose2D from a lightweight mrpt.math.TPose2D

inverse() → CPose2D

Returns the inverse pose

norm() → float

Returns the norm of the (x,y) vector

normalizePhi() → None

Forces phi to be in [-pi,pi]

class mrpt.poses.CPose2DInterpolator

C++ API: class mrpt::poses::CPose2DInterpolator

Bases: mrpt.serialization.CSerializable

A time-stamped trajectory in SE(2), with interpolation between poses.

clear() → None

Clears the current sequence of poses.

empty() → bool

Returns true if the trajectory has no poses.

insert(arg0: datetime.timedelta, arg1: mrpt.math.TPose2D) → None

Inserts a new pose in the sequence. It overwrites any previously existing pose at exactly the same time.

interpolate(arg0: datetime.timedelta) → tuple

Returns (TPose2D, valid) — interpolated pose at given time

size() → int

Returns the number of poses in the trajectory.

class mrpt.poses.CPose3D

C++ API: class mrpt::poses::CPose3D

CPose3D(x: float, y: float, z: float, yaw: float = 0, pitch: float = 0, roll: float = 0) CPose3D(arg0: CPose2D)

Bases: mrpt.serialization.CSerializable

SE(3) rigid-body pose (x, y, z, yaw, pitch, roll), with a cached rotation matrix.

property x: float

X coordinate

property y: float

Y coordinate

property z: float

Z coordinate

pitch: float
roll: float
yaw: float
static FromTranslation(arg0: float, arg1: float, arg2: float) → CPose3D

Builds a pose with a translation without rotation.

static FromXYZYawPitchRoll(arg0: float, arg1: float, arg2: float, arg3: float, arg4: float, arg5: float) → CPose3D

Builds a pose from a translation (x,y,z) in meters and (yaw,pitch,roll) angles in radians.

static FromYawPitchRoll(arg0: float, arg1: float, arg2: float) → CPose3D

Builds a pose with a null translation and (yaw,pitch,roll) angles in radians.

asString() → str

Returns a human-readable textual representation of the object (eg: “[x y z yaw pitch roll]”, angles in degrees.)

asTPose() → mrpt.math.TPose3D

Convert to lightweight mrpt.math.TPose3D

composePoint(arg0: mrpt.math.TPoint3D) → mrpt.math.TPoint3D
composePoint(arg0: float, arg1: float, arg2: float) → mrpt.math.TPoint3D

Transforms a point (x, y, z) from the local frame of this pose into the global frame.

static fromTPose(arg0: mrpt.math.TPose3D) → CPose3D

Construct CPose3D from a lightweight mrpt.math.TPose3D

getHomogeneousMatrix() → mrpt.math.CMatrixDouble44

Returns the 4x4 homogeneous transformation matrix

getInverseHomogeneousMatrix() → mrpt.math.CMatrixDouble44

Returns the corresponding 4x4 inverse homogeneous transformation matrix for this point or pose.

getOppositeScalar() → CPose3D

Return the opposite of the current pose instance by taking the negative of all its components individually.

getRotationMatrix() → mrpt.math.CMatrixDouble33

Returns the 3x3 Rotation Matrix

getYawPitchRoll() → tuple[float, float, float]

Returns (yaw, pitch, roll) as a tuple in radians

inverse() → None

Inverts the pose in place

inverseComposePoint(arg0: mrpt.math.TPoint3D) → mrpt.math.TPoint3D
inverseComposePoint(arg0: float, arg1: float, arg2: float) → mrpt.math.TPoint3D

Transforms a point (x, y, z) from the global frame into the local frame of this pose.

setFromValues(arg0: float, arg1: float, arg2: float, arg3: float, arg4: float, arg5: float) → None

Sets the pose from a position (meters) and yaw, pitch, roll angles (radians).

setRotationMatrix(arg0: mrpt.math.CMatrixDouble33) → None

Sets the 3x3 rotation matrix.

setYawPitchRoll(arg0: float, arg1: float, arg2: float) → None

Sets the three rotation angles, in radians.

class mrpt.poses.CPose3DInterpolator

C++ API: class mrpt::poses::CPose3DInterpolator

Bases: mrpt.serialization.CSerializable

A time-stamped trajectory in SE(3), with interpolation between poses.

clear() → None

Clears the current sequence of poses.

empty() → bool

Returns true if the trajectory has no poses.

insert(arg0: datetime.timedelta, arg1: mrpt.math.TPose3D) → None

Inserts a new pose in the sequence. It overwrites any previously existing pose at exactly the same time.

interpolate(arg0: datetime.timedelta) → tuple

Returns (TPose3D, valid) — interpolated pose at given time

size() → int

Returns the number of poses in the trajectory.

class mrpt.poses.CPose3DPDF

C++ API: class mrpt::poses::CPose3DPDF

Bases: mrpt.serialization.CSerializable

Base class of probability density functions (PDFs) of a 3D pose.

getCovariance() → mrpt.math.CMatrixDouble66

Returns the 6x6 covariance matrix

getCovarianceAndMean() → tuple

Returns the tuple (cov: CMatrixDouble66, mean: CPose3D)

getMean() → CPose3D

Returns the mean (expected value) of the distribution

saveToTextFile(file: str) → bool

Saves the distribution to a text file. Returns False on error.

class mrpt.poses.CPose3DPDFGaussian

C++ API: class mrpt::poses::CPose3DPDFGaussian

CPose3DPDFGaussian(arg0: CPose3D) CPose3DPDFGaussian(arg0: CPose3D, arg1: mrpt.math.CMatrixDouble66)

Bases: CPose3DPDF

A PDF of a 3D pose as a Gaussian with a mean and a 6x6 covariance matrix.

cov: mrpt.math.CMatrixDouble66
mean: CPose3D
drawSingleSample() → CPose3D

Draws a single sample from the Gaussian distribution and returns it as a CPose3D.

evaluateNormalizedPDF(arg0: CPose3D) → float

Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1].

evaluatePDF(arg0: CPose3D) → float

Evaluates the PDF at a given point.

saveToTextFile(arg0: str) → bool

Saves the mean and covariance to a text file.

class mrpt.poses.CPose3DPDFGaussianInf

C++ API: class mrpt::poses::CPose3DPDFGaussianInf

CPose3DPDFGaussianInf(arg0: CPose3D) CPose3DPDFGaussianInf(mean: CPose3D, inf_matrix: mrpt.math.CMatrixDouble66)

Bases: CPose3DPDF

A PDF of a 3D pose as a Gaussian with a mean and a 6x6 information (inverse covariance) matrix.

cov_inv: mrpt.math.CMatrixDouble66
mean: CPose3D
drawSingleSample() → CPose3D

Draws a single sample from the distribution and returns it as a CPose3D.

isInfType() → bool

Returns whether the class instance holds the uncertainty in covariance or information form.

class mrpt.poses.CPose3DPDFParticles(M: int = 1)

C++ API: class mrpt::poses::CPose3DPDFParticles

Bases: CPose3DPDF, mrpt.bayes.CParticleFilterCapable

A PDF of a 3D pose, as a set of weighted samples (particles).

drawSingleSample() → CPose3D

Draws one sample from the distribution (weights must be normalized).

getMostLikelyParticle() → mrpt.math.TPose3D

Returns the particle with the highest weight.

getParticlePose(i: int) → mrpt.math.TPose3D

Returns the pose of the i’th particle.

getParticlesAsNumpy() → numpy.ndarray

Returns all particles as an Nx7 array with columns (x, y, z, yaw, pitch, roll, log_weight)

resetDeterministic(location: mrpt.math.TPose3D, particlesCount: int = 0) → None

Sets all particles to the given pose (particlesCount=0 keeps the count)

resetUniform(corner_min: mrpt.math.TPose3D, corner_max: mrpt.math.TPose3D, particlesCount: int = -1) → None

Spreads particles uniformly between two TPose3D corners

size() → int

Returns the number of particles.

class mrpt.poses.CPose3DQuat

C++ API: class mrpt::poses::CPose3DQuat

CPose3DQuat(arg0: CPose3D)

Bases: mrpt.serialization.CSerializable

A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).

quat: mrpt.math.CQuaternionDouble
x: float
y: float
z: float
asString() → str

Returns a human-readable textual representation of the object as: “[x y z qw qx qy qz]”.

asTPose() → mrpt.math.TPose3DQuat

Convert to lightweight mrpt.math.TPose3DQuat

static fromTPose(arg0: mrpt.math.TPose3DQuat) → CPose3DQuat

Construct CPose3DQuat from a lightweight mrpt.math.TPose3DQuat

norm() → float

Returns the Euclidean norm of the translation part.

class mrpt.poses.CPosePDF

C++ API: class mrpt::poses::CPosePDF

Bases: mrpt.serialization.CSerializable

Base class of probability density functions (PDFs) of a 2D pose (x, y, phi).

getCovariance() → mrpt.math.CMatrixDouble33

Returns the 3x3 covariance matrix

getCovarianceAndMean() → tuple

Returns the tuple (cov: CMatrixDouble33, mean: CPose2D)

getMean() → CPose2D

Returns the mean (expected value) of the distribution

saveToTextFile(file: str) → bool

Saves the distribution to a text file. Returns False on error.

class mrpt.poses.CPosePDFGaussian

C++ API: class mrpt::poses::CPosePDFGaussian

CPosePDFGaussian(arg0: CPose2D) CPosePDFGaussian(arg0: CPose2D, arg1: mrpt.math.CMatrixDouble33)

Bases: CPosePDF

A PDF of a 2D pose as a Gaussian with a mean and a 3x3 covariance matrix.

cov: mrpt.math.CMatrixDouble33
mean: CPose2D
drawSingleSample() → CPose2D

Draw a single sample from the Gaussian distribution

evaluateNormalizedPDF(arg0: CPose2D) → float

Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1].

evaluatePDF(arg0: CPose2D) → float

Evaluates the PDF at a given point.

class mrpt.poses.CPosePDFGaussianInf

C++ API: class mrpt::poses::CPosePDFGaussianInf

CPosePDFGaussianInf(arg0: CPose2D) CPosePDFGaussianInf(mean: CPose2D, inf_matrix: mrpt.math.CMatrixDouble33)

Bases: CPosePDF

A PDF of a 2D pose as a Gaussian with a mean and a 3x3 information (inverse covariance) matrix.

cov_inv: mrpt.math.CMatrixDouble33
mean: CPose2D
drawSingleSample() → CPose2D

Draws a single sample from the distribution.

class mrpt.poses.CPosePDFParticles(M: int = 1)

C++ API: class mrpt::poses::CPosePDFParticles

Bases: CPosePDF, mrpt.bayes.CParticleFilterCapable

A PDF of a 2D pose, as a set of weighted samples (particles).

clear() → None

Removes all particles.

drawSingleSample() → CPose2D

Draws one sample from the distribution (weights must be normalized).

getMostLikelyParticle() → mrpt.math.TPose2D

Returns the particle with the highest weight.

getParticlePose(i: int) → mrpt.math.TPose2D

Returns the pose of the i’th particle.

getParticlesAsNumpy() → numpy.ndarray

Returns all particles as an Nx4 array with columns (x, y, phi, log_weight)

resetAroundSetOfPoses(list_poses: list[mrpt.math.TPose2D], num_particles_per_pose: int, spread_x: float, spread_y: float, spread_phi_rad: float) → None

Resets the particles around a set of poses (x, y, phi), with a given number of particles per pose and spread.

resetDeterministic(location: mrpt.math.TPose2D, particlesCount: int = 0) → None

Sets all particles to the given pose (particlesCount=0 keeps the count)

resetUniform(x_min: float, x_max: float, y_min: float, y_max: float, phi_min: float = -3.141592653589793, phi_max: float = 3.141592653589793, particlesCount: int = -1) → None

Spreads particles uniformly in [x_min,x_max]x[y_min,y_max]x[phi_min,phi_max]

size() → int

Returns the number of particles.

class mrpt.poses.CPoseRandomSampler

C++ API: class mrpt::poses::CPoseRandomSampler

An efficient generator of random samples drawn from a given 2D (CPosePDF) or 3D (CPose3DPDF) pose probability density function (pdf).

drawSample2D() → CPose2D

Draw a 2D pose sample

drawSample3D() → CPose3D

Draw a 3D pose sample

setPosePDF(arg0: CPosePDF) → None
setPosePDF(arg0: CPose3DPDF) → None

Sets the 3D pose PDF to draw samples from.

class mrpt.poses.SE_average2

Computes the (optionally weighted) average of a set of SE(2) poses.

append(arg0: CPose2D) → None
append(arg0: CPose2D, arg1: float) → None

Adds a pose with the given weight.

clear() → None

Resets the accumulated poses.

get_average() → CPose2D

Returns the calculated average pose.

class mrpt.poses.SE_average3

Computes the (optionally weighted) average of a set of SE(3) poses.

append(arg0: CPose3D) → None
append(arg0: CPose3D, arg1: float) → None

Adds a pose with the given weight.

clear() → None

Resets the accumulated poses.

get_average() → CPose3D

Returns the calculated average pose.