mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-26 03:23:39 +08:00
Input mode Tuning enhancements
This commit is contained in:
@@ -224,9 +224,11 @@ bool Controller::update() {
|
||||
} break;
|
||||
case INPUT_MODE_TUNING: {
|
||||
autotuning_phase_ = wrap_pm_pi(autotuning_phase_ + (2.0f * M_PI * autotuning_.frequency * current_meas_period));
|
||||
pos_setpoint_ = autotuning_.pos_amplitude * our_arm_sin_f32(autotuning_phase_ + autotuning_.pos_phase);
|
||||
vel_setpoint_ = autotuning_.vel_amplitude * our_arm_sin_f32(autotuning_phase_ + autotuning_.vel_phase);
|
||||
torque_setpoint_ = autotuning_.torque_amplitude * our_arm_sin_f32(autotuning_phase_ + autotuning_.torque_phase);
|
||||
float c = our_arm_cos_f32(autotuning_phase_);
|
||||
float s = our_arm_sin_f32(autotuning_phase_);
|
||||
pos_setpoint_ = autotuning_.pos_amplitude * s; // + pos_amp_c * c
|
||||
vel_setpoint_ = autotuning_.vel_amplitude * c;
|
||||
torque_setpoint_ = autotuning_.torque_amplitude * -s;
|
||||
} break;
|
||||
default: {
|
||||
set_error(ERROR_INVALID_INPUT_MODE);
|
||||
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
struct Autotuning_t {
|
||||
float frequency = 0.0f;
|
||||
float pos_amplitude = 0.0f;
|
||||
float pos_phase = 0.0f;
|
||||
float vel_amplitude = 0.0f;
|
||||
float vel_phase = 0.0f;
|
||||
float torque_amplitude = 0.0f;
|
||||
float torque_phase = 0.0f;
|
||||
// float pos_phase = 0.0f;
|
||||
// float vel_phase = 0.0f;
|
||||
// float torque_phase = 0.0f;
|
||||
};
|
||||
|
||||
struct Config_t {
|
||||
|
||||
@@ -892,6 +892,7 @@ interfaces:
|
||||
trajectory_done: readonly bool
|
||||
vel_integrator_torque: float32
|
||||
anticogging_valid: bool
|
||||
autotuning_phase: float32
|
||||
config:
|
||||
c_is_class: False
|
||||
attributes:
|
||||
@@ -986,11 +987,11 @@ interfaces:
|
||||
attributes:
|
||||
frequency: float32
|
||||
pos_amplitude: float32
|
||||
pos_phase: float32
|
||||
vel_amplitude: float32
|
||||
vel_phase: float32
|
||||
torque_amplitude: float32
|
||||
torque_phase: float32
|
||||
# pos_phase: float32
|
||||
# vel_phase: float32
|
||||
# torque_phase: float32
|
||||
mechanical_power:
|
||||
type: readonly float32
|
||||
unit: Watt
|
||||
|
||||
@@ -308,6 +308,10 @@ let odriveEnums = {
|
||||
{
|
||||
text: "Mirror",
|
||||
value: 7
|
||||
},
|
||||
{
|
||||
text: "Tuning",
|
||||
value: 8
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user