Using trajectory mode

I’m trying to understand how to make my hover board motor move 1 or 2 revolutions with an ASCII command. I’ve got the velocity commands down pretty good. I have tried the “p”, “q”, and “t” commands with poor and unexpected results. Do they (“p,q and t”) have to be configured a certain way? If so where would I find the docs on the set up? Any help appreciated.

Thank you and Happy Holidays

andyinyakima

Hoverboard motors with hall sensors don’t have sufficient resolution for good position control, unfortunately. I assume you’re just seeing sluggish behaviour, overshoot, poor settling, etc?

Thanks for the quick response Wetmelon,

This hoverboard motor has an optical encoder that I am using. Encoder is non-indexed 3200 pulses per revolution, I have to calibrate the Odrive first thing after power up.

I am new to BLDC motors so my config is probably not correct it works great in velocity mode,
but probably not correct for ASCII “p” “q” or “t” mode. This is where I think I need guidance.

Here is my config which I acquired from this forum.

odrv0.config.enable_brake_resistor = True
odrv0.axis0.motor.config.calibration_current = 2
odrv0.axis0.motor.config.pole_pairs = 15
odrv0.axis0.motor.config.resistance_calib_max_voltage = 6
odrv0.axis0.motor.config.requested_current_range = 35
odrv0.axis0.motor.config.current_control_bandwidth = 100.0
odrv0.axis0.motor.config.torque_constant = 8.27 / 10
odrv0.axis1.motor.config.calibration_current = 2
odrv0.axis1.motor.config.pole_pairs = 15
odrv0.axis1.motor.config.resistance_calib_max_voltage = 6
odrv0.axis1.motor.config.requested_current_range = 35
odrv0.axis1.motor.config.current_control_bandwidth = 100.0
odrv0.axis1.motor.config.torque_constant = 8.27 / 10

encoder

odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.cpr = 3200
odrv0.axis0.encoder.config.bandwidth = 1000
odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis1.encoder.config.cpr = 3200
odrv0.axis1.encoder.config.bandwidth = 1000

odrv0.axis0.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 0.002 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_integrator_gain = 0.01 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_limit = 5
odrv0.axis1.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.axis1.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis1.controller.config.pos_gain = 1
odrv0.axis1.controller.config.vel_gain = 0.002 * odrv0.axis1.motor.config.torque_constant * odrv0.axis1.encoder.config.cpr
odrv0.axis1.controller.config.vel_integrator_gain = 0.01 * odrv0.axis1.motor.config.torque_constant * odrv0.axis1.encoder.config.cpr
odrv0.axis1.controller.config.vel_limit = 5

BREAK HERE

odrv0.save_configuration()
odrv0.reboot()