diff --git a/Firmware/MotorControl/controller.hpp b/Firmware/MotorControl/controller.hpp index cb27e808..8022e946 100644 --- a/Firmware/MotorControl/controller.hpp +++ b/Firmware/MotorControl/controller.hpp @@ -31,7 +31,7 @@ public: float torque_ramp_rate = 0.01f; // Nm / sec bool circular_setpoints = false; float circular_setpoint_range = 1.0f; // Circular range when circular_setpoints is true. [turn] - float inertia = 0.0f; // [A/(count/s^2)] + float inertia = 0.0f; // [Nm/(turn/s^2)] float input_filter_bandwidth = 2.0f; // [1/s] float homing_speed = 0.25f; // [turn/s] Anticogging_t anticogging; diff --git a/Firmware/MotorControl/motor.hpp b/Firmware/MotorControl/motor.hpp index 85c2c1e9..b8fdcc33 100644 --- a/Firmware/MotorControl/motor.hpp +++ b/Firmware/MotorControl/motor.hpp @@ -36,7 +36,7 @@ public: }; // NOTE: for gimbal motors, all units of Nm are instead V. - // example: vel_gain is [V/(count/s)] instead of [Nm/(count/s)] + // example: vel_gain is [V/(turn/s)] instead of [Nm/(turn/s)] // example: current_lim and calibration_current will instead determine the maximum voltage applied to the motor. struct Config_t { bool pre_calibrated = false; // can be set to true to indicate that all values here are valid diff --git a/Firmware/communication/can_simple.cpp b/Firmware/communication/can_simple.cpp index 18d39838..027bfbea 100644 --- a/Firmware/communication/can_simple.cpp +++ b/Firmware/communication/can_simple.cpp @@ -94,8 +94,8 @@ void CANSimple::handle_can_message(can_Message_t& msg) { case MSG_START_ANTICOGGING: start_anticogging_callback(axis, msg); break; - case MSG_SET_TRAJ_A_PER_CSS: - set_traj_A_per_css_callback(axis, msg); + case MSG_SET_TRAJ_INERTIA: + set_traj_inertia_callback(axis, msg); break; case MSG_SET_TRAJ_ACCEL_LIMITS: set_traj_accel_limits_callback(axis, msg); @@ -316,7 +316,7 @@ void CANSimple::set_traj_accel_limits_callback(Axis* axis, can_Message_t& msg) { axis->trap_traj_.config_.decel_limit = can_getSignal(msg, 32, 32, true); } -void CANSimple::set_traj_A_per_css_callback(Axis* axis, can_Message_t& msg) { +void CANSimple::set_traj_inertia_callback(Axis* axis, can_Message_t& msg) { axis->controller_.config_.inertia = can_getSignal(msg, 0, 32, true); } diff --git a/Firmware/communication/can_simple.hpp b/Firmware/communication/can_simple.hpp index a4ccae4d..0168b978 100644 --- a/Firmware/communication/can_simple.hpp +++ b/Firmware/communication/can_simple.hpp @@ -25,7 +25,7 @@ class CANSimple { MSG_START_ANTICOGGING, MSG_SET_TRAJ_VEL_LIMIT, MSG_SET_TRAJ_ACCEL_LIMITS, - MSG_SET_TRAJ_A_PER_CSS, + MSG_SET_TRAJ_INERTIA, MSG_GET_IQ, MSG_GET_SENSORLESS_ESTIMATES, MSG_RESET_ODRIVE, @@ -57,7 +57,7 @@ class CANSimple { static void start_anticogging_callback(Axis* axis, can_Message_t& msg); static void set_traj_vel_limit_callback(Axis* axis, can_Message_t& msg); static void set_traj_accel_limits_callback(Axis* axis, can_Message_t& msg); - static void set_traj_A_per_css_callback(Axis* axis, can_Message_t& msg); + static void set_traj_inertia_callback(Axis* axis, can_Message_t& msg); static void get_iq_callback(Axis* axis, can_Message_t& msg); static void get_sensorless_estimates_callback(Axis* axis, can_Message_t& msg); static void get_vbus_voltage_callback(Axis* axis, can_Message_t& msg); diff --git a/Firmware/odrive-interface.yaml b/Firmware/odrive-interface.yaml index 8ac43ba0..271a7837 100644 --- a/Firmware/odrive-interface.yaml +++ b/Firmware/odrive-interface.yaml @@ -621,9 +621,8 @@ interfaces: flags: Overspeed: doc: | - Try increasing `config.vel_limit`. The default of 20,000 encoder - counts per second gives a motor speed of only ~146 RPM with the - common CUI-AMT102 8192 count per rotation encoder. Note: Even if + Try increasing `config.vel_limit`. The default of 2 turns per second + gives a motor speed of only 120 RPM. Note: Even if you do not commanded your motor to exceed `config.vel_limit` sudden changes in the load placed on a motor may cause this speed to be temporarily exceeded, resulting in this error. @@ -687,13 +686,13 @@ interfaces: type: bool circular_setpoint_range: type: float32 - doc: circular range in [rad] for position setpoints when circular_setpoints is True + doc: circular range in [turns] for position setpoints when circular_setpoints is True homing_speed: type: float32 - unit: counts/s + unit: turns/s inertia: type: float32 - unit: A/(count/s^2) + unit: A/(turn/s^2) axis_to_mirror: uint8 mirror_ratio: float32 load_encoder_axis: @@ -957,8 +956,8 @@ valuetypes: brief: Ramps a velocity command from the current value to the target value. doc: | ### Configuration Values: - * `config.vel_ramp_rate` [cpr/sec] - * `config.inertia` [A/(count/s^2))] + * `config.vel_ramp_rate` [turn/sec] + * `config.inertia` [A/(turn/s^2))] ### Valid inputs: * `input_vel` diff --git a/docs/ascii-protocol.md b/docs/ascii-protocol.md index 93ba8a02..948e7307 100644 --- a/docs/ascii-protocol.md +++ b/docs/ascii-protocol.md @@ -32,9 +32,9 @@ t motor destination ``` * `t` for trajectory * `motor` is the motor number, `0` or `1`. -* `destination` is the goal position, in encoder counts. +* `destination` is the goal position, in [turns]. -Example: `t 0 -20000` +Example: `t 0 -2` For general moving around of the axis, this is the recommended command. @@ -45,26 +45,26 @@ For basic use where you send one setpoint at at a time, use the `q` command. If you have a realtime controller that is streaming setpoints and tracking a trajectory, use the `p` command. ``` -q motor position velocity_lim current_lim +q motor position velocity_lim torque_lim ``` * `q` for position * `motor` is the motor number, `0` or `1`. -* `position` is the desired position, in encoder counts. -* `velocity_lim` is the velocity limit, in counts/s (optional). -* `current_lim` is the current limit, in A (optional). +* `position` is the desired position, in [turns]. +* `velocity_lim` is the velocity limit, in [turns/s] (optional). +* `torque_lim` is the torque limit, in [Nm] (optional). -Example: `q 0 -20000 10000 10` +Example: `q 0 -2 1 0.1` ``` p motor position velocity_ff current_ff ``` * `p` for position * `motor` is the motor number, `0` or `1`. -* `position` is the desired position, in encoder counts. -* `velocity_ff` is the velocity feed-forward term, in counts/s (optional). -* `current_ff` is the current feed-forward term, in A (optional). +* `position` is the desired position, in [turns]. +* `velocity_ff` is the velocity feed-forward term, in [turns/s] (optional). +* `torque_ff` is the current feed-forward term, in [Nm] (optional). -Example: `p 0 -20000 0 0` +Example: `p 0 -2 0 0` Note that if you don't know what feed-forward is or what it's used for, simply omit it. @@ -72,14 +72,14 @@ This command updates the watchdog timer for the motor. #### Motor Velocity command ``` -v motor velocity current_ff +v motor velocity torque_ff ``` * `v` for velocity * `motor` is the motor number, `0` or `1`. -* `velocity` is the desired velocity in counts/s. -* `current_ff` is the current feed-forward term, in A (optional). +* `velocity` is the desired velocity in [turns/s]. +* `torque_ff` is the torque feed-forward term, in [Nm] (optional). -Example: `v 0 1000 0` +Example: `v 0 1 0` Note that if you don't know what feed-forward is or what it's used for, simply omit it. @@ -87,11 +87,11 @@ This command updates the watchdog timer for the motor. #### Motor Current command ``` -c motor current +c motor torque ``` * `c` for current * `motor` is the motor number, `0` or `1`. -* `current` is the desired current in A. +* `torque` is the desired current in [Nm]. This command updates the watchdog timer for the motor. @@ -103,8 +103,8 @@ response: pos vel ``` * `f` for feedback -* `pos` is the encoder position in counts (float) -* `vel` is the encoder velocity in counts/s (float) +* `pos` is the encoder position in [turns] (float) +* `vel` is the encoder velocity in [turns/s] (float) #### Update motor watchdog ``` diff --git a/docs/can-protocol.md b/docs/can-protocol.md index e0f4c75e..8368625a 100644 --- a/docs/can-protocol.md +++ b/docs/can-protocol.md @@ -54,7 +54,7 @@ CMD ID | Name | Sender | Signals | Start byte | Signal Type | Bits | Factor | Of 0x010 | Start Anticogging | Master | - | - | - | - | - | - | - 0x011 | Set Traj Vel Limit | Master | Traj Vel Limit | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel 0x012 | Set Traj Accel Limits | Master | Traj Accel Limit
Traj Decel Limit | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
32 | 1
1 | 0
0 | Intel
Intel -0x013 | Set Traj A per Count / s^2 | Master | Traj A per CSS | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel +0x013 | Set Traj Inertia | Master | Traj Inertia | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel 0x014 | Get IQ\* | Axis | Iq Setpoint
Iq Measured | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
32 | 1
1 | 0
0 | Intel
Intel 0x015 | Get Sensorless Estimates\* | Master | Sensorless Pos Estimate
Sensorless Vel Estimate | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
32 | 1
1 | 0
0 | Intel
Intel 0x016 | Reboot ODrive | Master\*\*\* | - | - | - | - | - | - | - diff --git a/docs/endstops.md b/docs/endstops.md index 0336b6dd..9dc84e6c 100644 --- a/docs/endstops.md +++ b/docs/endstops.md @@ -94,9 +94,9 @@ There is one additional configuration parameter specifically for the homing proc Name | Type | Default --- | -- | -- -homing_speed | float | 2000.0f +homing_speed | float | 0.25f -`homing_speed` is the axis travel speed during homing, in counts/second. If you are using SPI based encoders and the axis is homing in the wrong direction, you can enter a negative value for the homing speed and a negative value for the minimum endstop offset. +`homing_speed` is the axis travel speed during homing, in [turns/second]. If you are using SPI based encoders and the axis is homing in the wrong direction, you can enter a negative value for the homing speed and a negative value for the minimum endstop offset. ### Performing the Homing Sequence diff --git a/docs/getting-started.md b/docs/getting-started.md index 0f794782..94bcf15e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -296,7 +296,7 @@ In the above image blue is position and orange is velocity. `vel_limit` is the maximum planned trajectory speed. This sets your coasting speed.
`accel_limit` is the maximum acceleration in turns / sec^2
`decel_limit` is the maximum deceleration in turns / sec^2
-`controller.config.inertia` is a value which correlates acceleration (in turns / 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 turns / sec^2) and motor torque. 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). diff --git a/docs/interfaces.md b/docs/interfaces.md index 31bd305e..ebe279e9 100644 --- a/docs/interfaces.md +++ b/docs/interfaces.md @@ -102,7 +102,7 @@ Pinout: To enable step/dir mode for the GPIO, set `.config.enable_step_dir` to true for each axis that you wish to use this on. Axis 0 step/dir pins conflicts with UART, and the UART takes priority. So to be able to use step/dir on Axis 0, you must also set `odrv0.config.enable_uart = False`. See the [pin function priorities](#pin-function-priorities) for more detail. Don't forget to save configuration and reboot. -There is also a config variable called `.config.turns_per_step`, which specifies how many encoder counts a "step" corresponds to. It can be any floating point value. +There is also a config variable called `.config.turns_per_step`, which specifies how many turns a "step" corresponds to. The default value is 1.0f/1024.0f. It can be any floating point value. The maximum step rate is pending tests, but it should handle at least 50kHz. If you want to test it, please be aware that the failure mode on too high step rates is expected to be that the motors shuts down and coasts. Please be aware that there is no enable line right now, and the step/direction interface is enabled by default, and remains active as long as the ODrive is in position control mode. To get the ODrive to go into position control mode at bootup, see how to configure the [startup procedure](commands.md#startup-procedure). diff --git a/docs/odrivetool.md b/docs/odrivetool.md index 4aab38a0..3cd01972 100644 --- a/docs/odrivetool.md +++ b/docs/odrivetool.md @@ -211,7 +211,7 @@ To change what parameters are plotted open odrivetool (located in Anaconda3\Scri my_odrive.axis1.encoder.pos_estimate, ]) ``` -For example, to plot the approximate motor torque [N.cm] and the velocity [RPM] of axis1 with a 150KV motor and an 8192 count per rotation econder you would modify the function to read: +For example, to plot the approximate motor torque [Nm] and the velocity [RPM] of axis0, you would modify the function to read: ``` # If you want to plot different values, change them here. # You can plot any number of values concurrently. diff --git a/tools/odrive/tests/can_test.py b/tools/odrive/tests/can_test.py index 13d337ec..512076e8 100644 --- a/tools/odrive/tests/can_test.py +++ b/tools/odrive/tests/can_test.py @@ -32,7 +32,7 @@ command_set = { 'start_anticogging': (0x010, []), # untested 'set_traj_vel_limit': (0x011, [('traj_vel_limit', 'f', 1)]), # tested 'set_traj_accel_limits': (0x012, [('traj_accel_limit', 'f', 1), ('traj_decel_limit', 'f', 1)]), # tested - 'set_traj_a_per_css': (0x013, [('a_per_css', 'f', 1)]), # tested + 'set_traj_inertia': (0x013, [('inertia', 'f', 1)]), # tested 'get_iq': (0x014, [('iq_setpoint', 'f', 1), ('iq_measured', 'f', 1)]), # untested 'get_sensorless_estimates': (0x015, [('sensorless_pos_estimate', 'f', 1), ('sensorless_vel_estimate', 'f', 1)]), # untested 'reboot': (0x016, []), # tested @@ -206,7 +206,7 @@ class TestSimpleCAN(): test_assert_eq(axis.trap_traj.config.accel_limit, 98.231, range=0.0001) test_assert_eq(axis.trap_traj.config.decel_limit, -12.234, range=0.0001) - my_cmd('set_traj_a_per_css', a_per_css=55.086) + my_cmd('set_traj_inertia', inertia=55.086) fence() test_assert_eq(axis.controller.config.inertia, 55.086, range=0.0001)