Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
8c4b04e
Stole Tom's balance code :D
Crafty15 May 19, 2025
81d0ef8
slow, unstable kick
Crafty15 May 19, 2025
ce18c71
support foot offsets for testing
Crafty15 May 19, 2025
03f379f
use gyroscope values instead of error rates
Crafty15 May 19, 2025
a11951d
torso adjustment
Crafty15 May 19, 2025
6225e4c
balance tuning
Crafty15 May 19, 2025
f58e41c
Remove offset configs
Crafty15 May 19, 2025
2f2c6dd
Add the foot offsets back in
Crafty15 May 19, 2025
52915e4
More suitable test kick
Crafty15 May 19, 2025
ac4cd4c
Hacky hip shift. Committing for reference only
Crafty15 May 20, 2025
b5b09e3
revert hip shift
Crafty15 May 20, 2025
c1c2044
revert hip shift
Crafty15 May 20, 2025
15eba7a
earlier lean for kick
Crafty15 May 20, 2025
9a9f422
more aggressive correction
Crafty15 May 20, 2025
ec81ae6
Step kick tinkering. Doesn't work. Committing for reference.
Crafty15 May 21, 2025
f0d6e51
revert step kick
Crafty15 May 21, 2025
54b4553
Slightly more stable base kick
Crafty15 May 22, 2025
5643738
Plotjuggler debugging
Crafty15 May 22, 2025
afd07af
debugging
Crafty15 May 23, 2025
c85ff2d
fix unitialised quat
Crafty15 May 24, 2025
5854297
remove offset and more aggressive tune
Crafty15 May 24, 2025
673cae9
Stronger kick
Crafty15 May 24, 2025
b9c2469
remove debugs
Crafty15 May 24, 2025
4275d2f
less aggressive tune
Crafty15 May 26, 2025
a26dba1
debug graphs
Crafty15 May 26, 2025
0130383
apply correction to walk
Crafty15 May 26, 2025
83faabb
formatting
Crafty15 May 26, 2025
6c8debe
graph raw acceleration
Crafty15 May 27, 2025
3c8bdd4
very aggressive pitch gain
Crafty15 May 27, 2025
e3ae2db
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 May 31, 2025
5b60b01
Merge branch 'lcraft/kick-balance-tests' of https://github.com/NUbots…
Crafty15 May 31, 2025
f1ab699
real robot tune. Could be better
Crafty15 May 31, 2025
a985dc3
real robot plotjuggler
Crafty15 May 31, 2025
4cc793f
this kick sucks
Crafty15 May 31, 2025
f95126b
slightly better kick
Crafty15 Jun 5, 2025
15d70b8
balance control config bool
Crafty15 Jun 5, 2025
fc75123
Add more time on end of waypoints for balancing
Crafty15 Jun 5, 2025
aca031e
Turn on balance for both legs when kicking
Crafty15 Jun 5, 2025
b8de13a
bc off
Crafty15 Jun 5, 2025
6e6f463
turn up roll gain
Crafty15 Jun 5, 2025
1e83b46
extra foot waypoint for planting
Crafty15 Jun 5, 2025
bc119ea
Merge branch 'main' into lcraft/kick-balance-tests
Jun 7, 2025
bbca430
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jun 9, 2025
a6b16a5
revert
Crafty15 Jun 9, 2025
c92df0c
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jun 29, 2025
a440ed0
cleanup
Crafty15 Jun 29, 2025
4e84fdb
clean up config
Crafty15 Jun 30, 2025
503db3c
cleanup
Crafty15 Jun 30, 2025
2e29ca3
revert plotjuggler changes
Crafty15 Jun 30, 2025
c13206c
revert spline kick tunes
Crafty15 Jun 30, 2025
2b87c51
cleanup
Crafty15 Jun 30, 2025
157ec44
cleanup and add balance control config
Crafty15 Jun 30, 2025
e37d9fe
cleanup
Crafty15 Jun 30, 2025
00387b5
add balance config to spline kick
Crafty15 Jun 30, 2025
56279ed
remove unused value
Crafty15 Jun 30, 2025
984fde5
comment and turn off
Crafty15 Jun 30, 2025
fd48bc3
fix name
Crafty15 Jun 30, 2025
ac217c5
format
Crafty15 Jun 30, 2025
1ff551c
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 1, 2025
f529f37
Merge branch 'lcraft/kick-balance-tests' of https://github.com/NUbots…
Crafty15 Jul 5, 2025
d8d91a5
Change to member functions
Crafty15 Jul 5, 2025
59dc37a
add error check and remove redundant else block
Crafty15 Jul 5, 2025
76c7845
Clean up correction enabled config
Crafty15 Jul 5, 2025
592ae12
apply code suggestion
Crafty15 Jul 5, 2025
ca8dfc8
brief
Crafty15 Jul 5, 2025
e80ee44
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 6, 2025
22bb93e
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 6, 2025
5fbaa98
Merge branch 'lcraft/kick-balance-tests' of https://github.com/NUbots…
Crafty15 Jul 6, 2025
a5d3656
fix debug
Crafty15 Jul 6, 2025
c8dec0d
Move servo command block to top so it isn't skipped.
Crafty15 Jul 6, 2025
62d2866
change to utility functions
Crafty15 Jul 6, 2025
cbb9d84
tune webots balance config
Crafty15 Jul 6, 2025
06e62fb
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 8, 2025
48c0f51
Update module/actuation/FootController/src/FootController.hpp
Crafty15 Jul 9, 2025
8139e98
debugging
Crafty15 Jul 10, 2025
a219074
add missing error configs
Crafty15 Jul 13, 2025
9301db7
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 14, 2025
a052baf
Merge branch 'main' into lcraft/kick-balance-tests
Crafty15 Jul 14, 2025
58130ef
a f*%king comma!
Crafty15 Jul 15, 2025
1569ed1
fixed bug and a safe tune
Crafty15 Jul 15, 2025
0aa77cc
Clamp error instead of returning early
Crafty15 Jul 15, 2025
82fd60a
tune
Crafty15 Jul 15, 2025
4d1d1d3
disable force playing and change debug levels
Crafty15 Jul 15, 2025
e0e95a1
test
Crafty15 Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions module/actuation/FootController/data/config/FootController.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,18 @@ servo_gains:
R_KNEE: 8
R_ANKLE_PITCH: 8
R_ANKLE_ROLL: 8

