Valkyrie 2026
Loading...
Searching...
No Matches
valor::geometry::Translation3d Class Reference

Represents a 3D translation vector (x, y, z). More...

#include <valkyrie/util/geometry/Pose.h>

Inheritance diagram for valor::geometry::Translation3d:
valor::EigenUnit::NamedPhysicalVector< Translation3d, EigenUnit::UnitVector< units::meter, units::meter, units::meter > > valor::EigenUnit::UnitVector< units::meter, units::meter, units::meter >

Public Member Functions

 Translation3d (const EigenUnit::UnitVector< units::meter, units::meter, units::meter > &b)
 Translation3d (const Translation2d &t)
 Construct a 3D translation from a 2D translation (z = 0).
 Translation3d (units::meter_t distance, const Rotation3d &direction)
 Construct a 3D translation from a distance and direction. Converts from spherical coordinates: distance along the given rotation's direction.
 Translation3d (frc::Translation3d frcTrans)
 Construct a 3D translation from an frc::Translation3d.
 Translation3d (frc::Translation2d frcTrans)
 Construct a 3D translation from an frc::Translation2d, setting Z to zero.
Translation2d ToTranslation2d () const
 Project this translation onto the X-Y plane.
Translation3d RotateBy (const Rotation3d &rot) const
 Rotate this translation by a Rotation3d.
units::meter_t Distance (const Translation3d &other) const
 Distance from this translation to another.
Translation3d operator* (double scalar) const
 Scalar multiplication.
Translation3d operator/ (double scalar) const
 Scalar division.
Public Member Functions inherited from valor::EigenUnit::NamedPhysicalVector< Translation3d, EigenUnit::UnitVector< units::meter, units::meter, units::meter > >
 NamedPhysicalVector (const EigenUnit::UnitVector< units::meter, units::meter, units::meter > &b)
Public Member Functions inherited from valor::EigenUnit::UnitVector< units::meter, units::meter, units::meter >
constexpr UnitVector ()
 Default constructor. Initializes all elements to zero.
constexpr UnitVectoroperator= (const UnitVector &)=default
 Copy assignment.
constexpr const StorageTypeRaw () const
 Get a constant reference to the underlying raw Eigen data.
constexpr auto Get () const
 Get the value of the N-th element with its unit.
void Set (units::unit_t< std::tuple_element_t< N, UnitTuple > > val)
 Set the value of the N-th element.
auto Norm () const
 Computes the L2 norm (magnitude). Requires all elements to have the same unit tag.
auto Normalized () const
 Returns a normalized (unit-length) vector. Result is dimensionless. Only valid if all elements have the same unit.
auto Dot (const UnitVector< OtherTags... > &other) const
 Dot product with another UnitVector. Resulting unit is the product of the first tags of both vectors.
constexpr auto Head () const
 Extract the first N elements as a new UnitVector.
constexpr auto Tail () const
 Extract the last N elements as a new UnitVector.
constexpr auto Slice () const
 Extract N elements after the Start as a new UnitVector.
constexpr UnitVector operator+ (const UnitVector< OtherTags... > &other) const
 Vector addition.
constexpr UnitVector operator- (const UnitVector< OtherTags... > &other) const
 Vector subtraction.
constexpr UnitVectoroperator+= (const UnitVector< OtherTags... > &other)
 In-place vector addition.
constexpr UnitVectoroperator-= (const UnitVector< OtherTags... > &other)
 In-place vector subtraction.
constexpr auto operator* (const units::unit_t< ScalarTag > &scalar) const
 Multiplication by a scalar unit.
constexpr auto operator/ (const units::unit_t< ScalarTag > &scalar) const
 Division by a scalar unit.
bool operator== (const UnitVector< OtherTags... > &other) const
 Equality operator.
constexpr auto CWiseProduct (const UnitVector< OtherTags... > &other) const
 Component-wise product with another UnitVector.
constexpr auto CWiseQuotient (const UnitVector< OtherTags... > &other) const
 Component-wise quotient with another UnitVector.
constexpr UnitVector CWiseAbs () const
 Component-wise absolute value.
constexpr UnitVector CWiseMin (const UnitVector &other) const
 Component-wise minimum.
constexpr UnitVector CWiseMax (const UnitVector &other) const
 Component-wise maximum.
