robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
robotoc::ContactSequence Class Reference

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...
 
ContactSequenceoperator= (const ContactSequence &)=default
 Default copy assign operator. More...
 
 ContactSequence (ContactSequence &&) noexcept=default
 Default move constructor. More...
 
ContactSequenceoperator= (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 ContactStatuscontactStatus (const int contact_phase) const
 Gets the contact status. More...
 
const ImpactStatusimpactStatus (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)
 

Detailed Description

The sequence of contact status and discrete events (impact and lift).

Constructor & Destructor Documentation

◆ ContactSequence() [1/4]

robotoc::ContactSequence::ContactSequence ( const Robot robot,
const int  reserved_num_discrete_events = 0 
)

Constructor.

Parameters
[in]robotRobot model.
[in]reserved_num_discrete_eventsReserved number of each discrete events (impact and lift) to avoid dynamic memory allocation. Must be non-negative. Default is 0.

◆ ContactSequence() [2/4]

robotoc::ContactSequence::ContactSequence ( )

Default constructor.

◆ ~ContactSequence()

robotoc::ContactSequence::~ContactSequence ( )
default

Default destructor.

◆ ContactSequence() [3/4]

robotoc::ContactSequence::ContactSequence ( const ContactSequence )
default

Default copy constructor.

◆ ContactSequence() [4/4]

robotoc::ContactSequence::ContactSequence ( ContactSequence &&  )
defaultnoexcept

Default move constructor.

Member Function Documentation

◆ contactStatus()

const ContactStatus & robotoc::ContactSequence::contactStatus ( const int  contact_phase) const
inline

Gets the contact status.

Parameters
[in]contact_phaseIndex of contact status phase.
Returns
const reference to the contact status.

◆ disp()

void robotoc::ContactSequence::disp ( std::ostream &  os) const

Displays the contact sequence onto a ostream.

◆ eventTimes()

const std::deque< double > & robotoc::ContactSequence::eventTimes ( ) const
inline

Returns the event times of each event.

Returns
const reference to the event times.

◆ eventType()

DiscreteEventType robotoc::ContactSequence::eventType ( const int  event_index) const
inline

Returns the event type of the specified discrete event.

Parameters
[in]event_indexIndex of the discrete event. Must be less than ContactSequence::numDiscreteEvents().
Returns
The event type of the specified discrete event.

◆ impactStatus()

const ImpactStatus & robotoc::ContactSequence::impactStatus ( const int  impact_index) const
inline

Gets the impact status.

Parameters
[in]impact_indexIndex of impact event.
Returns
const reference to the impact status.

◆ impactTime()

double robotoc::ContactSequence::impactTime ( const int  impact_index) const
inline

Returns impact event time.

Returns
Impact event time.

◆ init()

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.

Parameters
[in]contact_statusContact status.

◆ isEventTimeConsistent()

bool robotoc::ContactSequence::isEventTimeConsistent ( ) const

Checks wheather the event times are consistent.

Returns
true if there is no problem. false if not.

◆ isSTOEnabledImpact()

bool robotoc::ContactSequence::isSTOEnabledImpact ( const int  impact_index) const

Checks wheather the STO is enabled for the specified impact event.

Parameters
[in]impact_indexIndex of the impact of interest.
Returns
true if the STO is enabled. false if not.

◆ isSTOEnabledLift()

bool robotoc::ContactSequence::isSTOEnabledLift ( const int  lift_index) const

Checks wheather the STO is enabled for the specified lift event.

Parameters
[in]lift_indexIndex of the lift of interest.
Returns
true if the STO is enabled. false if not.

◆ liftTime()

double robotoc::ContactSequence::liftTime ( const int  lift_index) const
inline

Returns lift event time.

Returns
Lift event time.

◆ numContactPhases()

int robotoc::ContactSequence::numContactPhases ( ) const
inline

Returns number of contact phases.

Returns
Number of contact phases.

◆ numDiscreteEvents()

int robotoc::ContactSequence::numDiscreteEvents ( ) const
inline

Returns number of discrete events, i.e., sum of numImpactEvents() and numLiftEvents().

Returns
Number of discrete events.

◆ numImpactEvents()

int robotoc::ContactSequence::numImpactEvents ( ) const
inline

Returns number of impact events.

Returns
Number of impact events.

◆ numLiftEvents()

int robotoc::ContactSequence::numLiftEvents ( ) const
inline

Returns number of lift events.

Returns
Number of lift events.

◆ operator=() [1/2]

ContactSequence & robotoc::ContactSequence::operator= ( const ContactSequence )
default

Default copy assign operator.

◆ operator=() [2/2]

ContactSequence & robotoc::ContactSequence::operator= ( ContactSequence &&  )
defaultnoexcept

Default move assign operator.

◆ pop_back()

void robotoc::ContactSequence::pop_back ( )

Pop back the discrete event. Contact status after discrete event is also removed.

◆ pop_front()

void robotoc::ContactSequence::pop_front ( )

Pop front the discrete event. Contact status before the front discrete event is also removed.

◆ push_back() [1/2]

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.

Parameters
[in]contact_statusContact status.
[in]switching_timeTime of the switch of the last contact status of this contact sequence and the input contact status.
[in]stoif true, the switching time optimization (STO) is enabled for this discrete event. if false, it is disabled. Default is false.
Note
If switching_time is larger than the terminal time of the optimal control problem (t+T), then the discrete event and the contact status after the discrete event is not considered in the optimization problem.

◆ push_back() [2/2]

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.

Parameters
[in]discrete_eventDiscrete event.
[in]event_timeTime of the discrete event.
[in]stoif true, the switching time optimization (STO) is enabled for this discrete event. if false, it is disabled. Default is false.
Note
If event_time is larger than the terminal time of the optimal control problem (t+T), then the discrete event and the contact status after the discrete event is not considered in the optimization problem.

◆ reserve()

void robotoc::ContactSequence::reserve ( const int  reserved_num_discrete_events)

Reserves each discrete events (impact and lift) to avoid dynamic memory allocation.

Parameters
[in]reserved_num_discrete_eventsThe reserved size.

◆ reservedNumDiscreteEvents()

int robotoc::ContactSequence::reservedNumDiscreteEvents ( ) const

Returns reserved size of container of each discrete events.

◆ setContactPlacements() [1/3]

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.

Parameters
[in]contact_phaseContact phase.
[in]contact_placementsContact placements.

◆ setContactPlacements() [2/3]

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.

Parameters
[in]contact_phaseContact phase.
[in]contact_positionsContact positions.

◆ setContactPlacements() [3/3]

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.

Parameters
[in]contact_phaseContact phase.
[in]contact_positionsContact positions.
[in]contact_rotationsContact rotations.

◆ setFrictionCoefficients()

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.

Parameters
[in]contact_phaseContact phase.
[in]friction_coefficientsFriction coefficients.

◆ setImpactTime()

void robotoc::ContactSequence::setImpactTime ( const int  impact_index,
const double  impact_time 
)

Sets the time of the impact event.

Parameters
[in]impact_indexIndex of the impact event. Must be non-negative and less than numImpactEvents().
[in]impact_timeImpact time.

◆ setLiftTime()

void robotoc::ContactSequence::setLiftTime ( const int  lift_index,
const double  lift_time 
)

Sets the time of the lift event.

Parameters
[in]lift_indexIndex of the lift event. Must be non-negative and less than numLiftEvents().
[in]lift_timeLift time.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  os,
const ContactSequence contact_sequence 
)
friend

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  os,
const std::shared_ptr< ContactSequence > &  contact_sequence 
)
friend

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