Geometry#
Two dimensional#
Same as type
ng_float_t, eithernumpy.float32ornumpy.float64.
A two dimensional
numpy.ndarrayof typeng_float_t.
An object convertible to
Vector2.
Note
Any pybind11 function that accepts Vector2 does in fact accept the less restrictive type Vector2Like, which is difficult to encode exactly using the Python type system. For example, property navground.core.Pose2.position can be set to a tuple of two numbers without any issue:
>>> from navground import core
>>> pose = core.Pose2()
>>> pose.position = (1, 2)
array([1., 2.])
On the contrary, pybind11 functions documented to return Vector2 do return this type.
An enum for the frame of references for geometric informations, such as
Pose2andTwist2.Valid values are as follows:
agent-fixed frame
world-fixed frame
Two-dimensional pose composed of planar position and orientation. When not specified, poses are assumed to be in the world-fixed frame.
Poses are also associated to rigid transformations in SE(2)
translation(pose.position) . rotation(pose.orientation). We define the group operations as a multiplication and add methods liketransform_pose()for a pose to operate as a rigid transformation.Transform a relative pose to an absolute pose.
Equivalent to
reference.transform_pose(self) = reference * self- Parameters:
reference – The reference pose
- Returns:
The absolute pose
Returns this transformation in the desired frame of reference.
The returned transformation is defined as
frame.inverse() * self * frame, so that, for any framef, the following expressions are equivalent:pose.transform(other).relative(f)pose.get_transformation_in_frame(frame).transform(other.relative(f ))
- Parameters:
frame – A posed defining the desired frame of reference for the transformation.
- Returns:
The transformation with respect to
frame
Rotate the pose by an angle.
- Parameters:
angle – The rotation angle in radians.
- Returns:
The rotated pose.
Invert a transformation, i.e., SE(2) inversion
- Returns:
The inverse transformation
Transform an absolute pose to a relative pose.
Equivalent to
reference.inverse().transform_pose(self) = reference.inverse() * self- Parameters:
reference – The reference pose
- Returns:
The relative pose
Rotate the pose by an angle.
- Parameters:
angle – The rotation angle in radians.
- Returns:
The rotated pose.
Applies this rigid transformation to a point
Equivalent to
to_absolute_point(point, self)- Parameters:
point – The point to transform
- Returns:
The roto-translated point
Applies this rigid transformation to another pose
Equivalent to
pose.absolute(self)- Parameters:
pose – The pose to transform
- Returns:
self * pose
Applies the rigid transformation to a vector
Equivalent to
to_absolute(vector, self)- Parameters:
vector – The vector to transform
- Returns:
The rotated vector
- Type:
Orientation in world frame
- Type:
Position in world frame
Two-dimensional twist composed of planar velocity and angular speed.
Twist coordinates are in the frame specified by
frame.Transform a twist to
Frame.absolute().- Parameters:
reference – The pose of reference of this relative twist
- Returns:
The same twist in
Frame.absolute()(unchanged if already inFrame.absolute())
Determines if almost zero.
- Parameters:
epsilon_speed – The epsilon speed
epsilon_angular_speed – The epsilon angular speed
- Returns:
True if almost zero, False otherwise.
Transform a twist to
Frame.relative()relative to a pose.- Parameters:
reference – The desired pose of reference
- Returns:
The same twist in
Frame.relative()(unchanged if already inFrame.relative())
Rotate the twist by an angle.
- Parameters:
angle – The rotation angle in radians.
- Returns:
The rotated twist.
Snap components to zero if their module is smaller than epsilon.
- Parameters:
epsilon – The tolerance
- Type:
Angular speed
- Type:
Frame of reference.
- Type:
Velocity
The orientation of a two dimensional vector
- Parameters:
vector – The vector
- Returns:
The orientation of the vector
Normalize an angle to a value in \([-\pi, \pi]\). Apply it when computing angular differences.
- Parameters:
value – The original unbounded angle
- Returns:
The equivalent angle in \([-\pi, \pi]\)
Transform an absolute to a relative vector.
Equivalent to
reference.inverse().transform_vector(value)- Parameters:
value – The absolute vector
reference – The reference pose
- Returns:
The absolute vector
Transform a relative to an absolute vector.
Equivalent to
reference.transform_vector(value)- Parameters:
value – The relative vector
reference – The reference pose
- Returns:
The relative vector
Transform an absolute to a relative vector.
Equivalent to
reference.inverse().transform_point(value)- Parameters:
value – The absolute vector
reference – The reference pose
- Returns:
The absolute point
Transform a relative to an absolute point.
Equivalent to
reference.transform_point(value)- Parameters:
value – The relative point
reference – The reference pose
- Returns:
The relative point
Unit vector with a desired orientated.
- Parameters:
angle – The desired orientation
- Returns:
Vector of norm one and desired orientation
Rotate a two-dimensional vector.
- Parameters:
vector – The original vector
angle – The rotation angle in radians
- Returns:
The rotated vector
Clamp the norm of a vector
- Parameters:
vector – The original vector
max_length – The maximum length
- Returns:
A vector with the original orientation but norm clamped to
max_length.