#include <SteppingDemoClient.h>
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 |
SteppingDemoClient::SteppingDemoClient | ( | std::shared_ptr< ocra::Model > | modelPtr, |
const int | loopPeriod | ||
) |
SteppingDemoClient::~SteppingDemoClient | ( | ) | [virtual] |
void SteppingDemoClient::activateFootContacts | ( | FOOT_CONTACTS | foot | ) | [private] |
This method asks the ocra-icub-server to activate one by one the feet "corner" contact tasks for the specified foot.
foot | LEFT_FOOT or RIGHT_FOOT. |
void SteppingDemoClient::deactivateFootContacts | ( | FOOT_CONTACTS | foot | ) | [private] |
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.
foot | LEFT_FOOT or RIGHT_FOOT. |
Eigen::Vector3d SteppingDemoClient::getCoMPosition | ( | ) | [private] |
Retrieves the 3D position of the "CoM" as done by the yarpWholeBodyInterface.
Eigen::Vector3d SteppingDemoClient::getLeftFootPosition | ( | ) | [private] |
Retrieves the 3D position of the "l_sole" frame from the iCub model.
Eigen::Vector3d SteppingDemoClient::getRightFootPosition | ( | ) | [private] |
Retrieves the 3D position of the "r_sole" frame from the iCub model.
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).
bool SteppingDemoClient::isBalanced | ( | ) | [private] |
Uses the norm of the COM and joint velocities to understand if the robot is balanced.
bool SteppingDemoClient::isFootInContact | ( | FOOT_CONTACTS | foot | ) | [private] |
If the foot height is less than or equal to footContactReleaseThreshold, the feet contacts tasks are activated.
foot | LEFT_FOOT or RIGHT_FOOT. |
void SteppingDemoClient::leftToRightLoop | ( | ) | [private] |
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.
foot | LEFT_FOOT or RIGHT_FOOT |
isLeftFootInContact | Updates the current state of the left foot contact. |
isRightFootInContact | Updates the current state of the right foot contact. |
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.
bool SteppingDemoClient::pauseFinished | ( | ) | [private] |
Sets isPausing to false when pauseDuration has passed.
void SteppingDemoClient::pauseFor | ( | double | _pauseDuration | ) | [private] |
Mainly sets isPausing to true and stores the time at which the pause was called.
_pauseDuration | Pause 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.
newSupportPos | New support position. |
void SteppingDemoClient::release | ( | ) | [protected, virtual] |
Stops the trajectory threads of the CoM, left and right feet.
bool SteppingDemoClient::setDownFoot | ( | FOOT_CONTACTS | foot | ) | [private] |
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.
foot | LEFT_FOOT or RIGHT_FOOT |
void SteppingDemoClient::stateMachineWithoutPauseInDoubleSupport | ( | ) | [private] |
void SteppingDemoClient::stateMachineWithPauseInDoubleSupport | ( | ) | [private] |
void SteppingDemoClient::staticWalkingLoop | ( | ) | [private] |
std::shared_ptr<ocra_recipes::TrajectoryThread> SteppingDemoClient::com_TrajThread [private] |
Eigen::Vector3d SteppingDemoClient::comHome [private] |
double SteppingDemoClient::currentTime [private] |
bool SteppingDemoClient::footTrajectoryStarted [private] |
bool SteppingDemoClient::getInitialValues [private] |
bool SteppingDemoClient::isInLeftSupportMode [private] |
bool SteppingDemoClient::isInRightSupportMode [private] |
bool SteppingDemoClient::isMovingCoM [private] |
bool SteppingDemoClient::isPausing [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] |
CONTROL_PHASE SteppingDemoClient::nextPhase [private] |
Eigen::Vector3d SteppingDemoClient::nextStep [private] |
double SteppingDemoClient::pauseDuration [private] |
double SteppingDemoClient::pauseTriggerTime [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] |
double SteppingDemoClient::startTime [private] |