A specification for an SO(3) rotation, to be used for serialization purposes, e.g., to define stochastic scenarios.
This structure specifies either one specific rotation or else a distribution of possible rotations. It does not provide mathematical operators to compose or mutate rotations. Instead, users should call either GetDeterministicValue() or ToSymbolic() to obtain a RotationMatrix value that can be operated on.
For an overview of configuring stochastic transforms, see Configuring transforms and Configuring distributions.
See Implementing Serialize for implementation details, especially the unusually public member fields.
#include <drake/common/schema/rotation.h>
Classes | |
struct | AngleAxis |
Rotation constructed from a fixed axis and an angle. More... | |
struct | Identity |
No-op rotation. More... | |
struct | Rpy |
A roll-pitch-yaw rotation, using the angle conventions of Drake's RollPitchYaw. More... | |
struct | Uniform |
Rotation sampled from a uniform distribution over SO(3). More... | |
Public Types | |
using | Variant = std::variant< Identity, Rpy, AngleAxis, Uniform > |
Public Member Functions | |
Rotation ()=default | |
Constructs the Identity rotation. More... | |
Rotation (const math::RotationMatrix< double > &) | |
Constructs an Rpy rotation with the given value. More... | |
Rotation (const math::RollPitchYaw< double > &) | |
Constructs an Rpy rotation with the given value. More... | |
bool | IsDeterministic () const |
Returns true iff this is fully deterministic. More... | |
math::RotationMatrixd | GetDeterministicValue () const |
If this is deterministic, retrieves its value. More... | |
math::RotationMatrix< symbolic::Expression > | ToSymbolic () const |
Returns the symbolic form of this rotation. More... | |
math::RotationMatrixd | Sample (RandomGenerator *generator) const |
Samples this Rotation. More... | |
void | set_rpy_deg (const Eigen::Vector3d &rpy_deg) |
Sets this value to the given deterministic RPY, in degrees. More... | |
template<typename Archive > | |
void | Serialize (Archive *a) |
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable | |
Rotation (const Rotation &)=default | |
Rotation & | operator= (const Rotation &)=default |
Rotation (Rotation &&)=default | |
Rotation & | operator= (Rotation &&)=default |
Public Attributes | |
Variant | value |
|
explicit |
Constructs an Rpy rotation with the given value.
|
explicit |
Constructs an Rpy rotation with the given value.
math::RotationMatrixd GetDeterministicValue | ( | ) | const |
If this is deterministic, retrieves its value.
std::exception | if this is not fully deterministic. |
bool IsDeterministic | ( | ) | const |
Returns true iff this is fully deterministic.
math::RotationMatrixd Sample | ( | RandomGenerator * | generator | ) | const |
Samples this Rotation.
If this is deterministic, the result is the same as GetDeterministicValue.
void Serialize | ( | Archive * | a | ) |
void set_rpy_deg | ( | const Eigen::Vector3d & | rpy_deg | ) |
Sets this value to the given deterministic RPY, in degrees.
math::RotationMatrix<symbolic::Expression> ToSymbolic | ( | ) | const |
Returns the symbolic form of this rotation.
If this is deterministic, the result will contain no variables. If this is random, the result will contain one or more random variables, based on the distributions in use.
Variant value |