constexpr UnitVector Clamp (const UnitVector &lo, const UnitVector &hi) const
 Clamp each element between lo and hi vectors.
bool IsApprox (const UnitVector &other, units::unit_t< std::tuple_element_t< 0, UnitTuple > > tol=units::unit_t< std::tuple_element_t< 0, UnitTuple > >{1e-9}) const
 Check if two vectors are approximately equal.
auto Sum () const
 Computes the sum of all elements. Only valid if all units are the same.
auto Mean () const
 Computes the mean of all elements. Only valid if all units are the same.
constexpr auto X () const
 Access the first element (x).
constexpr auto Y () const
 Access the second element (y).
constexpr auto Z () const
 Access the third element (z).
constexpr auto W () const
 Access the fourth element (w).
auto AsDiagonal () const
 Converts the vector to a diagonal matrix.
auto LPNorm () const
 Computes the Lp norm.
auto StableNorm () const
 Computes the stable norm.
constexpr auto Begin ()
constexpr auto End ()

Additional Inherited Members

Public Types inherited from valor::EigenUnit::UnitVector< units::meter, units::meter, units::meter >
using StorageType
 The underlying Eigen storage type.
using UnitTuple
 A tuple of the unit tags.
Static Public Member Functions inherited from valor::EigenUnit::UnitVector< units::meter, units::meter, units::meter >
static constexpr UnitVector Zero ()
 Create a zero-initialized vector.
static UnitVector FromArray (const std::array< double, Size > &arr)
 Construct a UnitVector from a std::array of doubles. Values are assumed to be in the target units.
static UnitVector FromSpan (const std::span< double, Size > &s)
 Construct a UnitVector from a std::span of doubles. Values are assumed to be in the target units.
static UnitVector Constant (units::unit_t< typename std::tuple_element_t< 0, UnitTuple > > val)
 Create a vector where all elements are set to a constant value. Only valid if all units are the same.
static auto Skew (const UnitVector< UnitTags... > &vec)
 Converts a 3D vector to a skew-symmetric matrix.
Static Public Attributes inherited from valor::EigenUnit::UnitVector< units::meter, units::meter, units::meter >
static constexpr std::size_t Size
 The number of elements in the vector.

Detailed Description

Represents a 3D translation vector (x, y, z).

Constructor & Destructor Documentation

◆ Translation3d() [1/4]

valor::geometry::Translation3d::Translation3d ( const Translation2d & t)
inlineexplicit

Construct a 3D translation from a 2D translation (z = 0).

Parameters
tThe 2D translation.

◆ Translation3d() [2/4]

valor::geometry::Translation3d::Translation3d ( units::meter_t distance,
const Rotation3d & direction )
inline

Construct a 3D translation from a distance and direction. Converts from spherical coordinates: distance along the given rotation's direction.

Parameters
distanceThe distance from the origin.
directionThe direction as a Rotation3d.

◆ Translation3d() [3/4]

valor::geometry::Translation3d::Translation3d ( frc::Translation3d frcTrans)
inlineexplicit

Construct a 3D translation from an frc::Translation3d.

Parameters
frcTransThe frc translation to convert.

◆ Translation3d() [4/4]

valor::geometry::Translation3d::Translation3d ( frc::Translation2d frcTrans)
inlineexplicit

Construct a 3D translation from an frc::Translation2d, setting Z to zero.

Parameters
frcTransThe frc 2D translation to lift into 3D.

Member Function Documentation

◆ Distance()

units::meter_t valor::geometry::Translation3d::Distance ( const Translation3d & other) const
inline

Distance from this translation to another.

Parameters
otherThe other translation.
Returns
The distance in meters.

◆ RotateBy()

Translation3d valor::geometry::Translation3d::RotateBy ( const Rotation3d & rot) const
inline

Rotate this translation by a Rotation3d.

Parameters
rotThe rotation to apply.
Returns
The rotated translation.

◆ ToTranslation2d()

Translation2d valor::geometry::Translation3d::ToTranslation2d ( ) const
inline

Project this translation onto the X-Y plane.

Returns
The 2D translation.

The documentation for this class was generated from the following file:
  • src/main/include/valkyrie/util/geometry/Pose.h