Parasol Planning Library (PPL)
|
#include <Cfg.h>
Public Member Functions | |
Construction | |
Cfg () | |
Cfg (Robot *const _robot) | |
Cfg (const mathtool::Vector3d &_v, Robot *const _robot=nullptr) | |
Cfg (const Cfg &_other) | |
Cfg (Cfg &&_other) | |
virtual | ~Cfg () |
Assignment | |
Cfg & | operator= (const Cfg &_cfg) |
Cfg & | operator= (Cfg &&_cfg) |
Cfg & | operator+= (const Cfg &_cfg) |
Cfg & | operator-= (const Cfg &_cfg) |
Cfg & | operator*= (const Cfg &_cfg) |
Cfg & | operator/= (const Cfg &_cfg) |
Cfg & | operator*= (const double _d) |
Cfg & | operator/= (const double _d) |
Arithmetic | |
Cfg | operator- () const |
Find the negative of the configuration. More... | |
Cfg | operator+ (const Cfg &_cfg) const |
Cfg | operator- (const Cfg &_cfg) const |
Cfg | operator* (const Cfg &_cfg) const |
Cfg | operator/ (const Cfg &_cfg) const |
Cfg | operator* (const double _d) const |
Cfg | operator/ (const double _d) const |
Equality | |
bool | operator== (const Cfg &_cfg) const |
bool | operator!= (const Cfg &_cfg) const |
bool | WithinResolution (const Cfg &_cfg, const double _posRes, const double _oriRes) const |
Comparison | |
bool | operator< (const Cfg &_cfg) const |
Robot Info | |
Robot * | GetRobot () const noexcept |
void | SetRobot (Robot *const _r) noexcept |
MultiBody * | GetMultiBody () const noexcept |
size_t | DOF () const noexcept |
size_t | PosDOF () const noexcept |
size_t | OriDOF () const noexcept |
size_t | JointDOF () const noexcept |
bool | IsNonholonomic () const noexcept |
Is the robot nonholonomic? More... | |
DOF Accessors | |
double & | operator[] (const size_t _dof) noexcept |
double | operator[] (const size_t _dof) const noexcept |
const std::vector< double > & | GetData () const noexcept |
double & | Velocity (const size_t _dof) noexcept |
double | Velocity (const size_t _dof) const noexcept |
const std::vector< double > & | GetVelocity () const noexcept |
virtual void | SetData (const std::vector< double > &_data) |
virtual void | SetData (std::vector< double > &&_data) |
void | SetJointData (const std::vector< double > &_data) |
Point3d | GetPoint () const noexcept |
Get the robot's reference point. More... | |
virtual std::vector< double > | GetPosition () const |
Get a vector of the robot's positional DOFs. More... | |
virtual std::vector< double > | GetRotation () const |
Get a vector of the robot's rotational DOFs. More... | |
virtual std::vector< double > | GetJoints () const |
Get a vector of the robot's joint DOFs. More... | |
virtual std::vector< double > | GetNonJoints () const |
Get a vector of the robot's non-joint DOFs. More... | |
virtual std::vector< double > | GetOrientation () const |
Get a vector of the robot's orientational DOFs. More... | |
virtual double | Magnitude () const |
Get the magnitude of the robot's DOF vector. More... | |
virtual double | PositionMagnitude () const |
Get the magnitude of the robot's positional DOF vector. More... | |
virtual double | OrientationMagnitude () const |
Get the magnitude of the robot's orientational DOF vector. More... | |
mathtool::Vector3d | GetLinearPosition () const |
Get the position in R^3. More... | |
mathtool::Vector3d | GetAngularPosition () const |
Get the euler vector rotation. More... | |
mathtool::EulerAngle | GetEulerAngle () const |
Get the euler angle rotation. More... | |
mathtool::Vector3d | GetLinearVelocity () const |
Get the position velocity in R^3. More... | |
mathtool::Vector3d | GetAngularVelocity () const |
Get the rotation velocity in R^3. More... | |
mathtool::Transformation | GetBaseTransformation () const |
Get the world transformation of the robot's base. More... | |
void | SetLinearPosition (const mathtool::Vector3d &) |
Sets the robot's linear position. More... | |
void | SetAngularPosition (const mathtool::Vector3d &) |
Sets the robot's angular position. More... | |
void | SetEulerAngle (const mathtool::EulerAngle &) |
Sets the robot's euler angle. More... | |
void | SetLinearVelocity (const mathtool::Vector3d &) |
Sets the robot's linear velocity. More... | |
void | SetAngularVelocity (const mathtool::Vector3d &) |
Sets the robot's angular velocity. More... | |
void | SetBaseTransformation (const mathtool::Transformation &) |
Sets the robot's base tranformation. More... | |
void | TransformCfg (const mathtool::Transformation &) |
Transforms the cfg about a new frame of reference. More... | |
Labels and Stats | |
Each Cfg has a set of labels and stats. Label are boolean attributes, while stats are real-valued. | |
bool | GetLabel (const std::string &_label) const |
Get the robot's label for the given string identifier. More... | |
bool | IsLabel (const std::string &_label) const noexcept |
Does the robot have a given string label? More... | |
void | SetLabel (const std::string &_label, const bool _value) noexcept |
Set the robot's string label given the string identifier. More... | |
double | GetStat (const std::string &_stat) const |
Get a statistic given a string identifier. More... | |
bool | IsStat (const std::string &_stat) const noexcept |
Does the robot have a statistic given a string identifier? More... | |
void | SetStat (const std::string &_stat, const double _value=0) noexcept |
Set a statistic given a string identifier. More... | |
void | IncrementStat (const std::string &_stat, const double _value=1) noexcept |
Increment a statistic given a string identifier. More... | |
Generation Methods | |
void | Zero () noexcept |
Set all DOFs to zero. More... | |
bool | InBounds (const Boundary *const _b) const noexcept |
bool | InBounds (const Environment *const _env) const noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
virtual void | GetRandomCfg (const Boundary *const _b) |
virtual void | GetRandomCfg (Environment *_env) |
virtual void | GetRandomVelocity () |
Randomly sample the velocity for this configuration. More... | |
template<typename DistanceMetricPointer > | |
void | GetRandomRay (const double _length, DistanceMetricPointer _dm, const bool _norm=true) |
virtual void | ConfigureRobot () const |
Configure the robot with the DOF values of this configuration. More... | |
virtual void | IncrementTowardsGoal (const Cfg &_goal, const Cfg &_increment) |
virtual void | FindIncrement (const Cfg &_start, const Cfg &_goal, const int _nTicks) |
virtual void | FindIncrement (const Cfg &_start, const Cfg &_goal, int *_nTicks, const double _positionRes, const double _orientationRes) |
virtual void | WeightedSum (const Cfg &_c1, const Cfg &_c2, const double _weight=.5) |
virtual void | GetPositionOrientationFrom2Cfg (const Cfg &_pos, const Cfg &_ori) |
C-Space Directions | |
std::vector< double > | DirectionInLocalFrame (const Cfg &_target) const |
Helpers | |
void | EnableNormalization () const |
Enable the normalization of orientation DOFs. More... | |
void | DisableNormalization () const |
Disable the normalization of orientation DOFs. More... | |
virtual void | NormalizeOrientation (const int _index=-1) noexcept |
void | EnforceVelocityLimits () noexcept |
Ensure that this Cfg respects the robot's velocity limits. More... | |
Data Fields | |
Internal State with poor encapsulation | |
@TODO Fix encapsulation issues. @TODO Witness should not be a shared_ptr. | |
CDInfo | m_clearanceInfo |
std::shared_ptr< Cfg > | m_witnessCfg |
Protected Attributes | |
Internal State | |
std::vector< double > | m_dofs |
The DOF values. More... | |
std::vector< double > | m_vel |
The velocities, if any. More... | |
Robot * | m_robot {nullptr} |
The robot this cfg refers to. More... | |
std::map< std::string, bool > | m_labelMap |
A map of labels for this cfg. More... | |
std::map< std::string, double > | m_statMap |
A map of stats for this cfg. More... | |
double(* | m_normalizer )(const double &) |
The function to use for normalizing orientation DOFs. More... | |
I/O | |
static Robot * | inputRobot = nullptr |
virtual void | Read (std::istream &_is) |
virtual void | Write (std::ostream &_os) const |
std::string | PrettyPrint (const size_t _precision=4) const |
std::string | ToString () const |
A point in configuration space.
Each instance holds an array of values representing all the degrees of freedom of a robot. Translational DOFs represent the position of a reference point on the robot relative to the world origin. Angular and joint DOFs are normalized to the range [-1, 1), so this object can only reliably represent points in @cspace and not directions.
|
explicit |
Construct a configuration for Cfg::inputRobot.
This constructor is provided for two cases: allocating storage for Cfgs without knowing the robot in advance, and reading in roadmaps. The robot pointer will be Cfg::inputRobot, which can be thought of as a variable default for the Cfg(Robot* const) constructor.
|
explicit |
Construct a configuration for a given robot.
_robot | The robot this represents. |
|
explicit |
Construct a configuration for a given robot at a specified point in workspace.
_v | The workspace location of the robot's reference point. |
_robot | The robot to represent. |
Cfg::Cfg | ( | const Cfg & | _other | ) |
Construct a copy of a configuration.
_other | The configuration to copy. |
Cfg::Cfg | ( | Cfg && | _other | ) |
Construct a copy of a configuration.
_other | The configuration to copy. |
|
virtualdefault |
|
virtual |
Configure the robot with the DOF values of this configuration.
std::vector< double > Cfg::DirectionInLocalFrame | ( | const Cfg & | _target | ) | const |
Find a c-space direction to another configuration in the local (base body) frame of this Cfg. The rotational component will be in Euler Vector representation since Euler Angles do not really live in the local or global frame.
_target | The target configuration. |
void Cfg::DisableNormalization | ( | ) | const |
Disable the normalization of orientation DOFs.
|
noexcept |
Get the robot's DOF count.
void Cfg::EnableNormalization | ( | ) | const |
Enable the normalization of orientation DOFs.
|
noexcept |
Ensure that this Cfg respects the robot's velocity limits.
Find the c-space increment that moves from a start to a goal in a fixed number of steps.
_start | The start configuration. |
_goal | The goal configuration. |
_nTicks | The number of steps to take. |
|
virtual |
Find the c-space increment and number of steps needed to move from a start to a goal, taking steps no larger than the designated resolutions.
_start | The start configuration. |
_goal | The goal configuration. |
_nTicks | The number of steps to take (computed by this method). |
_positionRes | The position resolution to use. |
_orientationRes | The orientation resolution to use. |
Vector3d Cfg::GetAngularPosition | ( | ) | const |
Get the euler vector rotation.
Vector3d Cfg::GetAngularVelocity | ( | ) | const |
Get the rotation velocity in R^3.
Transformation Cfg::GetBaseTransformation | ( | ) | const |
Get the world transformation of the robot's base.
|
noexcept |
Get the data for all DOFs.
EulerAngle Cfg::GetEulerAngle | ( | ) | const |
Get the euler angle rotation.
|
virtual |
Get a vector of the robot's joint DOFs.
bool Cfg::GetLabel | ( | const std::string & | _label | ) | const |
Get the robot's label for the given string identifier.
Vector3d Cfg::GetLinearPosition | ( | ) | const |
Get the position in R^3.
Vector3d Cfg::GetLinearVelocity | ( | ) | const |
Get the position velocity in R^3.
|
noexcept |
Get the robot's multibody.
|
virtual |
Get a vector of the robot's non-joint DOFs.
|
virtual |
Get a vector of the robot's orientational DOFs.
|
noexcept |
Get the robot's reference point.
|
virtual |
Get a vector of the robot's positional DOFs.
Extract the position and orientation for this configuration from two other configurations.
_pos | Copy the position from this configuration. |
_ori | Copy the orientation from this configuration. |
|
virtual |
Create a configuration where workspace robot's EVERY VERTEX is guaranteed to lie within the specified boundary. If a cfg can't be found, the program will abort. The function will try a predefined number of times.
_b | The given boundary. |
|
virtual |
Create a configuration within the given environment.
_env | The given environment. |
void Cfg::GetRandomRay | ( | const double | _length, |
DistanceMetricPointer | _dm, | ||
const bool | _norm = true |
||
) |
Generate a random configuration with a set length.
_length | The desired length. |
_dm | The distance metric for checking length. |
_norm | Normalize the orientation DOFs? |
|
virtual |
Randomly sample the velocity for this configuration.
|
noexcept |
Get the robot corresponding to this configuration.
|
virtual |
Get a vector of the robot's rotational DOFs.
double Cfg::GetStat | ( | const std::string & | _stat | ) | const |
Get a statistic given a string identifier.
|
noexcept |
Get the velocity data for all DOFs.
|
noexcept |
Test if a configuration lies within a boundary and also within the robot's c-space limits.
_boundary | The boundary to check. |
|
noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
noexcept |
Increment a statistic given a string identifier.
Move this configuration towards a goal by adding a fixed increment.
_goal | The desired goal configuration. |
_increment | The fixed increment to add to this, moving towards goal. |
|
noexcept |
Does the robot have a given string label?
|
noexcept |
Is the robot nonholonomic?
|
noexcept |
Does the robot have a statistic given a string identifier?
|
noexcept |
Get the robot's joint DOF count.
|
virtual |
Get the magnitude of the robot's DOF vector.
|
virtualnoexcept |
Normalize an orientation DOF to the range [-1, 1).
_index | The index of the DOF to normalize. If it is -1, all orientation DOFs will be normalized. |
bool Cfg::operator!= | ( | const Cfg & | _cfg | ) | const |
Check if the current and given configurations are unequal.
_cfg | The given configuration. |
Find the product of the current and a given configuration, by each degree of freedom.
_cfg | The configuration used to multiply the current. |
Cfg Cfg::operator* | ( | const double | _d | ) | const |
Find the configuration obtained by multiplying the current by a scalar.
_d | The scalar used to multiply the current. |
Multiply the current configuration by a given configuration, by each degree of freedom
_cfg | The configuration to multiply the current. |
Cfg & Cfg::operator*= | ( | const double | _d | ) |
Multiply the current configuration by a scalar.
_d | The scalar used to multiply the current. |
Find the sum of the current and a given configuration, by each degree of freedom.
_cfg | The configuration to be added. |
Add a given configuration to the current, by each degree of freedom.
_cfg | The configuration to be added. |
Cfg Cfg::operator- | ( | ) | const |
Find the negative of the configuration.
Find the difference of the current and a given configuration, by each degree of freedom.
_cfg | The configuration to be subtracted. |
Subtract a given configuration from the current, by each degree of freedom.
_cfg | The configuration to be subtracted. |
@TODO For optimal runtime, comment out this condition. Assembly planning needs this case handled differently to make sure we get all dofs.
Find the quotient of the current and a given configuration, by each degree of freedom.
_cfg | The configuration used to divide the current. |
Cfg Cfg::operator/ | ( | const double | _d | ) | const |
Find the configuration obtained by dividing the current by a scalar.
_d | The scalar used to divide the current. |
Divide the current configuration by a given configuration, by each degree of freedom.
_cfg | The configuration to divide the current. |
Cfg & Cfg::operator/= | ( | const double | _d | ) |
Divide the current configuration by a scalar.
_d | The scalar used to divide the current. |
bool Cfg::operator< | ( | const Cfg & | _cfg | ) | const |
Check if the current configuration is less that the given.
_cfg | The given configuration. |
Set a configuration equal to another.
_cfg | The configuration to be set to. |
Set a configuration equal to another.
_cfg | The configuration to be set to. |
bool Cfg::operator== | ( | const Cfg & | _cfg | ) | const |
Check if the current and given configurations are equal.
_cfg | The given configuration. |
|
noexcept |
|
noexcept |
Access the data for a given DOF.
_dof | The index of the desired DOF. |
|
noexcept |
Get the robot's orientational DOF count.
|
virtual |
Get the magnitude of the robot's orientational DOF vector.
|
noexcept |
Get the robot's positional DOF count.
|
virtual |
Get the magnitude of the robot's positional DOF vector.
std::string Cfg::PrettyPrint | ( | const size_t | _precision = 4 | ) | const |
Print the Cfg's dofs and velocities with limited precision for terminal debugging.
_precision | The display precision. |
|
virtual |
Read a configuration from an input stream.
_is | The input stream to read from. |
void Cfg::SetAngularPosition | ( | const mathtool::Vector3d & | ) |
Sets the robot's angular position.
void Cfg::SetAngularVelocity | ( | const mathtool::Vector3d & | ) |
Sets the robot's angular velocity.
void Cfg::SetBaseTransformation | ( | const mathtool::Transformation & | ) |
Sets the robot's base tranformation.
|
virtual |
Set the DOF data.
_data | The vector of new DOF data. |
|
virtual |
void Cfg::SetEulerAngle | ( | const mathtool::EulerAngle & | ) |
Sets the robot's euler angle.
void Cfg::SetJointData | ( | const std::vector< double > & | _data | ) |
Set the joint DOF data. Other DOFs will remain unchanged.
_data | The vector of new DOF joint data. |
|
noexcept |
Set the robot's string label given the string identifier.
void Cfg::SetLinearPosition | ( | const mathtool::Vector3d & | ) |
Sets the robot's linear position.
void Cfg::SetLinearVelocity | ( | const mathtool::Vector3d & | ) |
Sets the robot's linear velocity.
|
noexcept |
Set the robot corresponding to this configuration.
_r | The desired new robot. |
|
noexcept |
Set a statistic given a string identifier.
std::string Cfg::ToString | ( | ) | const |
void Cfg::TransformCfg | ( | const mathtool::Transformation & | ) |
Transforms the cfg about a new frame of reference.
|
noexcept |
|
noexcept |
Access the velocity data for a given DOF.
_dof | The index of the desired DOF. |
Create a configuration from the weighted sum of two other cfgs.
_c1 | The first configuration. |
_c2 | The second configuration. |
_weight | The weight for the second configuration. The first will have (1 - _weight). |
bool Cfg::WithinResolution | ( | const Cfg & | _cfg, |
const double | _posRes, | ||
const double | _oriRes | ||
) | const |
Check if the current and given configurations are equal. within a given set of resolutions.
_cfg | The given configuration. |
_posRes | The resolution for positional degrees of freedom. |
_oriRes | The resolution for orientational degrees of freedom. |
@TODO comment this out if speed is important, the assembly planning stuff needs to have composite bodies analyzed differently for now though.
|
virtual |
Write a configuration to an output stream.
_os | The output stream to write to. |
|
noexcept |
Set all DOFs to zero.
|
static |
@TODO This is needed because we use stapl's graph reading function, which does not allow us to set the robot pointers on construction. Devise a better scheme for doing this that does not involve static data.
CDInfo Cfg::m_clearanceInfo |
|
protected |
The DOF values.
|
protected |
A map of labels for this cfg.
|
inlinemutableprotected |
The function to use for normalizing orientation DOFs.
|
protected |
The robot this cfg refers to.
|
protected |
A map of stats for this cfg.
|
protected |
The velocities, if any.
std::shared_ptr<Cfg> Cfg::m_witnessCfg |