diff --git a/CHANGELOG.md b/CHANGELOG.md index d77a003e..7a4324fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Unreleased Features Please add a note of your changes below this heading if you make a Pull Request. +### Changed +* Moved `traptraj.A_per_css` to `controller.inertia` + # Releases ## [0.4.7] - 2018-11-28 ### Added diff --git a/Firmware/MotorControl/controller.cpp b/Firmware/MotorControl/controller.cpp index 16aef47a..1e2ad7cd 100644 --- a/Firmware/MotorControl/controller.cpp +++ b/Firmware/MotorControl/controller.cpp @@ -113,7 +113,7 @@ bool Controller::update(float pos_estimate, float vel_estimate, float* current_s TrapezoidalTrajectory::Step_t traj_step = axis_->trap_.eval(t); pos_setpoint_ = traj_step.Y; vel_setpoint_ = traj_step.Yd; - current_setpoint_ = traj_step.Ydd * axis_->trap_.config_.A_per_css; + current_setpoint_ = traj_step.Ydd * config_.inertia; } anticogging_pos = pos_setpoint_; // FF the position setpoint instead of the pos_estimate } diff --git a/Firmware/MotorControl/controller.hpp b/Firmware/MotorControl/controller.hpp index b39c2890..a12172a2 100644 --- a/Firmware/MotorControl/controller.hpp +++ b/Firmware/MotorControl/controller.hpp @@ -32,6 +32,7 @@ public: float vel_limit_tolerance = 1.2f; // ratio to vel_lim. 0.0f to disable float vel_ramp_rate = 10000.0f; // [(counts/s) / s] bool setpoints_in_cpr = false; + float inertia = 0.0f; // [A/(count/s^2)] }; Controller(Config_t& config); @@ -107,7 +108,8 @@ public: make_protocol_property("vel_limit", &config_.vel_limit), make_protocol_property("vel_limit_tolerance", &config_.vel_limit_tolerance), make_protocol_property("vel_ramp_rate", &config_.vel_ramp_rate), - make_protocol_property("setpoints_in_cpr", &config_.setpoints_in_cpr) + make_protocol_property("setpoints_in_cpr", &config_.setpoints_in_cpr), + make_protocol_property("inertia", &config_.inertia) ), make_protocol_function("set_pos_setpoint", *this, &Controller::set_pos_setpoint, "pos_setpoint", "vel_feed_forward", "current_feed_forward"), diff --git a/Firmware/MotorControl/trapTraj.hpp b/Firmware/MotorControl/trapTraj.hpp index 42dac0ef..dc548d56 100644 --- a/Firmware/MotorControl/trapTraj.hpp +++ b/Firmware/MotorControl/trapTraj.hpp @@ -7,7 +7,6 @@ public: float vel_limit = 20000.0f; // [count/s] float accel_limit = 5000.0f; // [count/s^2] float decel_limit = 5000.0f; // [count/s^2] - float A_per_css = 0.0f; // [A/(count/s^2)] }; struct Step_t { float Y; @@ -25,8 +24,7 @@ public: make_protocol_object("config", make_protocol_property("vel_limit", &config_.vel_limit), make_protocol_property("accel_limit", &config_.accel_limit), - make_protocol_property("decel_limit", &config_.decel_limit), - make_protocol_property("A_per_css", &config_.A_per_css) + make_protocol_property("decel_limit", &config_.decel_limit) ) ); } diff --git a/docs/getting-started.md b/docs/getting-started.md index d9cc3dd6..41fcfd7c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -265,13 +265,13 @@ In the above image blue is position and orange is velocity. ..trap_traj.config.vel_limit = ..trap_traj.config.accel_limit = ..trap_traj.config.decel_limit = -..trap_traj.config.A_per_css = +..controller.config.inertia = ``` `vel_limit` is the maximum planned trajectory speed. This sets your coasting speed.
`accel_limit` is the maximum acceleration in counts / sec^2
`decel_limit` is the maximum deceleration in counts / sec^2
-`A_per_css` is a value which correlates acceleration (in counts / sec^2) and motor current. It is 0 by default. It is optional, but can improve response of your system if correctly tuned. Keep in mind this will need to change with the load / mass of your system. +`controller.config.inertia` is a value which correlates acceleration (in counts / sec^2) and motor current. It is 0 by default. It is optional, but can improve response of your system if correctly tuned. Keep in mind this will need to change with the load / mass of your system. All values should be strictly positive (>= 0).