lipm_walking::ExternalPlanner Struct Reference

Handle requesting/receiving a footstep plan from an external planner. More...

#include <lipm_walking/ExternalPlanner.h>

Public Types

enum  State {
  Standing ,
  DoubleSupport ,
  SingleSupport
}
 
using SE2d = lipm_walking::utils::SE2d
 
using Request = mc_plugin::ExternalFootstepPlanner::Request
 
using Foot = mc_plugin::ExternalFootstepPlanner::Foot
 

Public Member Functions

 ExternalPlanner (mc_control::MCController &ctl)
 
void configure (const mc_rtc::Configuration &config)
 External planning configuration. More...
 
bool planningRequested () const
 
void requestPlan (const State state, const Foot supportFoot, const utils::SE2d &start_lf, const utils::SE2d &start_rf, double allowed_time)
 Request a plan to the plugin. More...
 
void cancelRequest ()
 
bool planRequested (State state) const noexcept
 
bool hasPlan (State state) const
 
std::vector< lipm_walking::Contactplan ()
 Convert plugin's plan to lipm_walking plan format. More...
 
State state () const
 
void leftFootLandingOffset (const SE2d &offset)
 Offset between the left foot and the world target frame, expressed in world target frame. More...
 
void rightFootLandingOffset (const SE2d &offset)
 
void allowedTimeSingleSupport (const double time)
 
double allowedTimeSingleSupport () const noexcept
 
void allowedTimeStanding (const double time)
 
double allowedTimeStanding () const noexcept
 
void activate ()
 
void deactivate ()
 

Protected Member Functions

void requestPlanWorldPositionTarget (const State state, const Foot supportFoot, const utils::SE2d &start_lf, const utils::SE2d &start_rf, const utils::SE2d &targetWorld, double allowed_time)
 Request a plan with a target expressed in world frame. More...
 
void requestPlanLocalPositionTarget (const State state, const Foot supportFoot, const utils::SE2d &start_lf, const utils::SE2d &start_rf, const utils::SE2d &localTarget, double allowed_time)
 Request a plan in local frame. More...
 

Protected Attributes

mc_control::MCController & ctl_
 
State state_ = State::Standing
 
bool requested_ = false
 
double allowedTimeSingleSupport_ = 0.5
 
double allowedTimeStanding_ = 2.0
 
SE2d leftFootLandingOffset_ {0., 0.15, 0.}
 Landing offset of the feet w.r.t target frame, expressed in target frame. More...
 
SE2d rightFootLandingOffset_ {0, -0.15, 0.}
 

Detailed Description

Handle requesting/receiving a footstep plan from an external planner.

For now this is intended to be used along with the mc_plugin_footstep_plan plugin that handles the actual communication with the planner, and conversion to a FootstepPlan.

Definition at line 23 of file ExternalPlanner.h.

Member Typedef Documentation

◆ Foot

using lipm_walking::ExternalPlanner::Foot = mc_plugin::ExternalFootstepPlanner::Foot

Definition at line 27 of file ExternalPlanner.h.

◆ Request

using lipm_walking::ExternalPlanner::Request = mc_plugin::ExternalFootstepPlanner::Request

Definition at line 26 of file ExternalPlanner.h.

◆ SE2d

Member Enumeration Documentation

◆ State

Enumerator
Standing 
DoubleSupport 
SingleSupport 

Definition at line 29 of file ExternalPlanner.h.

Constructor & Destructor Documentation

◆ ExternalPlanner()

lipm_walking::ExternalPlanner::ExternalPlanner ( mc_control::MCController &  ctl)

Definition at line 14 of file ExternalPlanner.cpp.

Member Function Documentation

◆ activate()

void lipm_walking::ExternalPlanner::activate ( )
inline

Definition at line 155 of file ExternalPlanner.h.

◆ allowedTimeSingleSupport() [1/2]

double lipm_walking::ExternalPlanner::allowedTimeSingleSupport ( ) const
inlinenoexcept

Definition at line 140 of file ExternalPlanner.h.

◆ allowedTimeSingleSupport() [2/2]

void lipm_walking::ExternalPlanner::allowedTimeSingleSupport ( const double  time)
inline

Definition at line 135 of file ExternalPlanner.h.

◆ allowedTimeStanding() [1/2]

double lipm_walking::ExternalPlanner::allowedTimeStanding ( ) const
inlinenoexcept

Definition at line 150 of file ExternalPlanner.h.

◆ allowedTimeStanding() [2/2]

void lipm_walking::ExternalPlanner::allowedTimeStanding ( const double  time)
inline

Definition at line 145 of file ExternalPlanner.h.

◆ cancelRequest()

void lipm_walking::ExternalPlanner::cancelRequest ( )
inline

Definition at line 89 of file ExternalPlanner.h.

◆ configure()

void lipm_walking::ExternalPlanner::configure ( const mc_rtc::Configuration &  config)

External planning configuration.

Parameters
configConfig in the format of the "external" plan section of LIPMWalking configuration

Definition at line 16 of file ExternalPlanner.cpp.

◆ deactivate()

void lipm_walking::ExternalPlanner::deactivate ( )
inline

Definition at line 160 of file ExternalPlanner.h.

◆ hasPlan()

bool lipm_walking::ExternalPlanner::hasPlan ( State  state) const
inline

Definition at line 100 of file ExternalPlanner.h.

◆ leftFootLandingOffset()

void lipm_walking::ExternalPlanner::leftFootLandingOffset ( const SE2d offset)
inline

