AntiCogging for S1

I keep getting a anticogging_calibration error when I follow the Anticogging guide.

I’m running a M8325s motor and AMT212 encoder.

When I call odrv0.axis0.requested_state = AxisState.ANTICOGGING_CALIBRATION the S1 instantly faults.

Am I missing something with the encoder setup? The Position Reference Frame is not something I have a good understanding of.

Also, when issuing the odrv0.axis0.pos_estimate = odrv0.rs485_group0.raw command I get an attribute error: ‘anonymous_interface_10555315329256’ object has no attribute 'rs485_group0.

Hi! A few questions:

  1. What ODrive firmware version are you using? It’ll show when the ODrive is connected over ODrivetool (e.g. 0.6.10, 0.6.9, etc)
  2. What does the ODrive fault with after you start ANTICOGGING_CALIBRATION? You can use dump_errors(odrv0) to show this.

Note it’s rs485_encoder_group0, not rs485_group0 – issue in our docs, apologies, fixed now (will update in a few minutes). That being said, the Absolute Encoder Reference Frame will automatically initialize pos_estimate to the AMT21 angle, so all you have to do is this: Controller — ODrive Documentation 0.6.11 documentation

Oh, cool! Thanks for the quick update. Using 0.6.10. I’ll make that change in my command later today and see what happens.

Great, please let me know how it goes!

Well, this time it went through without errors, but at the last command:
odrv0.axis0.requested_state = AxisState.ANTICOGGING_CALIBRATION
The light remained green, but the motor did not turn or even try to turn. I could hear the whine as if the the motor was going to do something, but nothing happened for several minutes.

Inputting these commands into odrivetool gets laborious. I need a break. More later…

Hmm, have you tuned the vel_gain before? And what values did you set for anticogging.max_torque, anticogging.calib_start_vel, anticogging.calib_end_vel, and anticogging.coarse_integrator_gain?

Hi guys,

I am having a similar issue here.

I am using an OdriveS1 with an AMT21-OD Encoder.

When I try and run the anti cogging calibration the driver and motor simply do nothing.

There is no error, no change in lights, nothing.

I am using 0.6.11 firmware.

The config I paste into odrivetool is thus:

odrv0.config.dc_bus_overvoltage_trip_level = 30
odrv0.config.dc_bus_undervoltage_trip_level = 6
odrv0.config.dc_max_positive_current = 25
odrv0.config.dc_max_negative_current = -0.1

odrv0.axis0.config.motor.motor_type = 0
odrv0.axis0.config.motor.pole_pairs = 7
odrv0.axis0.config.motor.torque_constant = 0.02506060606060606
odrv0.axis0.config.motor.current_soft_max = 20
odrv0.axis0.config.motor.current_hard_max = 30
odrv0.axis0.config.motor.calibration_current = 3
odrv0.axis0.config.motor.resistance_calib_max_voltage = 2

odrv0.axis0.config.calibration_lockin.current = 3
odrv0.axis0.motor.motor_thermistor.config.enabled = False

odrv0.axis0.controller.config.control_mode = 2 # Velocity control
odrv0.axis0.controller.config.input_mode = 1 # Vel ramp
odrv0.axis0.controller.config.vel_ramp_rate = 1
odrv0.axis0.controller.config.inertia = 1
odrv0.axis0.controller.config.vel_limit = 10
odrv0.axis0.controller.config.vel_limit_tolerance = 10
odrv0.axis0.controller.config.pos_gain = 100.0
odrv0.axis0.controller.config.vel_gain = 0.25
odrv0.axis0.controller.config.vel_integrator_gain = 1.5

odrv0.axis0.config.torque_soft_min = 0
odrv0.axis0.config.torque_soft_max = 1
odrv0.axis0.config.enable_watchdog = False
odrv0.rs485_encoder_group0.config.mode = Rs485EncoderMode.AMT21_EVENT_DRIVEN
odrv0.axis0.config.load_encoder = EncoderId.RS485_ENCODER0
odrv0.axis0.config.commutation_encoder = EncoderId.RS485_ENCODER0
odrv0.inc_encoder0.config.cpr = 16384

odrv0.axis0.config.anticogging.max_torque = 0.1
odrv0.axis0.config.anticogging.calib_start_vel = 1.5
odrv0.axis0.config.anticogging.calib_end_vel = 0.1
odrv0.axis0.config.anticogging.calib_coarse_integrator_gain = 10

odrv0.axis0.pos_vel_mapper.config.offset = 0.0
odrv0.axis0.pos_vel_mapper.config.offset_valid = True
odrv0.axis0.pos_vel_mapper.config.approx_init_pos = 0.0
odrv0.axis0.pos_vel_mapper.config.approx_init_pos_valid = True
odrv0.axis0.controller.config.absolute_setpoints = True

This is currently massively blocking a project so If you could get back to me asap I would be appreciative.

My first question is, can you get the motor running without anti-cogging?

If so, then you will need to play with velocity gains and integrator gains. Mine needed to be bumped up.

I started with what is written below for my M8325s motor driven by an S1 running 0.6.10 firmware.

The values below were my starting values and I needed to bump those up 2X or more to get any results, along with increasing the max torque.

Then I increased the start velocity and end velocity to keep it running without stalling.

Unfortunately, I don’t have a solid under standing of the parameters, so I kept playing around with the values until something happened. If I can find good way to measure the cogging torque I can do a classic DOE to fine tune the process.

Preparation

odrv0.axis0.controller.config.vel_gain = 0.25

odrv0.axis0.pos_estimate = odrv0.rs485_encoder_group0.raw

Absolute Encoder Reference Frame

odrv0.axis0.pos_vel_mapper.config.offset = 0.0

odrv0.axis0.pos_vel_mapper.config.offset.valid = True

odrv0.axis0.pos_vel_mapper.config.approx_init_pos = 0.0

odrv0.axis0.pos_vel_mapper.config.approx_init_pos_valid = True

odrv0.axis0.controller.config.absolute_setpoints = True

Enable Anticogging

odrv0axis0.controller.config.vel_gain = 0.25

odrv0.axis0.config.anticogging.max_torque = 0.15

odrv0.axis0.config.anticogging.calib_start_vel = 0.5

odrv0.axis0.config.anticogging.calib_end_vel = 0.05

odrv0.axis0.config.anticogging.calib_coarse_integrator_gain = 10

odrv0.axis0.requested_state = AxisState.ANTICOGGING_CALIBRATION

odrv0.axis0.config.anticogging.enabled = True

odrv0.save_configuration()

So i have managed to get it calibrated in anticogging - My new problem is that now the motor will only go forwards?

I assume this is a config problem?

Did the motor reverse when you did the anticogging calibration?

It should rotate in both directions before it is complete.

Fixed this on the Discord, looks like it was an issue w/ calibration, not with anticogging.