ocra-wbi-plugins
Doxygen documentation for the ocra-wbi-plugins repository
SteppingDemoClient Class Reference

#include <SteppingDemoClient.h>

Collaboration diagram for SteppingDemoClient:
[legend]

List of all members.

Public Member Functions

 SteppingDemoClient (std::shared_ptr< ocra::Model > modelPtr, const int loopPeriod)
virtual ~SteppingDemoClient ()

Public Attributes

MOTION_TYPE motionType

Protected Member Functions

virtual bool initialize ()
virtual void release ()
virtual void loop ()

Private Member Functions

void staticWalkingLoop ()
void leftToRightLoop ()
Eigen::Vector3d getLeftFootPosition ()
Eigen::Vector3d getRightFootPosition ()
Eigen::Vector3d getCoMPosition ()
void positionCoMOver (COM_SUPPORT_POSITION newSupportPos)
bool isBalanced ()
void deactivateFootContacts (FOOT_CONTACTS foot)
void activateFootContacts (FOOT_CONTACTS foot)
bool isFootInContact (FOOT_CONTACTS foot)
void pauseFor (double _pauseDuration)
bool pauseFinished ()
bool liftFoot (FOOT_CONTACTS foot, bool isLeftFootInContact, bool isRightFootInContact)
bool setDownFoot (FOOT_CONTACTS foot)
void stateMachineWithPauseInDoubleSupport ()
void stateMachineWithoutPauseInDoubleSupport ()

Private Attributes

ocra_recipes::TaskConnection::Ptr LeftFootContact_BackLeft
ocra_recipes::TaskConnection::Ptr LeftFootContact_FrontLeft
ocra_recipes::TaskConnection::Ptr LeftFootContact_BackRight
ocra_recipes::TaskConnection::Ptr LeftFootContact_FrontRight
ocra_recipes::TaskConnection::Ptr RightFootContact_BackLeft
ocra_recipes::TaskConnection::Ptr RightFootContact_FrontLeft
ocra_recipes::TaskConnection::Ptr RightFootContact_BackRight
ocra_recipes::TaskConnection::Ptr RightFootContact_FrontRight
double pauseTriggerTime
double pauseDuration
double currentTime
bool isPausing
bool isInLeftSupportMode
bool isInRightSupportMode
bool footTrajectoryStarted
std::shared_ptr
< ocra_recipes::TrajectoryThread > 
leftFoot_TrajThread
std::shared_ptr
< ocra_recipes::TrajectoryThread > 
rightFoot_TrajThread
std::shared_ptr
< ocra_recipes::TrajectoryThread > 
com_TrajThread
Eigen::Vector3d leftFootHome
Eigen::Vector3d rightFootHome
Eigen::Vector3d comHome
Eigen::Vector3d leftFootTarget
Eigen::Vector3d rightFootTarget
Eigen::Vector3d nextStep
Eigen::Vector3d newCoMGoalPosition
double startTime
bool getInitialValues
CONTROL_PHASE currentPhase
CONTROL_PHASE nextPhase
bool isMovingCoM
WalkingParams walkingParams

Constructor & Destructor Documentation

SteppingDemoClient::SteppingDemoClient ( std::shared_ptr< ocra::Model >  modelPtr,
const int  loopPeriod 
)

Member Function Documentation

This method asks the ocra-icub-server to activate one by one the feet "corner" contact tasks for the specified foot.

Parameters:
footLEFT_FOOT or RIGHT_FOOT.

Remember the right and left feet contact tasks? created in initialize(). This method acts the ocra-icub-server to deactivate one by one the feet "corner" contact tasks for the specified foot.

Parameters:
footLEFT_FOOT or RIGHT_FOOT.
Eigen::Vector3d SteppingDemoClient::getCoMPosition ( ) [private]

Retrieves the 3D position of the "CoM" as done by the yarpWholeBodyInterface.

Returns:
3D position of the COM.
Eigen::Vector3d SteppingDemoClient::getLeftFootPosition ( ) [private]

Retrieves the 3D position of the "l_sole" frame from the iCub model.

Returns:
3D position of the left foot.
Eigen::Vector3d SteppingDemoClient::getRightFootPosition ( ) [private]

Retrieves the 3D position of the "r_sole" frame from the iCub model.

Returns:
3D position of the right foot.
bool SteppingDemoClient::initialize ( ) [protected, virtual]

