Quad-SDK
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
GlobalBodyPlan Class Reference

A class to contain global plan data along with helper functions. More...

#include <global_body_plan.h>

Public Member Functions

 GlobalBodyPlan ()
 Constructor for GlobalBodyPlan.
 
bool operator== (GlobalBodyPlan p1) const
 
bool isEmpty () const
 Check if this plan is empty.
 
int getStatus () const
 Get the status of this plan.
 
void setStatus (int status)
 Set the status of this plan.
 
int getSize () const
 Get the size of the plan (number of finite elements)
 
double getDuration () const
 Get the duration of the plan in seconds.
 
double getLength () const
 Get the length of the plan in meters.
 
double getLengthAtIndex (int i) const
 Get the length of the plan at a particular index in meters.
 
double getTime (int i) const
 Get the time of the plan at a particular index in seconds.
 
FullState getStateFromIndex (int i) const
 Get a particular state from the plan.
 
int getPrimitiveFromIndex (int i) const
 Get the motion primitive from the plan.
 
double getGoalDistance () const
 Get the distance of the plan end to the goal (retrieves member variable, does not compute)
 
void setComputedTimestamp (ros::Time timestamp)
 Set the timestamp at which this plan was computed (must be unique)
 
ros::Time getComputedTimestamp () const
 Get the timestamp at which this plan was computed.
 
double setPublishedTimestamp (ros::Time timestamp)
 Set the timestamp at which this plan was published.
 
ros::Time getPublishedTimestamp () const
 Get the timestamp at which this plan was published.
 
void clear ()
 Reset the plan (clear all data, update data to unsolved)
 
void invalidate ()
 Invalidate the plan so next will be accepted (set length to infinite and status to unsolved)
 
void eraseAfterIndex (int start_index)
 Clear the plan after a particular index (used for replanning segments)
 
void loadPlanData (int plan_status, FullState &start_state, double dist_to_goal, std::vector< State > &state_sequence, std::vector< Action > &action_sequence, double dt, double t0, const PlannerConfig &planner_config)
 Load the interpolated plan data and metadata.
 
void addStateAndGRFToMsg (double t, int plan_index, const FullState &body_state, const GRF &grf, int primitive_id, quad_msgs::RobotPlan &msg)
 Load a semgent of interpolated plan data into a plan message.
 
void convertToMsg (quad_msgs::RobotPlan &robot_plan_msg, quad_msgs::RobotPlan &discrete_robot_plan_msg)
 Load the entire plan into a plan message.
 

Private Attributes

ros::Time computed_timestamp_
 Time stamp for when plan was computed (unique)
 
ros::Time published_timestamp_
 Time stamp for when plan was published (not unique)
 
std::vector< double > t_plan_
 Std vector containing the interpolated time data.
 
std::vector< FullStatebody_plan_
 Std vector containing the interpolated robot body plan.
 
std::vector< GRF > grf_plan_
 Std vector containing the interpolated wrench plan.
 
std::vector< int > primitive_id_plan_
 Std vector containing the interpolated time data.
 
std::vector< double > length_plan_
 Std vector containing the cumulative path length at each index of the plan.
 
std::vector< Statestate_sequence_
 Sequence of discrete states in the plan.
 
std::vector< Actionaction_sequence_
 Sequence of discrete actions in the plan.
 
int plan_status_
 Plan status.
 
double goal_distance_
 Distance to goal.
 

Detailed Description

A class to contain global plan data along with helper functions.

This class inherits GraphClass, and adds method to add random states to the graph and search for neighbors. These functions are useful for sample-based planners such as RRTs or PRMs.

Constructor & Destructor Documentation

◆ GlobalBodyPlan()

GlobalBodyPlan::GlobalBodyPlan ( )

Constructor for GlobalBodyPlan.

Returns
Constructed object of type GlobalBodyPlan

Member Function Documentation

◆ addStateAndGRFToMsg()

void GlobalBodyPlan::addStateAndGRFToMsg ( double  t,
int  plan_index,
const FullState body_state,
const GRF &  grf,
int  primitive_id,
quad_msgs::RobotPlan &  msg 
)

Load a semgent of interpolated plan data into a plan message.

