mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 09:29:03 +08:00
Add torque FF to axis mirroring
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user