ODrive S1 Torque Control Performace Shows Asymmetreic Behaviour/Error Code 8 (missing encoder estimate error)

Hello,
I am using ODrive S1 to control a CubeMars R60 motor (motor link: https://www.cubemars.com/product/r60-kv115-outrunner-torque-motor.html) in a pulley gear system.
Brief Overview of the System:
The system has two transmission stages. The first one is a pulley attached to the motor with a timing belt (transmission ratio 4.8). The second stage is a gear system with a transmission ratio of 5.625, so the total transmission ratio is 27. I am using a torque sensor to measure the torque at the output. I am using passthrough torque control in ODrive S1, not the ramped one (based on my application requirement). I am also using the enable pin to make the ODrive go into the active state.
I calibrated the ODrive S1 with the web GUI and then used my own embedded code (board: STM32 Nucleo) to perform the torque control operation.

Problem Faced in Sinusoidal Torque Control:
Summary: The torque tracking is not symmetric in the sine sweep if a larger torque is commanded (it is symmetric in the lower torque case). Also, it produces jittery current values in one direction of the sine sweep, and at that time, the motor makes a weird R2D2-like sound. FYI, I calibrated the torque sensor, so I am sure it is working fine. Details below.
I commanded a lower torque, 0.75 Nm to the motor (20.25 Nm at output). The results are listed below:
#Color legends: Grey = Output commanded torque, Green = torque sensor value, Red = ODrive measured torque producing current (Iq).
Highest Peak:

Torque Deviation: 4.8% overshoot

Current value (10.55 A) matches the commanded motor torque (0.75 Nm) and torque constant (0.072) based current (10.42 A)

Lowest Peak:

Torque Deviation: 3.13% overshoot

Current value (10.49 A) matches the commanded motor torque (0.75 Nm) and torque constant (0.072) based current (10.42A)

Then, I commanded a larger torque, 1.3 Nm to the motor (35.1 Nm at output). The results are listed below:


It creates jittery current values and weird motor sound at those jittery points.

Problem Faced in Step Response Torque Control:
#Color legends: Blue = Output commanded torque step, Purple = ODrive error code (disarm reason).
If I command any negative step input beyond 0.8 Nm to the motor, ODrive shows error code 8 (missing encoder estimate error). The step torques start from 0.75Nm, then increase in the following sequence: -0.75–> -0.8–> -0.85–> -0.9 Nm.

No error at -0.8 Nm step input.

Error code 8 at -0.85 Nm step input at motor.

If the step torque command is on the (+)ve side, then this 0.8 Nm threshold does not produce error code 8.

Can you please tell me what could cause this type of behaviour in the torque performance?

Hi there!

Summary: The torque tracking is not symmetric in the sine sweep if a larger torque is commanded (it is symmetric in the lower torque case). Also, it produces jittery current values in one direction of the sine sweep, and at that time, the motor makes a weird R2D2-like sound. FYI, I calibrated the torque sensor, so I am sure it is working fine. Details below.

Immediately upon reading this, I assume that you’re encountering torque-mode velocity limiting. When enable_torque_mode_vel_limit is set to True, then allowable torque will be reduced as the motor approaches vel_limit at a rate of vel_gain Nm/rev/s. See here: Controller — ODrive Documentation 0.6.11 documentation

However, the MISSING_ESTIMATE error is likely something else, which we should look into. Can you please make sure you’re running firmware v0.6.11 (or newer), and send the value of axis0.detailed_disarm_reason after you get this error?

Additionally, I’d like to ask for some additional information:

  • What encoder are you using?
  • What motor and bus voltage are you using?
  • Can you share some pictures of your wiring and encoder mounting?
  • Can you please export your ODrive configuration via odrivetool backup-config config.json, then paste the contents of the config.json file here? This will be extremely helpful to help diagnose the MISSING_ESTIMATE error.

Hello there! Thanks for reqaching out.

  • I did not set “enable_torque_mode_vel_limit” in GUI/ODrivetool, but I did use “odrv.axis0.controller.config.vel_limit”. During calibration in GUI (which suggested to use ramped velocity control for initial tuning) it was set to 1500, and during the embedded code torque mode operation it was set to 100 (rev/s). To clarify, the motor was not fully rotating during torque control, it was mounted in a fixed pulley setup to be able provide the commanded torque at the output. Does that create the same issue as “enable_torque_mode_vel_limit”? I will disable the torque mode velocity limiter and update here tomorrow.

  • Regarding “MISSING_ESTIMATE error”, I do not have my setup ready to make a quick operation now. I can do that tomorrow and update the info on firmware and disarm reason here.

  • Enocoder: I am using the hall sensor encoder built inside the R60 motor.

  • Motor: CubeMars R60 (https://www.cubemars.com/product/r60-kv115-outrunner-torque-motor.html),
    Bus Voltage: 27V

  • Picture: I will provide tomorrow.

  • ODrive configuration: The following is copied from the GUI after all the parameters were put in during configuration.
    odrv.config.dc_bus_overvoltage_trip_level = 28

odrv.config.dc_bus_undervoltage_trip_level = 18

odrv.config.dc_max_positive_current = 27.8

odrv.config.dc_max_negative_current = -1

odrv.config.brake_resistor0.enable = True

odrv.config.brake_resistor0.resistance = 2

odrv.axis0.config.motor.motor_type = MotorType.PMSM_CURRENT_CONTROL

odrv.axis0.config.motor.pole_pairs = 14

odrv.axis0.config.motor.torque_constant = 0.07191304347826087

odrv.axis0.config.motor.current_soft_max = 33.5

odrv.axis0.config.motor.current_hard_max = 53.5

odrv.axis0.config.motor.calibration_current = 5.5

odrv.axis0.config.motor.resistance_calib_max_voltage = 10

odrv.axis0.config.calibration_lockin.current = 8

odrv.axis0.motor.motor_thermistor.config.enabled = False

odrv.axis0.controller.config.control_mode = ControlMode.VELOCITY_CONTROL

odrv.axis0.controller.config.input_mode = InputMode.VEL_RAMP

odrv.axis0.controller.config.vel_limit = 1500

odrv.axis0.controller.config.vel_limit_tolerance = 1.3333333333333333

odrv.axis0.config.torque_soft_min = -2.3

odrv.axis0.config.torque_soft_max = 2.3

odrv.axis0.trap_traj.config.accel_limit = 10

odrv.axis0.controller.config.vel_ramp_rate = 10

odrv.can.config.protocol = Protocol.SIMPLE

odrv.can.config.baud_rate = 250000

odrv.axis0.config.can.node_id = 0

odrv.axis0.config.can.heartbeat_msg_rate_ms = 0

odrv.axis0.config.can.encoder_msg_rate_ms = 10

odrv.axis0.config.can.iq_msg_rate_ms = 10

odrv.axis0.config.can.torques_msg_rate_ms = 10

odrv.axis0.config.can.error_msg_rate_ms = 10

odrv.axis0.config.can.temperature_msg_rate_ms = 10

odrv.axis0.config.can.bus_voltage_msg_rate_ms = 10

odrv.axis0.config.enable_watchdog = False

odrv.axis0.config.encoder_bandwidth = 100

odrv.hall_encoder0.config.enabled = True

odrv.axis0.config.load_encoder = EncoderId.HALL_ENCODER0

odrv.axis0.config.commutation_encoder = EncoderId.HALL_ENCODER0

odrv.config.enable_uart_a = False

Please let me know if you still need the “config.json” paramters.

enable_torque_mode_vel_limit

This is enabled by default, so unless you explicitly disabled it, it’ll remain enabled.

Regarding “MISSING_ESTIMATE error”, I do not have my setup ready to make a quick operation now. I can do that tomorrow and update the info on firmware and disarm reason here.

That would be great, thanks!

Please let me know if you still need the “config.json” paramters.

Yes, that would be very useful if possible, as it gives the whole ODrive parameter tree.

Also, when you were running the torque sine waves before, was this at near zero speed? Or was this at some medium-high speed?

Hello,

  • When I was running the torque sine waves, this was at near zero speed.

  • After I commanded “odrv0.axis0.controller.config.enable_torque_mode_vel_limit = False”, I commanded a larger torque, 1.3 Nm to the motor (35.1 Nm at output). The results are listed below.

It creates jittery current values and weird motor sound at those jittery points. Also, the output torque is 18.26 Nm (measured by the torque sensor), which is lower than the output torque setpoint, 29.68 Nm.

But the ODrive is thinking it is outputting the correct torque value based on the current (17.7 A) and the torque constant (0.072 Nm/A). The jittery current values are oscillating on both sides of the correct current value.

So, “odrv0.axis0.controller.config.enable_torque_mode_vel_limit = False” produced the same result as before.

  • Regarding odrive backup, I tried to use the necessary command, but it showed invalid syntax error.

I also tried in the windows cmd, did not work either.

But I know odrivetool is working, because I can see the Vbus.

  • I was using firmware v0.6.9.post0, I tried to upgrade to firmware v0.6.11 using “windows cmd>pip install odrive==0.6.11.dev0” (could not find 0.6.11), but the torque asymmetry and the “missing encoder estimate error” at commanded step input remained the same.

picture shows Odrive 0.6.11.dev0 and disarm reason for the error when step torque command is given. I tried the “axis0.detailed_disarm_reason”, but it did not work, so used “dump_errors” instead.

  • Pictures of wiring: please see below.

R60 motor encoder wiring

If I use another 3rd party encoder (e.g. AMS AS5047P), will that solve the issue? Or, the problem has nothing to do with it?
Also, can you please suggest what I should do regarding the backup.json, since you need it for better diagnostics? Is there a way I can extract that from ODrive GUI?

Hi,

Regarding odrive backup, I tried to use the necessary command, but it showed invalid syntax error.

This needs to be run at the command line, not inside ODrivetool. It looks like there’s some issue in your Python path – you can check out the Python installation instructions here.

I was using firmware v0.6.9.post0, I tried to upgrade to firmware v0.6.11 using “windows cmd>pip install odrive==0.6.11.dev0” (could not find 0.6.11), but the torque asymmetry and the “missing encoder estimate error” at commanded step input remained the same.

v0.6.9.post0 and 0.6.11.dev0 are the ODrivetool versions. But yes, your S1 is running v0.6.9, I would definitely recommend upgrading to v0.6.11.

I’m thinking though that your missing estimate error may be related to wiring – those jumper wires can be unreliable, if the encoder lines drop out even for a few hundred microseconds, it can cause this error.

If I use another 3rd party encoder (e.g. AMS AS5047P), will that solve the issue? Or, the problem has nothing to do with it?

I’m not sure, definitely would need to see that config.json to tell. You could maybe try running this inside ODrivetool:

from odrive.legacy_config import backup_config_ui
backup_config_ui(odrv0, "config.json")

If you don’t know where the file is being written to, you can check with:

import os
print(os.getcwd())