Parameters
[in]tTime at which this data occurs
[in]plan_indexIndex in the plan for which this data will be inserted
[in]body_stateBody state data
[in]grfGRF data
[out]msgRobot plan message with data added

◆ convertToMsg()

void GlobalBodyPlan::convertToMsg ( quad_msgs::RobotPlan &  robot_plan_msg,
quad_msgs::RobotPlan &  discrete_robot_plan_msg 
)

Load the entire plan into a plan message.

Parameters
[out]robot_plan_msgInterpolated robot plan message
[out]discrete_robot_plan_msgDiscrete robot plan message

◆ eraseAfterIndex()

void GlobalBodyPlan::eraseAfterIndex ( int  start_index)

Clear the plan after a particular index (used for replanning segments)

Parameters
[in]start_indexIndex which will start new plan (all higher indices cleared)

◆ getComputedTimestamp()

ros::Time GlobalBodyPlan::getComputedTimestamp ( ) const
inline

Get the timestamp at which this plan was computed.

Returns
Timestamp at which the plan returned

◆ getDuration()

double GlobalBodyPlan::getDuration ( ) const
inline

Get the duration of the plan in seconds.

Returns
Plan duration

◆ getGoalDistance()

double GlobalBodyPlan::getGoalDistance ( ) const
inline

Get the distance of the plan end to the goal (retrieves member variable, does not compute)

Returns
Distance from end of plan to goal

◆ getLength()

double GlobalBodyPlan::getLength ( ) const
inline

Get the length of the plan in meters.

Returns
Plan length

◆ getLengthAtIndex()

double GlobalBodyPlan::getLengthAtIndex ( int  i) const
inline

Get the length of the plan at a particular index in meters.

Returns
Plan length at index

◆ getPrimitiveFromIndex()

int GlobalBodyPlan::getPrimitiveFromIndex ( int  i) const
inline

Get the motion primitive from the plan.

Returns
Primitive at index i

◆ getPublishedTimestamp()

ros::Time GlobalBodyPlan::getPublishedTimestamp ( ) const
inline

Get the timestamp at which this plan was published.

Returns
Timestamp at which the plan was published

◆ getSize()

int GlobalBodyPlan::getSize ( ) const
inline

Get the size of the plan (number of finite elements)

Returns
Plan size

◆ getStateFromIndex()

FullState GlobalBodyPlan::getStateFromIndex ( int  i) const
inline

Get a particular state from the plan.

Returns
State at index i

◆ getStatus()

int GlobalBodyPlan::getStatus ( ) const
inline

Get the status of this plan.

Returns
Plan status ID

◆ getTime()

double GlobalBodyPlan::getTime ( int  i) const
inline

Get the time of the plan at a particular index in seconds.

Returns
Plan time at index

◆ isEmpty()

bool GlobalBodyPlan::isEmpty ( ) const
inline

Check if this plan is empty.

Returns
Plan emptiness

◆ loadPlanData()

void GlobalBodyPlan::loadPlanData ( int  plan_status,
FullState start_state,
double  dist_to_goal,
std::vector< State > &  state_sequence,
std::vector< Action > &  action_sequence,
double  dt,
double  t0,
const PlannerConfig planner_config 
)

Load the interpolated plan data and metadata.

Parameters
[in]plan_statusStatus of this particular plan
[in]start_stateState at which this plan begins
[in]dist_to_goalDistance to goal from plan end
[in]state_sequenceDiscrete state sequence to be interpolated
[in]action_sequenceDiscrete action sequence to be interpolated
[in]dtTimestep for interpolation
[in]t0Start time of this plan section
[in]planner_configPlanning configuration parameters

◆ setComputedTimestamp()

void GlobalBodyPlan::setComputedTimestamp ( ros::Time  timestamp)
inline

Set the timestamp at which this plan was computed (must be unique)

Parameters
[in]timestampTimestamp at which the plan returned

◆ setPublishedTimestamp()

double GlobalBodyPlan::setPublishedTimestamp ( ros::Time  timestamp)
inline

Set the timestamp at which this plan was published.

Parameters
[in]timestampTimestamp at which the plan was published

◆ setStatus()

void GlobalBodyPlan::setStatus ( int  status)
inline

Set the status of this plan.

Parameters
[in]statusPlan status ID

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