Input mode Tuning enhancements

This commit is contained in:
Paul Guenette
2021-06-12 11:31:13 -04:00
parent afe027a1a7
commit a1338ac551
4 changed files with 16 additions and 9 deletions
+5 -3
View File
@@ -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);
+3 -3
View File
@@ -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 {
+4 -3
View File
@@ -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
+4
View File
@@ -308,6 +308,10 @@ let odriveEnums = {
{
text: "Mirror",
value: 7
},
{
text: "Tuning",
value: 8
}
]
}