Offset between the left foot and the world target frame, expressed in world target frame.

Warning
It is the user's responsibility to ensure that the left-to-right foot offset results in a collision-free landing stance.
See also
rightFootLandingOffset
Parameters
offsetOffset expressed in world target frame

Definition at line 125 of file ExternalPlanner.h.

◆ plan()

std::vector< lipm_walking::Contact > lipm_walking::ExternalPlanner::plan ( )

Convert plugin's plan to lipm_walking plan format.

Returns
lipm_walking::FootstepPlan The plan to be executed

Definition at line 104 of file ExternalPlanner.cpp.

◆ planningRequested()

bool lipm_walking::ExternalPlanner::planningRequested ( ) const
inline

Definition at line 45 of file ExternalPlanner.h.

◆ planRequested()

bool lipm_walking::ExternalPlanner::planRequested ( State  state) const
inlinenoexcept

Definition at line 95 of file ExternalPlanner.h.

◆ requestPlan()

void lipm_walking::ExternalPlanner::requestPlan ( const State  state,
const Foot  supportFoot,
const utils::SE2d start_lf,
const utils::SE2d start_rf,
double  allowed_time 
)

Request a plan to the plugin.

The target is set within the ExternalFootstepPlannerPlugin (from GUI or other inputs).

Note
Since the planner usually takes time to find and send a solution, a plan typically needs to be requested with a starting configuration corresponding to a future robot state. E.g when requesting a plan during the SingleSupport phase, you'll want to request a plan with an initial Left/Right foot configuration corresponding to the (predicted) landing state in the next DoubleSupport phase. That way the planner will have time to compute the plan while the current SingleSupport phase executes (current step) and the requested plan should be available at the start of the next DoubleSupport phase
Parameters
stateWalking state for which the computed plan is intended
supportFootStarting support foot (first swing foot will be the opposite foot)
start_lfStarting configuration that the left foot will have in "state"
start_rfStarting configuration for the right foot will have in "state"
allowed_timeTime allowed for the planner to compute a solution. This should be less than the time available between when the request is made and when it is expected to be used. Example:
  • SingleSupport (0.7s), making a request at t=0.2s during the SingleSupport phase for a plan intended for the next DoubleSupport phase that is: requestPlan(DoubleSupport, <support foot for the next single support phase>, <left foot state in the next double support phase (landing state)>, <right foot state in the next double support phase (landing state)>, 0.3)
  • This means we have 0.5s available to compute until the DoubleSupport phase.
  • Accounting for communication time with the planner, allowed_time<=0.4s would be a reasonable choice. Also note that setting a time as small as possible while ensuring that the planner will find a solution is preferable as it gives more time-span available to request a new plan.

Definition at line 34 of file ExternalPlanner.cpp.

◆ requestPlanLocalPositionTarget()

void lipm_walking::ExternalPlanner::requestPlanLocalPositionTarget ( const State  state,
const Foot  supportFoot,
const utils::SE2d start_lf,
const utils::SE2d start_rf,
const utils::SE2d localTarget,
double  allowed_time 
)
protected

Request a plan in local frame.

The local frame is defined as the frame halfway between start_lf and start_rf

See also
requestPlanWorldPositionTarget
requestPlan

Definition at line 89 of file ExternalPlanner.cpp.

◆ requestPlanWorldPositionTarget()

void lipm_walking::ExternalPlanner::requestPlanWorldPositionTarget ( const State  state,
const Foot  supportFoot,
const utils::SE2d start_lf,
const utils::SE2d start_rf,
const utils::SE2d targetWorld,
double  allowed_time 
)
protected

Request a plan with a target expressed in world frame.

See also
requestPlan

Definition at line 64 of file ExternalPlanner.cpp.

◆ rightFootLandingOffset()

void lipm_walking::ExternalPlanner::rightFootLandingOffset ( const SE2d offset)
inline

Definition at line 130 of file ExternalPlanner.h.

◆ state()

State lipm_walking::ExternalPlanner::state ( ) const
inline

Definition at line 112 of file ExternalPlanner.h.

Member Data Documentation

◆ allowedTimeSingleSupport_

double lipm_walking::ExternalPlanner::allowedTimeSingleSupport_ = 0.5
protected

Definition at line 197 of file ExternalPlanner.h.

◆ allowedTimeStanding_

double lipm_walking::ExternalPlanner::allowedTimeStanding_ = 2.0
protected

Definition at line 198 of file ExternalPlanner.h.

◆ ctl_

mc_control::MCController& lipm_walking::ExternalPlanner::ctl_
protected

Definition at line 194 of file ExternalPlanner.h.

◆ leftFootLandingOffset_

SE2d lipm_walking::ExternalPlanner::leftFootLandingOffset_ {0., 0.15, 0.}
protected

Landing offset of the feet w.r.t target frame, expressed in target frame.

Warning
These default values are intended to reduce the risk of the robot stepping on itself. They must be set per-robot to a collision-free stance.

Definition at line 206 of file ExternalPlanner.h.

◆ requested_

bool lipm_walking::ExternalPlanner::requested_ = false
protected

Definition at line 196 of file ExternalPlanner.h.

◆ rightFootLandingOffset_

SE2d lipm_walking::ExternalPlanner::rightFootLandingOffset_ {0, -0.15, 0.}
protected

Definition at line 207 of file ExternalPlanner.h.

◆ state_

State lipm_walking::ExternalPlanner::state_ = State::Standing
protected

Definition at line 195 of file ExternalPlanner.h.