balance:
roll_p_gain: 0.2
pitch_p_gain: 0.2

roll_i_gain: 0.0
pitch_i_gain: 0.0

roll_d_gain: 0.01
pitch_d_gain: 0.01

max_i_error: 0.0

max_pitch_error: 0.6
max_roll_error: 0.6
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
log_level: INFO

startup:
# Gain to use in startup phase
servo_gain: 30
Expand All @@ -17,3 +19,18 @@ servo_gains:
R_KNEE: 30
R_ANKLE_PITCH: 30
R_ANKLE_ROLL: 30

balance:
roll_p_gain: 0.2
pitch_p_gain: 0.2

roll_i_gain: 0.0
pitch_i_gain: 0.0

roll_d_gain: 0.01
pitch_d_gain: 0.01

max_i_error: 0.0

max_pitch_error: 0.6
max_roll_error: 0.6
19 changes: 15 additions & 4 deletions module/actuation/FootController/src/FootController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,29 @@ namespace module::actuation {

on<Configuration>("FootController.yaml").then([this](const Configuration& config) {
// Set log level from the configuration
this->log_level = config["log_level"].as<NUClear::LogLevel>();
cfg.mode = config["mode"].as<std::string>();

this->log_level = config["log_level"].as<NUClear::LogLevel>();
cfg.mode = config["mode"].as<std::string>();
cfg.desired_gains = config["servo_gains"].as<std::map<std::string, double>>();

// Set gains of servo to startup phase values
cfg.servo_states.clear();
cfg.startup_gain = config["startup"]["servo_gain"].as<double>();
for (const auto& servo : cfg.desired_gains) {
utility::input::ServoID servo_id(servo.first);
cfg.servo_states[servo_id] = ServoState(cfg.startup_gain, TORQUE_ENABLED);
}

// Balance config
cfg.roll_p_gain = config["balance"]["roll_p_gain"].as<double>();
cfg.pitch_p_gain = config["balance"]["pitch_p_gain"].as<double>();
cfg.roll_i_gain = config["balance"]["roll_i_gain"].as<double>();
cfg.pitch_i_gain = config["balance"]["pitch_i_gain"].as<double>();
cfg.max_i_error = config["balance"]["max_i_error"].as<double>();
cfg.roll_d_gain = config["balance"]["roll_d_gain"].as<double>();
cfg.pitch_d_gain = config["balance"]["pitch_d_gain"].as<double>();
cfg.max_pitch_error = config["balance"]["max_pitch_error"].as<double>();
cfg.max_roll_error = config["balance"]["max_roll_error"].as<double>();

// Emit request to set desired gains after a delay
emit<Scope::DELAY>(std::make_unique<SetGains>(),
std::chrono::seconds(config["startup"]["duration"].as<int>()));
Expand All @@ -68,7 +80,6 @@ namespace module::actuation {
}
});


on<Provide<ControlLeftFoot>, With<Sensors>, Needs<LeftLegIK>, Priority::HIGH>().then(
[this](const ControlLeftFoot& left_foot, const Sensors& sensors) {
auto left_leg = std::make_unique<LeftLegIK>();
Expand Down
162 changes: 158 additions & 4 deletions module/actuation/FootController/src/FootController.hpp
Comment thread
ysims marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
#ifndef MODULE_ACTUATION_FOOTCONTROLLER_HPP
#define MODULE_ACTUATION_FOOTCONTROLLER_HPP

#include <Eigen/Core>
#include <Eigen/Geometry>
#include <algorithm>
#include <fmt/format.h>
#include <nuclear>

#include "extension/Behaviour.hpp"
Expand All @@ -37,6 +40,8 @@

#include "utility/input/LimbID.hpp"
#include "utility/input/ServoID.hpp"
#include "utility/math/comparison.hpp"
#include "utility/math/euler.hpp"
#include "utility/nusight/NUhelpers.hpp"

#define TORQUE_ENABLED 100
Expand All @@ -47,11 +52,18 @@ namespace module::actuation {
using message::input::Sensors;

using utility::input::LimbID;
using utility::math::euler::mat_to_rpy_intrinsic;
using utility::math::euler::rpy_intrinsic_to_mat;
using utility::nusight::graph;

/// @brief Empty struct used to trigger the setting of servo gains.
struct SetGains {};

class FootController : public ::extension::behaviour::BehaviourReactor {
public:
/// @brief Called by the powerplant to build and setup the FootController reactor.
explicit FootController(std::unique_ptr<NUClear::Environment> environment);

private:
/// @brief Stores configuration values
struct Config {
Expand Down Expand Up @@ -79,8 +91,36 @@ namespace module::actuation {
std::chrono::seconds set_gain_delay = std::chrono::seconds(0);
/// @brief Desired gains for each servo
std::map<std::string, double> desired_gains{};

/// @brief Proportional gain for torso orientation roll correction
double roll_p_gain = 0.0;
/// @brief Proportional gain for torso orientation pitch correction
double pitch_p_gain = 0.0;
/// @brief Integral gain for torso orientation roll correction
double roll_i_gain = 0.0;
/// @brief Integral gain for torso orientation pitch correction
double pitch_i_gain = 0.0;
/// @brief Antiwindup max I error
double max_i_error = 0.0;
/// @brief Derivative gain for torso orientation roll correction
double roll_d_gain = 0.0;
/// @brief Derivative gain for torso orientation pitch correction
double pitch_d_gain = 0.0;
/// @brief Maximum allowed pitch error before disabling correction
double max_pitch_error = 0.0;
/// @brief Maximum allowed roll error before disabling correction
double max_roll_error = 0.0;
} cfg;

/// @brief Accumulates the integral of the roll error over time for use in PID control.
double integral_roll_error = 0;
/// @brief Accumulates the integral of the pitch error over time for use in PID control.
double integral_pitch_error = 0;

/// @brief Stores the timestamp of the last PID control update, used to compute time deltas for integral and
/// derivative calculations.
NUClear::clock::time_point last_update_time{};

/// @brief Foot controller logic
template <typename FootControlTask, typename IKTask>
void control_foot(const FootControlTask& foot_control_task,
Expand Down Expand Up @@ -110,13 +150,127 @@ namespace module::actuation {
else {
throw std::runtime_error("Invalid mode");
}
}

public:
/// @brief Called by the powerplant to build and setup the FootController reactor.
explicit FootController(std::unique_ptr<NUClear::Environment> environment);
// Add correction to the torso orientation if enabled
if (foot_control_task.correction_enabled) {
// Hwt quaternion
Eigen::Quaterniond Hwt_quat(sensors.Htw.inverse().linear());

// Get fused roll and pitch
Eigen::Vector3d rpy = mat_to_rpy_intrinsic(Hwt_quat.toRotationMatrix());
double fused_roll = rpy.x();
double fused_pitch = rpy.y();

if (log_level <= DEBUG) {
// Graph the correction being applied
emit(graph("Balance/Actual_Roll", fused_roll));
emit(graph("Balance/Actual_Pitch", fused_pitch));
}

// Get the desired roll and pitch
Eigen::Quaterniond Hft_quat(ik_task->Htf.inverse().linear());
rpy = mat_to_rpy_intrinsic(Hft_quat.toRotationMatrix());
double desired_roll = rpy.x();
double desired_pitch = rpy.y();

if (log_level <= DEBUG) {
// Graph desired orientation (before PID correction)
emit(graph("Balance/Desired_Roll_Original", desired_roll));
emit(graph("Balance/Desired_Pitch_Original", desired_pitch));
}

// Compute the error between the desired torso orientation and the actual torso orientation
auto roll_error = desired_roll - fused_roll;
auto pitch_error = desired_pitch - fused_pitch;

if (log_level <= DEBUG) {
// Graph the errors
emit(graph("Balance/Roll_Error", roll_error));
emit(graph("Balance/Pitch_Error", pitch_error));
}

auto dt =
std::chrono::duration_cast<std::chrono::duration<double>>(NUClear::clock::now() - last_update_time)
.count();
last_update_time = NUClear::clock::now();

// P control
auto clamped_roll_error = utility::math::clamp(-cfg.max_roll_error, roll_error, cfg.max_roll_error);
auto clamped_pitch_error = utility::math::clamp(-cfg.max_pitch_error, pitch_error, cfg.max_pitch_error);
desired_roll += cfg.roll_p_gain * clamped_roll_error;
desired_pitch += cfg.pitch_p_gain * clamped_pitch_error;

if (log_level <= DEBUG) {
if (roll_error > cfg.max_roll_error || roll_error < -cfg.max_roll_error) {
// If the error is too large, we are probably falling over and should pause applying control.
log<DEBUG>(fmt::format("Balance correction disabled due to large ROLL error: roll_error = {}",
roll_error));
log<DEBUG>(fmt::format("Clamping roll error to: {}", clamped_roll_error));
}

if (pitch_error > cfg.max_pitch_error || pitch_error < -cfg.max_pitch_error) {
// If the error is too large, we are probably falling over and should pause applying control.
log<DEBUG>(fmt::format("Balance correction disabled due to large error: pitch_error = {}",
pitch_error));
log<DEBUG>(fmt::format("Clamping pitch error to: {}", clamped_pitch_error));
}
}

// Graph P Correction
if (log_level <= DEBUG) {
emit(graph("Balance/P_Roll_Correction", cfg.roll_p_gain * roll_error));
emit(graph("Balance/P_Pitch_Correction", cfg.pitch_p_gain * pitch_error));
}

// I control
integral_roll_error += roll_error * dt;
integral_pitch_error += pitch_error * dt;

// Graph the integral correction
if (log_level <= DEBUG) {
emit(graph("Balance/I_Roll_Correction", cfg.roll_i_gain * integral_roll_error));
emit(graph("Balance/I_Pitch_Correction", cfg.pitch_i_gain * integral_pitch_error));
}

// Anti windup
integral_roll_error = std::max(std::min(integral_roll_error, cfg.max_i_error), -cfg.max_i_error);
integral_pitch_error = std::max(std::min(integral_pitch_error, cfg.max_i_error), -cfg.max_i_error);

desired_roll += cfg.roll_i_gain * integral_roll_error;
desired_pitch += cfg.pitch_i_gain * integral_pitch_error;

// D control using gyroscope values
auto roll_rate = sensors.gyroscope.x();
auto pitch_rate = sensors.gyroscope.y();
desired_roll -= cfg.roll_d_gain * roll_rate;
desired_pitch -= cfg.pitch_d_gain * pitch_rate;

if (log_level <= DEBUG) {
// Graph D corrections and rates
emit(graph("Balance/D_Roll_Correction", -cfg.roll_d_gain * roll_rate));
emit(graph("Balance/D_Pitch_Correction", -cfg.pitch_d_gain * pitch_rate));
emit(graph("Balance/Roll_Rate", roll_rate));
emit(graph("Balance/Pitch_Rate", pitch_rate));

// Graph final corrected desired values
emit(graph("Balance/Desired_Roll_Final", desired_roll));
emit(graph("Balance/Desired_Pitch_Final", desired_pitch));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to apply a slew rate limit to these, just as a safety precaution. so basically just add a limit on the maximum change in desired pitch and roll per second, just so that if we get bad sensor data (like a faulty gyro reading) this doesn't blow up


double desired_yaw = mat_to_rpy_intrinsic(Hft_quat.toRotationMatrix()).z();

// Compute desired orientation: yaw * fused_roll_pitch
Eigen::Matrix3d desired_Rft = Eigen::AngleAxisd(desired_yaw, Eigen::Vector3d::UnitZ())
* rpy_intrinsic_to_mat(Eigen::Vector3d(desired_roll, desired_pitch, 0.0));
Eigen::Isometry3d Htf_corrected = foot_control_task.Htf;
Htf_corrected.linear() = desired_Rft.transpose();

ik_task->Htf = Htf_corrected;
}
}
};


} // namespace module::actuation

#endif // MODULE_ACTUATION_FOOTCONTROLLER_HPP
3 changes: 3 additions & 0 deletions module/skill/SplineKick/data/config/SplineKick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ arms:
left_shoulder_roll: 0.35
right_elbow: -0.7
left_elbow: -0.7

# Use balance control. NOTE: correction_enabled must be true in FootController config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Use balance control. NOTE: correction_enabled must be true in FootController config
# Use balance control

use_balance_control: false
3 changes: 3 additions & 0 deletions module/skill/SplineKick/data/config/webots/SplineKick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ arms:
left_shoulder_roll: 0.2
right_elbow: -0.7
left_elbow: -0.7

# Use balance control. NOTE: correction_enabled must be true in FootController config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Use balance control. NOTE: correction_enabled must be true in FootController config
# Use balance control

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe the comment isn't needed anymore

use_balance_control: false
6 changes: 4 additions & 2 deletions module/skill/SplineKick/src/SplineKick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ namespace module::skill {
cfg.arm_positions.emplace_back(ServoID::L_SHOULDER_ROLL, config["arms"]["left_shoulder_roll"].as<double>());
cfg.arm_positions.emplace_back(ServoID::R_ELBOW, config["arms"]["right_elbow"].as<double>());
cfg.arm_positions.emplace_back(ServoID::L_ELBOW, config["arms"]["left_elbow"].as<double>());
// Configure balance control
cfg.use_balance_control = config["use_balance_control"].as<bool>();
});

// Start - Runs every time the Kick provider starts (wasn't running)
Expand Down Expand Up @@ -139,8 +141,8 @@ namespace module::skill {
Eigen::Isometry3d Htr = kick_generator.get_foot_pose(LimbID::RIGHT_LEG);

// Construct ControlFoot tasks
emit<Task>(std::make_unique<ControlLeftFoot>(Htl, goal_time));
emit<Task>(std::make_unique<ControlRightFoot>(Htr, goal_time));
emit<Task>(std::make_unique<ControlLeftFoot>(Htl, goal_time, cfg.use_balance_control));
emit<Task>(std::make_unique<ControlRightFoot>(Htr, goal_time, cfg.use_balance_control));

// Construct Arm IK tasks
auto left_arm = std::make_unique<LeftArm>();
Expand Down
3 changes: 3 additions & 0 deletions module/skill/SplineKick/src/SplineKick.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ namespace module::skill {

/// @brief Desired arm positions while walking
std::vector<std::pair<utility::input::ServoID, double>> arm_positions{};

/// @brief Option to use balance control when kicking
bool use_balance_control = false;
} cfg;

/// @brief Last time we updated the walk engine
Expand Down
3 changes: 3 additions & 0 deletions module/skill/Walk/data/config/Walk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ walk:
period: 0.39
# Bool to indicate whether or not to only switch if the next foot is planted
only_switch_when_planted: true
# Bool to indicate whether or not to use balance control. NOTE: correction_enabled must be true in FootController config
use_balance_control: true

step:
# Maximum step limits in x and y (in meters), and theta (in radians).
limits: [0.5, 0.2, 0.4]
Expand Down
3 changes: 3 additions & 0 deletions module/skill/Walk/data/config/webots/Walk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ walk:
period: 0.39
# Bool to indicate whether or not to only switch if the next foot is planted
only_switch_when_planted: true
# Bool to indicate whether or not to use balance control. NOTE: correction_enabled must be true in FootController config
use_balance_control: false

step:
# Maximum step limits in x and y (in meters), and theta (in radians).
limits: [0.5, 0.2, 0.4]
Expand Down
11 changes: 6 additions & 5 deletions module/skill/Walk/src/Walk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ namespace module::skill {
cfg.arm_positions.emplace_back(ServoID::L_SHOULDER_ROLL, config["arms"]["left_shoulder_roll"].as<double>());
cfg.arm_positions.emplace_back(ServoID::R_ELBOW, config["arms"]["right_elbow"].as<double>());
cfg.arm_positions.emplace_back(ServoID::L_ELBOW, config["arms"]["left_elbow"].as<double>());
cfg.kick_velocity_x = config["kick"]["kick_velocity_x"].as<double>();
cfg.kick_velocity_y = config["kick"]["kick_velocity_y"].as<double>();
cfg.kick_timing_offset = config["kick"]["kick_timing_offset"].as<double>();
cfg.kick_velocity_x = config["kick"]["kick_velocity_x"].as<double>();
cfg.kick_velocity_y = config["kick"]["kick_velocity_y"].as<double>();
cfg.kick_timing_offset = config["kick"]["kick_timing_offset"].as<double>();
cfg.use_balance_control = config["walk"]["use_balance_control"].as<bool>();

// Since walk needs a Stability message to run, emit one at the beginning
emit(std::make_unique<Stability>(Stability::UNKNOWN));
Expand Down Expand Up @@ -212,8 +213,8 @@ namespace module::skill {
Eigen::Isometry3d Htr = walk_generator.get_foot_pose(LimbID::RIGHT_LEG);

// Construct ControlFoot tasks
emit<Task>(std::make_unique<ControlLeftFoot>(Htl, goal_time));
emit<Task>(std::make_unique<ControlRightFoot>(Htr, goal_time));
emit<Task>(std::make_unique<ControlLeftFoot>(Htl, goal_time, cfg.use_balance_control));
emit<Task>(std::make_unique<ControlRightFoot>(Htr, goal_time, cfg.use_balance_control));

// Construct Arm IK tasks
auto left_arm = std::make_unique<LeftArm>();
Expand Down
2 changes: 2 additions & 0 deletions module/skill/Walk/src/Walk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace module::skill {
double kick_velocity_y = 0.0;
/// @brief Buffer time before the kick starts
double kick_timing_offset = 0.0;
/// @brief Option to use balance control when walking
bool use_balance_control = false;
} cfg;

/// @brief Last time we updated the walk engine
Expand Down
Loading
Loading