BipedalLocomotion::Planners::UnicycleTrajectoryPlanner class final

UnicycleTrajectoryPlanner is a class that uses UnicycleGenerator of https://github.com/robotology/unicycle-footstep-planner) to generate reference trajectories for humanoid robots.

Every time the advance() function is called, the planner generates a new trajectory, which spans the time horizon configured by the user. The getOutput() member function returns the generated trajectory, which includes the CoM, DCM, and footstep ones. The planner requires the user to set the robot model using the setRobotModel() member function, before invoking the initialize() member function, which configures the planner. As input, which is set using the setInput() member function, the planner requires an instance of the UnicycleTrajectoryPlannerInput struct.

Base classes

template<class _Input, class _Output>
class BipedalLocomotion::System::Advanceable<UnicycleTrajectoryPlannerInput, UnicycleTrajectoryPlannerOutput>
Basic class that represents a discrete system.

Constructors, destructors, conversion operators

UnicycleTrajectoryPlanner()
~UnicycleTrajectoryPlanner() virtual

Public functions

auto setRobotContactFrames(const iDynTree::Model& model) -> bool
Set the robot contact frames.
auto getRightContactFrameIndex() const -> int
Get the index of the right foot contact frame.
auto getLeftContactFrameIndex() const -> int
Get the index of the left foot contact frame.
auto initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) -> bool override
Initialize the planner.
auto getOutput() const -> const UnicycleTrajectoryPlannerOutput& override
Get the output of the planner.
auto isOutputValid() const -> bool override
Check if the output is valid.
auto setInput(const UnicycleTrajectoryPlannerInput& input) -> bool override
Set the input of the planner.
auto advance() -> bool override
Advance the planner.
auto getContactPhaseList() -> Contacts::ContactPhaseList
Get the contact phase list.
auto getMinStepDuration() const -> std::chrono::nanoseconds
Get the minimum time duration of a step.

Function documentation

bool BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::setRobotContactFrames(const iDynTree::Model& model)

Set the robot contact frames.

Parameters
model iDynTree::Model of the robot considered.

It should be called after the initialize() function. It checks if the contact frames names parsed by the initialize() function exist. If yes, it sets the related contact frames indexes and returns true. Otherwise, it sets the Impl::FSM::State back to NotInitialized and returns false.

int BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::getRightContactFrameIndex() const

Get the index of the right foot contact frame.

Returns The index of the right foot contact frame.

int BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::getLeftContactFrameIndex() const

Get the index of the left foot contact frame.

Returns The index of the left foot contact frame.

bool BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) override

Initialize the planner.

Parameters
handler Pointer to the parameter handler.
Returns True in case of success, false otherwise.
NameTypeDefaultExampleDescription
referencePositionlist of 2 doubles-(0.1 0.0)The reference position of the unicycle controller
controlTypestring"direct"-The control mode used by the unicycle controller
unicycleGaindouble10.0-The main gain of the unicycle controller
slowWhenTurningGaindouble2.0-The turning gain of the unicycle controller
slowWhenBackwardFactordouble0.4-The backward gain of the unicycle controller
slowWhenSidewaysFactordouble0.2-The sideways gain of the unicycle controller
dtdouble0.002-The sampling time of the planner
plannerHorizondouble20.0-The planner time horizon
positionWeightdouble1.0-The position weight of the OC problem
timeWeightdouble2.5-The time weight of the OC problem
maxStepLengthdouble0.32-The maximum length of a step
minStepLengthdouble0.01-The minimum length of a step
maxLengthBackwardFactordouble0.8-The factor of maximum backward walk
nominalWidthdouble0.20-The nominal feet distance
minWidthdouble0.14-The minimum feet distance
minStepDurationdouble0.65-The minimum duration of a step
maxStepDurationdouble1.5-The maximum duration of a step
nominalDurationdouble0.8-The nominal duration of a step
maxAngleVariationdouble18.0-The maximum unicycle rotation
minAngleVariationdouble5.0-The minimum unicycle rotation
saturationFactorslist of 2 doubles-(0.7 0.7)Linear and Angular velocity conservative factors
leftYawDeltaInDegdouble0.0-Offset for the left foot rotation around the z axis
rightYawDeltaInDegdouble0.0-Offset for the right foot rotation around the z axis
swingLeftboolfalse-Perform the first step with the left foot
startAlwaysSameFootboolfalse-Restart with the default foot if still
terminalStepbooltrue-Add a terminal step at the end of the horizon
mergePointRatioslist of 2 doubles-(0.4 0.4)The ratios of the DS phase in which it is present a merge point
switchOverSwingRatiodouble0.2-The ratio between single and double support phases
lastStepSwitchTimedouble0.3-Time duration of double support phase in final step
isPauseActivebooltrue-If true, the planner can pause, instead of make tiny steps.
comHeightdouble0.70-CoM height in double support phase
comHeightDeltadouble0.01-Delta to add to CoM heinght in Single support phases
leftZMPDeltalist of 2 doubles-(0.0 0.0)Local ZMP reference: delta wrt center frame of the foot
rightZMPDeltalist of 2 doubles-(0.0 0.0)Local ZMP reference: delta wrt center frame of the foot
lastStepDCMOffsetdouble0.5-Last Step DCM Offset. If 0, DCM coincides with stance foot ZMP
leftContactFrameNamestring-"l_sole"Name of the left foot contact frame
rightContactFrameNamestring-"r_sole"Name of the right foot contact frame

const UnicycleTrajectoryPlannerOutput& BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::getOutput() const override

Get the output of the planner.

Returns The output of the planner.

bool BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::isOutputValid() const override

Check if the output is valid.

Returns True if the output is valid, false otherwise.

bool BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::setInput(const UnicycleTrajectoryPlannerInput& input) override

Set the input of the planner.

Parameters
input Input of the planner.
Returns True in case of success, false otherwise.

bool BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::advance() override

Advance the planner.

Returns True in case of success, false otherwise.

Contacts::ContactPhaseList BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::getContactPhaseList()

Get the contact phase list.

Returns The contact phase list.

It returns the contact phase list built with the footsteps generated by the planner.

std::chrono::nanoseconds BipedalLocomotion::Planners::UnicycleTrajectoryPlanner::getMinStepDuration() const

Get the minimum time duration of a step.

Returns minimum time duration of a step.