wbc_ros
|
ROS 2 Interface for the Whole-Body Controller specific to bipedal walking. More...
#include <biped_controller.hpp>
Public Member Functions | |
BipedController (const rclcpp::NodeOptions &options) | |
~BipedController () | |
virtual CallbackReturn | on_configure (const rclcpp_lifecycle::State &previous_state) override |
virtual CallbackReturn | on_activate (const rclcpp_lifecycle::State &previous_state) override |
virtual CallbackReturn | on_deactivate (const rclcpp_lifecycle::State &previous_state) override |
virtual CallbackReturn | on_cleanup (const rclcpp_lifecycle::State &previous_state) override |
virtual CallbackReturn | on_error (const rclcpp_lifecycle::State &previous_state) override |
virtual CallbackReturn | on_shutdown (const rclcpp_lifecycle::State &previous_state) override |
void | updateController () |
void | handleContacts (const ContactsMsgPtr msg) |
void | joint_weight_callback (const DoubleArrayMsgPtr msg) |
void | robot_state_callback (const RobotStateMsgPtr msg) |
void | joint_state_callback (const JointStateMsgPtr msg) |
void | contacts_callback (const ContactsMsgPtr msg) |
Protected Attributes | |
RbsTaskInterfacePtr | body_task_iface |
RbsTaskInterfacePtr | foot_l_iface |
RbsTaskInterfacePtr | foot_r_iface |
JointPositionTaskInterfacePtr | joint_pos_iface |
std::vector< TaskInterfacePtr > | task_interfaces |
wbc::ContactForceTaskPtr | force_l_task |
wbc::ContactForceTaskPtr | force_r_task |
wbc::ScenePtr | scene |
wbc::RobotModelPtr | robot_model |
wbc::QPSolverPtr | solver |
wbc::types::JointState | joint_state |
wbc::types::RigidBodyState | floating_base_state |
std::vector< wbc::types::Contact > | contacts |
wbc::types::Wrench | contact_force_l |
wbc::types::Wrench | contact_force_r |
bool | has_robot_state |
bool | has_joint_state |
int | update_rate |
wbc::types::JointCommand | solver_output |
wbc::HierarchicalQP | qp |
wbc::JointIntegrator | joint_integrator |
bool | integrate_from_current_state |
std::vector< double > | p_gain_stance |
std::vector< double > | d_gain_stance |
std::vector< double > | p_gain_swing |
std::vector< double > | d_gain_swing |
std::vector< double > | p_gain |
std::vector< double > | d_gain |
JointCommandMsg | solver_output_msg |
JointCommandPublisher::SharedPtr | solver_output_publisher |
std::unique_ptr< RTJointCommandPublisher > | rt_solver_output_publisher |
TimingStatsMsg | timing_stats |
TimingStatsPublisher::SharedPtr | timing_stats_publisher |
std::unique_ptr< RTTimingStatsPublisher > | rt_timing_stats_publisher |
DoubleArraySubscription | joint_weight_subscriber |
RTDoubleArrayBuffer | rt_joint_weight_buffer |
DoubleArrayMsgPtr | joint_weight_msg |
RobotStateSubscription | robot_state_subscriber |
RTRobotStateBuffer | rt_robot_state_buffer |
RobotStateMsgPtr | robot_state_msg |
ContactsSubscription | contacts_subscriber |
RTContactsBuffer | rt_contacts_buffer |
ContactsMsgPtr | contacts_msg |
JointStateSubscription | joint_state_subscriber |
RTJointStateBuffer | rt_joint_state_buffer |
JointStateMsgPtr | joint_state_msg |
rclcpp::Time | stamp |
rclcpp::TimerBase::SharedPtr | timer |
std::shared_ptr< biped_controller::ParamListener > | param_listener |
biped_controller::Params | params |
std::vector< int > | joint_idx_map |
std::vector< int > | joint_idx_map_left_leg |
std::vector< int > | joint_idx_map_right_leg |
ROS 2 Interface for the Whole-Body Controller specific to bipedal walking.
Published Topics:
~/solver_output
(robot_control_msgs/msg/JointCommand
) - The QP solution (position, velocity, torque)~/timing_stats
(wbc_msgs/msg/TimingStats
) - Debug message showing the computation timeSubscribed Topics:
~/body_pose/setpoint
(robot_control_msgs/msg/RigidBodyState
) - Setpoint for the base of the robot (pose, twist, spatial acceleration)~/foot_l_pose/setpoint
(robot_control_msgs/msg/RigidBodyState
) - Setpoint for the left foot (position, linear velocity, linear acceleration)~/foot_r_pose/setpoint
(robot_control_msgs/msg/RigidBodyState
) - Setpoint for the right foot (position, linear velocity, linear acceleration)~/joint_position/setpoint
(robot_control_msgs/msg/JointCommand
) - Setpoint for all joints (position, velocity, acceleration)~/robot_state
(robot_control_msgs/msg/RobotState
) - Joint and floating base state of the robot~/joint_state
(robot_control_msgs/msg/JointState
) - Joint state of the robot. Can be used alternatively, if there is no floating base~/contacts
(robot_control_msgs/msg/Contacts
) - Planned contacts (0/1) and contact expected contact wrenches~/joint_weights
(std_msgs/msg/Float64MultiArray
) - Joint weights to control contribution of each individual jointParameters:
src/biped_controller_parameters.yaml
This Controller implements full or reduced TSID (https://github.com/stack-of-tasks/tsid), depending on the scene.type parameter. It gets the feet position, velocities and acceleration, the CoM pose and twist, as well as the feet contact forces as input, and produces a joint position, velocity, acceleration and torque as output. The reduced TSID sets up and solves the following QP:
\[ \begin{array}{ccc} \underset{\mathbf{\ddot{q}},\mathbf{f}}{\text{minimize}} & \| \underbrace{\left(\mathbf{J}_{com}\ddot{\mathbf{q}} - \dot{\mathbf{v}}_{d,com} + \dot{\mathbf{J}}_{com}\dot{\mathbf{q}}\right)}_{\text{Center of mass}} + \underbrace{\sum_i \left(\mathbf{J}_i\ddot{\mathbf{q}} - \dot{\mathbf{v}}_{d,i} + \dot{\mathbf{J}}_i\dot{\mathbf{q}}\right)}_{\text{Feet positions}} + \underbrace{\sum_i\left(\mathbf{f}_{d,i} - \mathbf{f}\right)}_{\text{Feet contact forces}}\|_2 \\ & & \\ s.t. & \mathbf{H}\mathbf{\ddot{q}} + \mathbf{h} = \mathbf{S}\mathbf{\tau} + \mathbf{J}_{c,i}^T\mathbf{f} \quad \forall i & \text{(Equations of motion)}\\ & \mathbf{J}_{c,i}\mathbf{\ddot{q}} = -\dot{\mathbf{J}}_{c,i}\dot{q} \quad \forall i & \text{(Rigid Contacts)}\\ & \mathbf{e}^T_x \mathbf{f}_i ≤ \mu\mathbf{e}_z \mathbf{f}_i, \quad \forall i & \text{(Friction cone)} \\ & \mathbf{\tau}_m \leq \mathbf{\tau} \leq \mathbf{\tau}_M & \text{(Torque limits)}\\ \end{array} \]
and computes
\[ \tau = \mathbf{H}\ddot{\mathbf{q}} + \mathbf{h} - \sum_i \mathbf{J}_{c,i}^T\mathbf{f} \]
where
\[ \dot{\mathbf{v}}_{d,i} = \dot{\mathbf{v}}_{r,i} + \mathbf{K}_d(\mathbf{v}_{r,i}-\mathbf{v}_i) + \mathbf{K}_p(\mathbf{x}_{r,i}-\mathbf{x}_i) \]
with
\[ \begin{array}{ccc} i & - & \text{Foot index} \\ n & - & \text{No. of robot joints} \\ \mathbf{J}_i \in \mathbb{R}^{3 \times (n+6)} & - & \text{i-th Foot Jacobian} \\ \mathbf{q},\dot{\mathbf{q}},\ddot{\mathbf{q}} \in \mathbb{R}^{n+6}& - & \text{Joint position, velocity, acceleration} \\ \mathbf{\tau} \in \mathbb{R}^{n} & - & \text{Joint torques} \\ \mathbf{f}_i \in \mathbb{R}^{3} & - & \text{Contact force of the i-th foot} \\ \mathbf{f}_{d,i} \in \mathbb{R}^{3} & - & \text{Desired contact force of the i-th foot} \\ \mathbf{H} \in \mathbb{R}^{(n+6) \times (n+6)} & - & \text{Joint space mass-inertia matrix} \\ \mathbf{J}_c \in \mathbb{R}^{3 \times (n+6)} & - & \text{Contact Jacobian} \\ \mathbf{S} \in \mathbb{R}^{(n+6) \times (n)}& - & \text{Actuator selection matrix} \\ \mathbf{h} \in \mathbb{R}^{n+6}& - & \text{Bias forces/torques} \\ \mathbf{e} \in \mathbb{R}^3 &- &\text{Unit vector}\\ \mu \in \mathbb{R} &- &\text{Contact friction coefficient}\\ \mathbf{\tau}_m,\mathbf{\tau}_M \in \mathbb{R}^{n}& - & \text{Min./Max. joint torques} \\ \mathbf{x}_i,\mathbf{v}_i & - & \text{Position, velocity of the feet} \\ \mathbf{x}_{r,i},\mathbf{v}_{r,i},\dot{\mathbf{v}}_{r,i} & - & \text{Desired position, velocity, acceleration of the feet} \\ \end{array} \]
Note:
wbc_ros::BipedController::BipedController | ( | const rclcpp::NodeOptions & | options | ) |
|
inline |
void wbc_ros::BipedController::contacts_callback | ( | const ContactsMsgPtr | msg | ) |
void wbc_ros::BipedController::handleContacts | ( | const ContactsMsgPtr | msg | ) |
void wbc_ros::BipedController::joint_state_callback | ( | const JointStateMsgPtr | msg | ) |
void wbc_ros::BipedController::joint_weight_callback | ( | const DoubleArrayMsgPtr | msg | ) |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
void wbc_ros::BipedController::robot_state_callback | ( | const RobotStateMsgPtr | msg | ) |
void wbc_ros::BipedController::updateController | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |