rm_controllers
Loading...
Searching...
No Matches
stand_up.h
Go to the documentation of this file.
1//
2// Created by guanlin on 25-9-3.
3//
4
5#pragma once
6
7#include <hardware_interface/joint_command_interface.h>
8#include <control_toolbox/pid.h>
9#include <rm_common/filters/filters.h>
10
14
16{
17class StandUp : public ModeBase
18{
19 struct StandUpLegCommand
20 {
21 double desired_length;
22 double desired_angle;
23 double desired_angle_vel;
24 };
25
26public:
27 StandUp(BipedalControllerInterface* controller_, const std::vector<hardware_interface::JointHandle*>& joint_handles,
28 const std::vector<control_toolbox::Pid*>& pid_legs, const std::vector<control_toolbox::Pid*>& pid_thetas);
29 void execute(const ros::Time& time, const ros::Duration& period) override;
30 const char* name() const override
31 {
32 return "STAND_UP";
33 }
34
35private:
36 void setUpLegMotion(const Eigen::Matrix<double, STATE_DIM, 1>& x, const LegOrientation& other_leg_orientation,
37 const double& leg_length, const double& leg_theta, LegOrientation& leg_orientation,
38 StandUpLegCommand& legCommand, bool& stop_flag, bool& arrive_flag, ros::Time arrive_time);
44 void detectLegState(const Eigen::Matrix<double, STATE_DIM, 1>& x, LegOrientation& leg_orientation);
58 inline LegCommand computePidLegCommand(const StandUpLegCommand& leg_command, const VMCPtr& vmc_,
59 control_toolbox::Pid& length_pid, control_toolbox::Pid& angle_pid,
60 control_toolbox::Pid& angle_vel_pid, const LegOrientation& leg_orientation,
61 const ros::Duration& period, double feedforward_force = 0.0f);
62 std::vector<hardware_interface::JointHandle*> joint_handles_;
63 std::vector<control_toolbox::Pid*> pid_legs_, pid_thetas_;
64 LegOrientation left_leg_orientation, right_leg_orientation;
65 double theta_des_l, theta_des_r, length_des_l, length_des_r;
66 StandUpLegCommand left_leg_command_, right_leg_command_;
67 bool left_stop_{ false }, right_stop_{ false };
68 std::shared_ptr<LegStateThresholdParams> leg_state_threshold_;
69 ros::Time left_arrive_time_, right_arrive_time_;
70 bool left_arrive_flag_{ false }, right_arrive_flag_{ false };
71 VMCPtr vmcPtr_;
72 std::shared_ptr<RampFilter<double>> ramp_length_des_l_, ramp_length_des_r_, ramp_angle_des_l_, ramp_angle_des_r_;
73};
74} // namespace rm_chassis_controllers
Definition controller_interface.h:13
Definition mode_base.h:20
Definition stand_up.h:18
StandUp(BipedalControllerInterface *controller_, const std::vector< hardware_interface::JointHandle * > &joint_handles, const std::vector< control_toolbox::Pid * > &pid_legs, const std::vector< control_toolbox::Pid * > &pid_thetas)
Definition stand_up.cpp:11
const char * name() const override
Definition stand_up.h:30
void execute(const ros::Time &time, const ros::Duration &period) override
Definition stand_up.cpp:24
Definition active_suspension.h:16
LegOrientation
Definition definitions.h:91
std::shared_ptr< VMC > VMCPtr
Definition VMC.h:68
Definition definitions.h:84