diff --git a/CHANGELOG.md b/CHANGELOG.md index 2efd1a34..ac23bac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ Please add a note of your changes below this heading if you make a Pull Request. * Tracking of rotor flux through rotor time constant * Automatic d axis current for Maximum Torque Per Amp (MTPA) +### Changed +* Moved `controller.vel_ramp_enable` into `controller.config`. + # Releases ## [0.4.11] - 2019-07-25 ### Added diff --git a/Firmware/MotorControl/controller.cpp b/Firmware/MotorControl/controller.cpp index 70bfb1a0..ea44754a 100644 --- a/Firmware/MotorControl/controller.cpp +++ b/Firmware/MotorControl/controller.cpp @@ -128,7 +128,7 @@ bool Controller::update(float pos_estimate, float vel_estimate, float* current_s } // Ramp rate limited velocity setpoint - if (config_.control_mode == CTRL_MODE_VELOCITY_CONTROL && vel_ramp_enable_) { + if (config_.control_mode == CTRL_MODE_VELOCITY_CONTROL && config_.vel_ramp_enable) { float max_step_size = current_meas_period * config_.vel_ramp_rate; float full_step = vel_ramp_target_ - vel_setpoint_; float step; diff --git a/Firmware/MotorControl/controller.hpp b/Firmware/MotorControl/controller.hpp index 020f34d0..24842130 100644 --- a/Firmware/MotorControl/controller.hpp +++ b/Firmware/MotorControl/controller.hpp @@ -30,6 +30,7 @@ public: float vel_integrator_gain = 10.0f / 10000.0f; // [A/(counts/s * s)] float vel_limit = 20000.0f; // [counts/s] float vel_limit_tolerance = 1.2f; // ratio to vel_lim. 0.0f to disable + bool vel_ramp_enable = false; float vel_ramp_rate = 10000.0f; // [(counts/s) / s] bool setpoints_in_cpr = false; }; @@ -86,7 +87,6 @@ public: float vel_integrator_current_ = 0.0f; // [A] float current_setpoint_ = 0.0f; // [A] float vel_ramp_target_ = 0.0f; - bool vel_ramp_enable_ = false; uint32_t traj_start_loop_count_ = 0; @@ -101,7 +101,6 @@ public: make_protocol_property("vel_integrator_current", &vel_integrator_current_), make_protocol_property("current_setpoint", ¤t_setpoint_), make_protocol_property("vel_ramp_target", &vel_ramp_target_), - make_protocol_property("vel_ramp_enable", &vel_ramp_enable_), make_protocol_object("config", make_protocol_property("control_mode", &config_.control_mode), make_protocol_property("pos_gain", &config_.pos_gain), @@ -109,6 +108,7 @@ public: make_protocol_property("vel_integrator_gain", &config_.vel_integrator_gain), make_protocol_property("vel_limit", &config_.vel_limit), make_protocol_property("vel_limit_tolerance", &config_.vel_limit_tolerance), + make_protocol_property("vel_ramp_enable", &config_.vel_ramp_enable), make_protocol_property("vel_ramp_rate", &config_.vel_ramp_rate), make_protocol_property("setpoints_in_cpr", &config_.setpoints_in_cpr) ),