WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::math::CoordinateSystem Class Reference

A helper class that converts Pose3d objects between different standard coordinate frames. More...

#include <wpi/math/geometry/CoordinateSystem.hpp>

Public Member Functions

constexpr CoordinateSystem (const CoordinateAxis &positiveX, const CoordinateAxis &positiveY, const CoordinateAxis &positiveZ)
 Constructs a coordinate system with the given cardinal directions for each axis.

Static Public Member Functions

static constexpr CoordinateSystem NWU ()
 Returns an instance of the North-West-Up (NWU) coordinate system.
static constexpr CoordinateSystem EDN ()
 Returns an instance of the East-Down-North (EDN) coordinate system.
static constexpr CoordinateSystem NED ()
 Returns an instance of the NED coordinate system.
static constexpr Translation3d Convert (const Translation3d &translation, const CoordinateSystem &from, const CoordinateSystem &to)
 Converts the given translation from one coordinate system to another.
static constexpr Rotation3d Convert (const Rotation3d &rotation, const CoordinateSystem &from, const CoordinateSystem &to)
 Converts the given rotation from one coordinate system to another.
static constexpr Pose3d Convert (const Pose3d &pose, const CoordinateSystem &from, const CoordinateSystem &to)
 Converts the given pose from one coordinate system to another.
static constexpr Transform3d Convert (const Transform3d &transform, const CoordinateSystem &from, const CoordinateSystem &to)
 Converts the given transform from one coordinate system to another.

Detailed Description

A helper class that converts Pose3d objects between different standard coordinate frames.

Constructor & Destructor Documentation

◆ CoordinateSystem()

wpi::math::CoordinateSystem::CoordinateSystem ( const CoordinateAxis & positiveX,
const CoordinateAxis & positiveY,
const CoordinateAxis & positiveZ )
inlineconstexpr

Constructs a coordinate system with the given cardinal directions for each axis.

Parameters
positiveXThe cardinal direction of the positive x-axis.
positiveYThe cardinal direction of the positive y-axis.
positiveZThe cardinal direction of the positive z-axis.
Throws:
std::domain_error if the coordinate system isn't special orthogonal

Member Function Documentation

◆ Convert() [1/4]

constexpr Pose3d wpi::math::CoordinateSystem::Convert ( const Pose3d & pose,
const CoordinateSystem & from,
const CoordinateSystem & to )
inlinestaticconstexpr

Converts the given pose from one coordinate system to another.

Parameters
poseThe pose to convert.
fromThe coordinate system the pose starts in.
toThe coordinate system to which to convert.
Returns
The given pose in the desired coordinate system.

◆ Convert() [2/4]

constexpr Rotation3d wpi::math::CoordinateSystem::Convert ( const Rotation3d & rotation,
const CoordinateSystem & from,
const CoordinateSystem & to )
inlinestaticconstexpr

Converts the given rotation from one coordinate system to another.

Parameters
rotationThe rotation to convert.
fromThe coordinate system the rotation starts in.
toThe coordinate system to which to convert.
Returns
The given rotation in the desired coordinate system.

◆ Convert() [3/4]

constexpr Transform3d wpi::math::CoordinateSystem::Convert ( const Transform3d & transform,
const CoordinateSystem & from,
const CoordinateSystem & to )
inlinestaticconstexpr

Converts the given transform from one coordinate system to another.

Parameters
transformThe transform to convert.
fromThe coordinate system the transform starts in.
toThe coordinate system to which to convert.
Returns
The given transform in the desired coordinate system.

◆ Convert() [4/4]

constexpr Translation3d wpi::math::CoordinateSystem::Convert ( const Translation3d & translation,
const CoordinateSystem & from,
const CoordinateSystem & to )
inlinestaticconstexpr

Converts the given translation from one coordinate system to another.

Parameters
translationThe translation to convert.
fromThe coordinate system the translation starts in.
toThe coordinate system to which to convert.
Returns
The given translation in the desired coordinate system.

◆ EDN()

constexpr CoordinateSystem wpi::math::CoordinateSystem::EDN ( )
inlinestaticconstexpr

Returns an instance of the East-Down-North (EDN) coordinate system.

The +X axis is east, the +Y axis is down, and the +Z axis is north.

◆ NED()

constexpr CoordinateSystem wpi::math::CoordinateSystem::NED ( )
inlinestaticconstexpr

Returns an instance of the NED coordinate system.

The +X axis is north, the +Y axis is east, and the +Z axis is down.

◆ NWU()

constexpr CoordinateSystem wpi::math::CoordinateSystem::NWU ( )
inlinestaticconstexpr

Returns an instance of the North-West-Up (NWU) coordinate system.

The +X axis is north, the +Y axis is west, and the +Z axis is up.


The documentation for this class was generated from the following file: