robotoc
robotoc - efficient ROBOT Optimal Control solvers
|
The sequence of contact status and discrete events (impact and lift). More...
#include <contact_sequence.hpp>
Public Member Functions | |
ContactSequence (const Robot &robot, const int reserved_num_discrete_events=0) | |
Constructor. More... | |
ContactSequence () | |
Default constructor. More... | |
~ContactSequence ()=default | |
Default destructor. More... | |
ContactSequence (const ContactSequence &)=default | |
Default copy constructor. More... | |
ContactSequence & | operator= (const ContactSequence &)=default |
Default copy assign operator. More... | |
ContactSequence (ContactSequence &&) noexcept=default | |
Default move constructor. More... | |
ContactSequence & | operator= (ContactSequence &&) noexcept=default |
Default move assign operator. More... | |
void | init (const ContactStatus &contact_status) |
Sets the contact status over all of the time stages uniformly. Also, disable discrete events over all of the time stages. More... | |
void | push_back (const DiscreteEvent &discrete_event, const double event_time, const bool sto=false) |
Push back the discrete event. Contact status after discrete event is also appended according to discrete_event. More... | |
void | push_back (const ContactStatus &contact_status, const double switching_time, const bool sto=false) |
Push back the contact sequence. A discrete event is automatically generated by last contact status of this contact sequence and input contact_status. More... | |
void | pop_back () |
Pop back the discrete event. Contact status after discrete event is also removed. More... | |
void | pop_front () |
Pop front the discrete event. Contact status before the front discrete event is also removed. More... | |
void | setImpactTime (const int impact_index, const double impact_time) |
Sets the time of the impact event. More... | |
void | setLiftTime (const int lift_index, const double lift_time) |
Sets the time of the lift event. More... | |
bool | isSTOEnabledImpact (const int impact_index) const |
Checks wheather the STO is enabled for the specified impact event. More... | |
bool | isSTOEnabledLift (const int lift_index) const |
Checks wheather the STO is enabled for the specified lift event. More... | |
bool | isEventTimeConsistent () const |
Checks wheather the event times are consistent. More... | |
void | setContactPlacements (const int contact_phase, const std::vector< Eigen::Vector3d > &contact_positions) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. The rotations are set to Eigen::Matrix3d::Identity(). Also sets the contact placement of the discrete event just before the contact phase. More... | |
void | setContactPlacements (const int contact_phase, const std::vector< Eigen::Vector3d > &contact_positions, const std::vector< Eigen::Matrix3d > &contact_rotations) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. Also set the contact placement of the discrete event just before the contact phase. More... | |
void | setContactPlacements (const int contact_phase, const aligned_vector< SE3 > &contact_placements) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. Also set the contact placement of the discrete event just before the contact phase. More... | |
void | setFrictionCoefficients (const int contact_phase, const std::vector< double > &friction_coefficients) |
Sets the friction coefficients. Also sets the friction coefficients of the discrete event just before the contact phase. More... | |
int | numContactPhases () const |
Returns number of contact phases. More... | |
int | numDiscreteEvents () const |
Returns number of discrete events, i.e., sum of numImpactEvents() and numLiftEvents(). More... | |
int | numImpactEvents () const |
Returns number of impact events. More... | |
int | numLiftEvents () const |
Returns number of lift events. More... | |
const ContactStatus & | contactStatus (const int contact_phase) const |
Gets the contact status. More... | |
const ImpactStatus & | impactStatus (const int impact_index) const |
Gets the impact status. More... | |
double | impactTime (const int impact_index) const |
Returns impact event time. More... | |
double | liftTime (const int lift_index) const |
Returns lift event time. More... | |
DiscreteEventType | eventType (const int event_index) const |
Returns the event type of the specified discrete event. More... | |
const std::deque< double > & | eventTimes () const |
Returns the event times of each event. More... | |
void | reserve (const int reserved_num_discrete_events) |
Reserves each discrete events (impact and lift) to avoid dynamic memory allocation. More... | |
int | reservedNumDiscreteEvents () const |
Returns reserved size of container of each discrete events. More... | |
void | disp (std::ostream &os) const |
Displays the contact sequence onto a ostream. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ContactSequence &contact_sequence) |
std::ostream & | operator<< (std::ostream &os, const std::shared_ptr< ContactSequence > &contact_sequence) |
The sequence of contact status and discrete events (impact and lift).
robotoc::ContactSequence::ContactSequence | ( | const Robot & | robot, |
const int | reserved_num_discrete_events = 0 |
||
) |
Constructor.
[in] | robot | Robot model. |
[in] | reserved_num_discrete_events | Reserved number of each discrete events (impact and lift) to avoid dynamic memory allocation. Must be non-negative. Default is 0. |
robotoc::ContactSequence::ContactSequence | ( | ) |
Default constructor.
|
default |
Default destructor.
|
default |
Default copy constructor.
|
defaultnoexcept |
Default move constructor.
|
inline |
Gets the contact status.
[in] | contact_phase | Index of contact status phase. |
void robotoc::ContactSequence::disp | ( | std::ostream & | os | ) | const |
Displays the contact sequence onto a ostream.
|
inline |
Returns the event times of each event.
|
inline |
Returns the event type of the specified discrete event.
[in] | event_index | Index of the discrete event. Must be less than ContactSequence::numDiscreteEvents(). |
|
inline |
Gets the impact status.
[in] | impact_index | Index of impact event. |
|
inline |
Returns impact event time.
void robotoc::ContactSequence::init | ( | const ContactStatus & | contact_status | ) |
Sets the contact status over all of the time stages uniformly. Also, disable discrete events over all of the time stages.
[in] | contact_status | Contact status. |
bool robotoc::ContactSequence::isEventTimeConsistent | ( | ) | const |
Checks wheather the event times are consistent.
bool robotoc::ContactSequence::isSTOEnabledImpact | ( | const int | impact_index | ) | const |
Checks wheather the STO is enabled for the specified impact event.
[in] | impact_index | Index of the impact of interest. |
bool robotoc::ContactSequence::isSTOEnabledLift | ( | const int | lift_index | ) | const |
Checks wheather the STO is enabled for the specified lift event.
[in] | lift_index | Index of the lift of interest. |
|
inline |
Returns lift event time.
|
inline |
Returns number of contact phases.
|
inline |
Returns number of discrete events, i.e., sum of numImpactEvents() and numLiftEvents().
|
inline |
Returns number of impact events.
|
inline |
Returns number of lift events.
|
default |
Default copy assign operator.
|
defaultnoexcept |
Default move assign operator.
void robotoc::ContactSequence::pop_back | ( | ) |
Pop back the discrete event. Contact status after discrete event is also removed.
void robotoc::ContactSequence::pop_front | ( | ) |
Pop front the discrete event. Contact status before the front discrete event is also removed.
void robotoc::ContactSequence::push_back | ( | const ContactStatus & | contact_status, |
const double | switching_time, | ||
const bool | sto = false |
||
) |
Push back the contact sequence. A discrete event is automatically generated by last contact status of this contact sequence and input contact_status.
[in] | contact_status | Contact status. |
[in] | switching_time | Time of the switch of the last contact status of this contact sequence and the input contact status. |
[in] | sto | if true, the switching time optimization (STO) is enabled for this discrete event. if false, it is disabled. Default is false. |
void robotoc::ContactSequence::push_back | ( | const DiscreteEvent & | discrete_event, |
const double | event_time, | ||
const bool | sto = false |
||
) |
Push back the discrete event. Contact status after discrete event is also appended according to discrete_event.
[in] | discrete_event | Discrete event. |
[in] | event_time | Time of the discrete event. |
[in] | sto | if true, the switching time optimization (STO) is enabled for this discrete event. if false, it is disabled. Default is false. |
void robotoc::ContactSequence::reserve | ( | const int | reserved_num_discrete_events | ) |
Reserves each discrete events (impact and lift) to avoid dynamic memory allocation.
[in] | reserved_num_discrete_events | The reserved size. |
int robotoc::ContactSequence::reservedNumDiscreteEvents | ( | ) | const |
Returns reserved size of container of each discrete events.
void robotoc::ContactSequence::setContactPlacements | ( | const int | contact_phase, |
const aligned_vector< SE3 > & | contact_placements | ||
) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. Also set the contact placement of the discrete event just before the contact phase.
[in] | contact_phase | Contact phase. |
[in] | contact_placements | Contact placements. |
void robotoc::ContactSequence::setContactPlacements | ( | const int | contact_phase, |
const std::vector< Eigen::Vector3d > & | contact_positions | ||
) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. The rotations are set to Eigen::Matrix3d::Identity(). Also sets the contact placement of the discrete event just before the contact phase.
[in] | contact_phase | Contact phase. |
[in] | contact_positions | Contact positions. |
void robotoc::ContactSequence::setContactPlacements | ( | const int | contact_phase, |
const std::vector< Eigen::Vector3d > & | contact_positions, | ||
const std::vector< Eigen::Matrix3d > & | contact_rotations | ||
) |
Sets the contact placements (positions and rotations) to contact statsus with specified contact phase. Also set the contact placement of the discrete event just before the contact phase.
[in] | contact_phase | Contact phase. |
[in] | contact_positions | Contact positions. |
[in] | contact_rotations | Contact rotations. |
void robotoc::ContactSequence::setFrictionCoefficients | ( | const int | contact_phase, |
const std::vector< double > & | friction_coefficients | ||
) |
Sets the friction coefficients. Also sets the friction coefficients of the discrete event just before the contact phase.
[in] | contact_phase | Contact phase. |
[in] | friction_coefficients | Friction coefficients. |
void robotoc::ContactSequence::setImpactTime | ( | const int | impact_index, |
const double | impact_time | ||
) |
Sets the time of the impact event.
[in] | impact_index | Index of the impact event. Must be non-negative and less than numImpactEvents(). |
[in] | impact_time | Impact time. |
void robotoc::ContactSequence::setLiftTime | ( | const int | lift_index, |
const double | lift_time | ||
) |
Sets the time of the lift event.
[in] | lift_index | Index of the lift event. Must be non-negative and less than numLiftEvents(). |
[in] | lift_time | Lift time. |
|
friend |
|
friend |