The initialization consists of the following: 1. Defines trajectory types (e.g. Min. Jerk) 2. Defines the termination strategy 3. Instantiates trajectory threads for the left and right foot as well as for the CoM, sets them up (max velocity, error threshold) and finally starts them. 4. Instantiates ocra::TaskConnection objects for the left and right feet contacts (4 per foot on each corner).

  • returns: True if everything has been initialized properly, false otherwise.
bool SteppingDemoClient::isBalanced ( ) [private]

Uses the norm of the COM and joint velocities to understand if the robot is balanced.

Returns:
True when both the norm of the COM and joint velocities are below comVelThreshold and jointThreshold.
Todo:
A more balance-centered criterion should be used for this, ZMP-based for example.

If the foot height is less than or equal to footContactReleaseThreshold, the feet contacts tasks are activated.

Parameters:
footLEFT_FOOT or RIGHT_FOOT.
Returns:
True if the activation of the contact happens successfully. False if the foot's elevation is not under the footContactReleaseThreshold.
bool SteppingDemoClient::liftFoot ( FOOT_CONTACTS  foot,
bool  isLeftFootInContact,
bool  isRightFootInContact 
) [private]

Sets the right or left foot waypoint to rightFootTarget or leftFootTarget accordingly (where the foot will be lifted). These values are harcoded in the loop() method and updated only during the very first iteration when the variable getInitialValues is set to true.

Parameters:
footLEFT_FOOT or RIGHT_FOOT
isLeftFootInContactUpdates the current state of the left foot contact.
isRightFootInContactUpdates the current state of the right foot contact.
Returns:
True after the foot contact is deactivated.
void SteppingDemoClient::loop ( ) [protected, virtual]

Initially waits for two seconds, to make sure that all model states have been correctly updated during the initialization. During the first loop it retrieves left and right feet positions along with the com's.

Sets isPausing to false when pauseDuration has passed.

Returns:
True when the pause duration is over. False otherwise.
void SteppingDemoClient::pauseFor ( double  _pauseDuration) [private]

Mainly sets isPausing to true and stores the time at which the pause was called.

Parameters:
_pauseDurationPause duration.
void SteppingDemoClient::positionCoMOver ( COM_SUPPORT_POSITION  newSupportPos) [private]

Sets COM trajectory waypoints according to the desired support position: LEFT_FOOT_XY: The COM goal position is set to be on top of the left foot. RIGHT_FOOT_XY: The COM goal position is set to be on top of the right foot. CENTERED_BETWEEN_FEET_XY: The COM goal position is set between both feet. The height of the com is always the current COM's height. Since the thread must have started before calling this method, it will update the current waypoint trajectory it has or start it.

Parameters:
newSupportPosNew support position.
void SteppingDemoClient::release ( ) [protected, virtual]

Stops the trajectory threads of the CoM, left and right feet.

Sets the right or left foot waypoint to rightFootHome or leftFootHome accordingly (where the foot will land). These values are harcoded in the loop() method and updated only during the very first iteration when the variable getInitialValues is set to true.

Parameters:
footLEFT_FOOT or RIGHT_FOOT
Returns:
True only after the foot has established contact again and the trajectory is over. False while the foot is still moving back down looking for contact or simply, the goal hasn't been attained.

Member Data Documentation

std::shared_ptr<ocra_recipes::TrajectoryThread> SteppingDemoClient::com_TrajThread [private]
Eigen::Vector3d SteppingDemoClient::comHome [private]
std::shared_ptr<ocra_recipes::TrajectoryThread> SteppingDemoClient::leftFoot_TrajThread [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::LeftFootContact_BackLeft [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::LeftFootContact_BackRight [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::LeftFootContact_FrontLeft [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::LeftFootContact_FrontRight [private]
Eigen::Vector3d SteppingDemoClient::leftFootHome [private]
Eigen::Vector3d SteppingDemoClient::leftFootTarget [private]
Eigen::Vector3d SteppingDemoClient::newCoMGoalPosition [private]
Eigen::Vector3d SteppingDemoClient::nextStep [private]
std::shared_ptr<ocra_recipes::TrajectoryThread> SteppingDemoClient::rightFoot_TrajThread [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::RightFootContact_BackLeft [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::RightFootContact_BackRight [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::RightFootContact_FrontLeft [private]
ocra_recipes::TaskConnection::Ptr SteppingDemoClient::RightFootContact_FrontRight [private]
Eigen::Vector3d SteppingDemoClient::rightFootHome [private]
Eigen::Vector3d SteppingDemoClient::rightFootTarget [private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines