Add torque FF to axis mirroring

This commit is contained in:
Paul Guenette
2021-04-30 18:25:03 -04:00
parent 2622f4d8eb
commit f2eb40b5ef
+3 -1
View File
@@ -161,14 +161,16 @@ bool Controller::update() {
if (config_.axis_to_mirror < AXIS_COUNT) {
std::optional<float> other_pos = axes[config_.axis_to_mirror].encoder_.pos_estimate_.present();
std::optional<float> other_vel = axes[config_.axis_to_mirror].encoder_.vel_estimate_.present();
std::optional<float> other_torque = axes[config_.axis_to_mirror].controller_.torque_output_.present();
if (!other_pos.has_value() || !other_vel.has_value()) {
if (!other_pos.has_value() || !other_vel.has_value() || !other_torque.has_value()) {
set_error(ERROR_INVALID_ESTIMATE);
return false;
}
pos_setpoint_ = *other_pos * config_.mirror_ratio;
vel_setpoint_ = *other_vel * config_.mirror_ratio;
torque_setpoint_ = *other_torque * config_.mirror_ratio;
} else {
set_error(ERROR_INVALID_MIRROR_AXIS);
return false;