Skip to content

Commit

Permalink
add logging to stabilizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannesbrae committed Dec 11, 2024
1 parent c06f0fe commit 3135d09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class WalkStabilizer : public bitbots_splines::AbstractStabilizer<WalkResponse>
double pitch_threshold, double roll_threshold, const rclcpp::Duration &dt);

private:
rclcpp::Node::SharedPtr node_;
control_toolbox::PidROS pid_trunk_fused_pitch_;
control_toolbox::PidROS pid_trunk_fused_roll_;
control_toolbox::PidROS pid_step_length_adjustment_pitch_;
Expand Down
4 changes: 3 additions & 1 deletion bitbots_motion/bitbots_quintic_walk/src/walk_stabilizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
namespace bitbots_quintic_walk {

WalkStabilizer::WalkStabilizer(rclcpp::Node::SharedPtr node)
: pid_trunk_fused_pitch_(node, "node.trunk_pid.pitch"),
: node_(node),
pid_trunk_fused_pitch_(node, "node.trunk_pid.pitch"),
pid_trunk_fused_roll_(node, "node.trunk_pid.roll"),
pid_step_length_adjustment_pitch_(node, "node.step_length.pitch"),
pid_step_length_adjustment_roll_(node, "node.step_length.roll") {
Expand All @@ -25,6 +26,7 @@ WalkRequest WalkStabilizer::adjust_step_length(WalkRequest request, const double
const rclcpp::Duration& dt) {
double adjustment_pitch = pid_step_length_adjustment_pitch_.computeCommand(imu_roll, dt);
double adjustment_roll = pid_step_length_adjustment_roll_.computeCommand(imu_roll, dt);
RCLCPP_WARN(node_->get_logger(), "Adjustment pitch, roll: %f, %f", adjustment_pitch, adjustment_roll);
// adapt step length values based on PID controllers
// we use a threshold to avoid unneeded steps
if (adjustment_pitch >= pitch_threshold) {
Expand Down

0 comments on commit 3135d09

Please sign in to comment.