Class WalkNode

Class Documentation

class bitbots_quintic_walk::WalkNode

Public Functions

explicit WalkNode(rclcpp::Node::SharedPtr node, const std::string &ns = "", const std::vector<rclcpp::Parameter> &moveit_parameters = {})
bitbots_msgs::msg::JointCommand step(double dt)
bitbots_msgs::msg::JointCommand step(double dt, geometry_msgs::msg::Twist::SharedPtr cmdvel_msg, sensor_msgs::msg::Imu::SharedPtr imu_msg, sensor_msgs::msg::JointState::SharedPtr jointstate_msg, bitbots_msgs::msg::FootPressure::SharedPtr pressure_left, bitbots_msgs::msg::FootPressure::SharedPtr pressure_right)
bitbots_msgs::msg::JointCommand step_relative(double dt, geometry_msgs::msg::Twist::SharedPtr step_msg, sensor_msgs::msg::Imu::SharedPtr imu_msg, sensor_msgs::msg::JointState::SharedPtr jointstate_msg, bitbots_msgs::msg::FootPressure::SharedPtr pressure_left, bitbots_msgs::msg::FootPressure::SharedPtr pressure_right)
geometry_msgs::msg::PoseArray step_open_loop(double dt, geometry_msgs::msg::Twist::SharedPtr cmdvel_msg)
geometry_msgs::msg::Pose get_right_foot_pose()

Small helper method to get foot position via python wrapper

geometry_msgs::msg::Pose get_left_foot_pose()
void reset()

Reset everything to initial idle state.

void updateParams()

Updates the parameters of the walking after a parameter change.

void reset(WalkState state, double phase, geometry_msgs::msg::Twist::SharedPtr cmd_vel, bool reset_odometry)

Reset walk to any given state. Necessary for using this as reference in learning.

void run()

This is the main loop which takes care of stopping and starting of the walking. A small state machine is tracking in which state the walking is and builds the trajectories accordingly.

void initializeEngine()

Initialize internal WalkEngine to correctly zeroed, usable state

void robotStateCb(bitbots_msgs::msg::RobotControlState::SharedPtr msg)

Sets the current state of the robot

Parameters

msg – The current state

WalkEngine *getEngine()
WalkIK *getIk()
moveit::core::RobotModelPtr *get_kinematic_model()
nav_msgs::msg::Odometry getOdometry()
void publish_debug()
rclcpp::TimerBase::SharedPtr startTimer()
double getTimerFreq()

Private Functions

std::array<double, 4> get_step_from_vel(geometry_msgs::msg::Twist::SharedPtr msg)
void stepCb(geometry_msgs::msg::Twist::SharedPtr msg)
void cmdVelCb(geometry_msgs::msg::Twist::SharedPtr msg)
void imuCb(sensor_msgs::msg::Imu::SharedPtr msg)
void checkPhaseRestAndReset()
void pressureRightCb(bitbots_msgs::msg::FootPressure::SharedPtr msg)
void pressureLeftCb(bitbots_msgs::msg::FootPressure::SharedPtr msg)
void jointStateCb(sensor_msgs::msg::JointState::SharedPtr msg)
void kickCb(std_msgs::msg::Bool::SharedPtr msg)
double getTimeDelta()

Private Members

rclcpp::Node::SharedPtr node_
walking::ParamListener param_listener_
walking::Params config_
WalkRequest current_request_   = {.stop_walk = true}
WalkRequest last_request_
bool first_run_ = true
double last_ros_update_time_ = 0
int robot_state_ = bitbots_msgs::msg::RobotControlState::CONTROLLABLE
int current_support_foot_ = biped_interfaces::msg::Phase::DOUBLE_STANCE
WalkResponse current_response_
WalkResponse current_stabilized_response_
bitbots_splines::JointGoals motor_goals_
bitbots_quintic_walk::WalkEngine walk_engine_
nav_msgs::msg::Odometry odom_msg_
rclcpp::Publisher<bitbots_msgs::msg::JointCommand>::SharedPtr pub_controller_command_
rclcpp::Publisher<nav_msgs::msg::Odometry>::SharedPtr pub_odometry_
rclcpp::Publisher<biped_interfaces::msg::Phase>::SharedPtr pub_support_
rclcpp::Subscription<geometry_msgs::msg::Twist>::SharedPtr step_sub_
rclcpp::Subscription<geometry_msgs::msg::Twist>::SharedPtr cmd_vel_sub_
rclcpp::Subscription<bitbots_msgs::msg::RobotControlState>::SharedPtr robot_state_sub_
rclcpp::Subscription<sensor_msgs::msg::JointState>::SharedPtr joint_state_sub_
rclcpp::Subscription<std_msgs::msg::Bool>::SharedPtr kick_sub_
rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr imu_sub_
rclcpp::Subscription<bitbots_msgs::msg::FootPressure>::SharedPtr pressure_sub_left_
rclcpp::Subscription<bitbots_msgs::msg::FootPressure>::SharedPtr pressure_sub_right_
std::shared_ptr<robot_model_loader::RobotModelLoader> robot_model_loader_
moveit::core::RobotModelPtr kinematic_model_
moveit::core::RobotStatePtr current_state_
WalkStabilizer stabilizer_
WalkIK ik_
WalkVisualizer visualizer_
double current_trunk_fused_pitch_ = 0
double current_trunk_fused_roll_ = 0
double current_fly_pressure_ = 0
double current_fly_effort_ = 0
std::optional<rclcpp::Time> last_imu_measurement_time_
double imu_y_acc = 0
bool got_new_goals_ = false