Go to the documentation of this file.00001
00014 #ifndef _STEPCONTROLLER_H_
00015 #define _STEPCONTROLLER_H_
00016
00017 #include <ocra-recipes/TrajectoryThread.h>
00018 #include "walking-client/utils.h"
00019
00020 class StepController {
00021 public:
00022
00023 StepController(int periodms, ocra::Model::Ptr model);
00024 virtual ~StepController();
00025
00029 bool initialize();
00030
00038 void deactivateFeetContacts(FOOT foot);
00039
00046 void activateFeetContacts(FOOT foot);
00047
00048
00049 bool doStepWithMaxVelocity(FOOT foot, Eigen::Vector3d target, double stepHeight);
00050
00059 void step(FOOT foot, Eigen::Vector3d target, double stepDuration, double stepHeight);
00060
00066 bool isStepFinished(FOOT foot);
00067
00068 double getFootTrajError(FOOT foot, double &error);
00069
00075 Eigen::Vector3d getLeftFootPosition();
00076
00082 Eigen::Vector3d getRightFootPosition();
00083
00084 void computeMidPoint(FOOT foot, Eigen::Vector3d target, double stepHeight, Eigen::Vector3d & midPoint);
00085
00086
00087 void doComputeMidPoint(Eigen::Vector3d currentFootPosition, Eigen::Vector3d target, double stepHeight, Eigen::Vector3d & midPoint);
00088
00089 bool isTrajectoryFinished(FOOT foot);
00090
00095 void stop();
00096
00097
00103 Eigen::MatrixXd getContact2DCoordinates();
00104
00105
00106 private:
00107 std::vector<ocra_recipes::TaskConnection::Ptr> _contactsCollection;
00108 ocra_recipes::TaskConnection::Ptr _LeftFootContact_BackLeft;
00109 ocra_recipes::TaskConnection::Ptr _LeftFootContact_FrontLeft;
00110 ocra_recipes::TaskConnection::Ptr _LeftFootContact_BackRight;
00111 ocra_recipes::TaskConnection::Ptr _LeftFootContact_FrontRight;
00112 ocra_recipes::TaskConnection::Ptr _RightFootContact_BackLeft;
00113 ocra_recipes::TaskConnection::Ptr _RightFootContact_FrontLeft;
00114 ocra_recipes::TaskConnection::Ptr _RightFootContact_BackRight;
00115 ocra_recipes::TaskConnection::Ptr _RightFootContact_FrontRight;
00116 std::shared_ptr<ocra_recipes::TrajectoryThread> _leftFoot_TrajThread;
00117 std::shared_ptr<ocra_recipes::TrajectoryThread> _rightFoot_TrajThread;
00118 Eigen::Vector3d target;
00119 Eigen::Vector3d _leftFootPosition;
00120 Eigen::Vector3d _rightFootPosition;
00121 ocra::Model::Ptr _model;
00122 int _period;
00123
00124 };
00125 #endif