robotoc
robotoc - efficient ROBOT Optimal Control solvers
Loading...
Searching...
No Matches
pace_foot_step_planner.hpp
Go to the documentation of this file.
1#ifndef ROBOTOC_PACE_FOOT_STEP_PLANNER_HPP_
2#define ROBOTOC_PACE_FOOT_STEP_PLANNER_HPP_
3
4#include <vector>
5#include <iostream>
6
7#include "Eigen/Core"
8#include "Eigen/Geometry"
9
12#include "robotoc/robot/se3.hpp"
17
18
19namespace robotoc {
20
26public:
31 PaceFootStepPlanner(const Robot& quadruped_robot);
32
37
42
47
52
57
61 PaceFootStepPlanner& operator=(PaceFootStepPlanner&&) noexcept = default;
62
69 void setGaitPattern(const Eigen::Vector3d& step_length, const double step_yaw,
70 const bool enable_stance_phase);
71
80 void setRaibertGaitPattern(const Eigen::Vector3d& vcom_cmd,
81 const double yaw_rate_cmd, const double swing_time,
82 const double stance_time, const double gain);
83
88 void setContactSurfaces(const std::vector<Eigen::Matrix3d>& contact_surfaces);
89
95 const std::vector<std::vector<Eigen::Matrix3d>>& contact_surfaces);
96
97 void init(const Eigen::VectorXd& q) override;
98
99 bool plan(const double t, const Eigen::VectorXd& q, const Eigen::VectorXd& v,
100 const ContactStatus& contact_status,
101 const int planning_steps) override;
102
106 const aligned_vector<SE3>& contactPlacements(const int step) const override;
107
108 const std::vector<Eigen::Vector3d>& contactPositions(const int step) const override;
109
110 const std::vector<Eigen::Matrix3d>& contactSurfaces(const int step) const override;
111
112 const Eigen::Vector3d& CoM(const int step) const override;
113
114 const Eigen::Matrix3d& R(const int step) const override;
115
116 int size() const override { return planning_size_; }
117
118 friend std::ostream& operator<<(std::ostream& os,
119 const PaceFootStepPlanner& planner);
120
121 friend std::ostream& operator<<(std::ostream& os,
122 const std::shared_ptr<PaceFootStepPlanner>& planner);
123
124 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
125
126private:
127 Robot robot_;
128 RaibertHeuristic raibert_heuristic_;
129 MovingWindowFilter<2> vcom_moving_window_filter_;
130 bool enable_raibert_heuristic_;
131 int LF_foot_id_, LH_foot_id_, RF_foot_id_, RH_foot_id_, current_step_, planning_size_;
132 aligned_vector<aligned_vector<SE3>> contact_placement_ref_;
133 std::vector<std::vector<Eigen::Vector3d>> contact_position_ref_;
134 std::vector<std::vector<Eigen::Matrix3d>> contact_surface_ref_;
135 std::vector<Eigen::Vector3d> com_ref_, com_to_contact_position_local_;
136 std::vector<Eigen::Matrix3d> R_;
137 Eigen::Vector3d vcom_, vcom_cmd_, step_length_;
138 Eigen::Matrix3d R_yaw_, R_current_;
139 double yaw_rate_cmd_;
140 bool enable_stance_phase_;
141
142};
143
144} // namespace robotoc
145
146#endif // ROBOTOC_PACE_FOOT_STEP_PLANNER_HPP_
Base interface of contact planners.
Definition: contact_planner_base.hpp:21
Contact status of robot model.
Definition: contact_status.hpp:32
Moving window filter for foot step planning.
Definition: moving_window_filter.hpp:17
Foot step planner for the pace gait of quadrupeds.
Definition: pace_foot_step_planner.hpp:25
PaceFootStepPlanner(const PaceFootStepPlanner &)=default
Default copy constructor.
bool plan(const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const ContactStatus &contact_status, const int planning_steps) override
Plans the foot steps in the MPC (receding-horizon) fashion.
PaceFootStepPlanner & operator=(const PaceFootStepPlanner &)=default
Default copy assign operator.
friend std::ostream & operator<<(std::ostream &os, const PaceFootStepPlanner &planner)
const std::vector< Eigen::Vector3d > & contactPositions(const int step) const override
Gets the contact positions of a specified step.
void setContactSurfaces(const std::vector< Eigen::Matrix3d > &contact_surfaces)
Sets the rotation of the contact surfaces.
PaceFootStepPlanner()
Default constructor.
PaceFootStepPlanner(const Robot &quadruped_robot)
Constructs the planner.
friend std::ostream & operator<<(std::ostream &os, const std::shared_ptr< PaceFootStepPlanner > &planner)
const aligned_vector< SE3 > & contactPlacements(const int step) const override
This is invalid in PaceFootStepPlanner.
int size() const override
Gets the size of each planned quantities.
Definition: pace_foot_step_planner.hpp:116
void setRaibertGaitPattern(const Eigen::Vector3d &vcom_cmd, const double yaw_rate_cmd, const double swing_time, const double stance_time, const double gain)
Sets the gait pattern by Raibert heuristic.
void setGaitPattern(const Eigen::Vector3d &step_length, const double step_yaw, const bool enable_stance_phase)
Sets the gait pattern by step length and yaw step command.
const Eigen::Vector3d & CoM(const int step) const override
Gets the CoM position of a specified step.
const Eigen::Matrix3d & R(const int step) const override
Gets the rotation matrix of the base at a specified step.
PaceFootStepPlanner(PaceFootStepPlanner &&) noexcept=default
Default move constructor.
const std::vector< Eigen::Matrix3d > & contactSurfaces(const int step) const override
Gets the contact surfaces of a specified step.
void init(const Eigen::VectorXd &q) override
Initializes the planner.
Raibert heuristic for foot step planning.
Definition: raibert_heuristic.hpp:23
Dynamics and kinematics model of robots. Wraps pinocchio::Model and pinocchio::Data....
Definition: robot.hpp:32
Definition: constraint_component_base.hpp:17
std::vector< T, Eigen::aligned_allocator< T > > aligned_vector
std vector with Eigen::aligned_allocator.
Definition: aligned_vector.hpp:14
pinocchio::SE3 SE3
Using pinocchio::SE3 without its namespace.
Definition: se3.hpp:15