Hi!
I’m using two odrive S1
I made a vehicle with two wheels (hover motors).
Only forward and backward.
However, if you turn right while moving forward, one of the motors will spin harder and try to keep moving forward.
So you can’t turn right (or left).
Forced back to forward.
Is it because of the velocity control?
Is there a better way?
Hi, I’m going to need more information to understand the problem.
How are you sending commands to the ODrives?
How are you trying to steer the vehicle? I there a 3rd (or 4th) steering wheel, or are you trying to steer with differential speeds at the drive wheels?
Thank you for your reply.
Drive wheels can only go straight or reverse.
(No rotation control at differential speed)
In-wheel motors are used on the left and right of the rear wheels, and the front wheels are casters that can rotate. (Steering is done by foot operation)
In-wheel motor control is UART control from arduino.
if (X_POS > 0)
if(!done){
odrive.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
odrive2.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
delay(10);
done=true;
}
Serial.print(“FOWORD”);
odrive.setVelocity(-X_POS);
odrive2.setVelocity(X_POS);
}
The configuration of Odrive S1 is as follows.
odrv0.config.dc_bus_overvoltage_trip_level = 30
odrv0.config.dc_max_positive_current = 5
odrv0.config.dc_max_negative_current = -0.01
odrv0.config.brake_resistor0.resistance = 2 # resistance in Ohms
odrv0.config.brake_resistor0.enable = False
odrv0.config.dc_bus_overvoltage_trip_level = 30
[motor parameters]
odrv0.axis0.config.motor.motor_type = MotorType.HIGH_CURRENT
odrv0.axis0.config.motor.pole_pairs = 15
odrv0.axis0.config.motor.torque_constant = 8.27 / 16
[system config]
odrv0.config.dc_max_negative_current = -10
odrv0.axis0.config.motor.calibration_current = 4
odrv0.axis0.config.calibration_lockin.current = 4
odrv0.axis0.config.motor.resistance_calib_max_voltage = 10
odrv0.axis0.config.motor.current_control_bandwidth = 100
odrv0.save_configuration()
odrv0.axis0.controller.config.vel_limit = 3 # [turn/s]
[configure commutation encoder]
odrv0.axis0.config.encoder_bandwidth = 100
odrv0.hall_encoder0.config.enabled = True
odrv0.axis0.config.commutation_encoder = EncoderId.HALL_ENCODER0
[configure load encoder]
odrv0.inc_encoder0.config.cpr = 3200
odrv0.inc_encoder0.config.enabled = True
odrv0.axis0.config.load_encoder = EncoderId.INC_ENCODER0
odrv0.save_configuration()
odrv0.axis0.controller.config.control_mode = ControlMode.VELOCITY_CONTROL
odrv0.axis0.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.axis0.controller.config.input_filter_bandwidth = 20
odrv0.config.uart_a_baudrate = 19200 # must match the value in the Arduino sketch
odrv0.config.enable_uart_a = True
odrv0.config.gpio6_mode = GpioMode.UART_A
odrv0.config.gpio7_mode = GpioMode.UART_A
odrv0.save_configuration()
I don’t fully understand how this works:
but I think I understand the problem.
If you are not using some differential velocity setpoints with the setup:
then the expected behavior is simple forward or reverse without steering.
To make a turn these two wheels need to spin at different speeds, otherwise the vehicle will either continue in a straight line, or one of the wheels will loose traction and start slipping. The solution here is to use differential drive (sometimes referred to as skid steering), where the main controller (in this case an Arduino) knows which direction you are trying to turn, and increases / decreases the velocity setpoints for each wheel to achieve this
image source
For a more theoretical understanding of the different steering methods, here are some common kinematics equations.
Also, here is a differential steering Arduino Library for reference.
1 Like
Thank you for your answer.
For example, when controlling odrive (rear wheels are driven by odrive) like a car (front wheels are steering, rear wheels are driving), can’t it be done with velocity control?
If the front wheels are casters, that are free to allow movement in any direction, then you can steer using velocity control of the rear wheels, similar to the shopping cart video:
1 Like
Thank you for your reply.
The front wheels use free casters (rear wheels use Odrive),
For turning, I want to kick the ground directly with my feet and move sideways.
However, the rear wheel drive tries to return to the straight direction.
Is it possible to weaken the return control of the rear wheels?
Why didn’t you say so in the first post?
vel_integrator_gain essentially corrects the position over time. If you don’t want that, you need to set that value to 0. You may need to finetune vel_gain afterwards.
1 Like
thanks grahameth.
Adjust vel_integrator_gain, right?
odrv0.axis0.controller.config.vel_integrator_gain = 0.32
to
odrv0.axis0.controller.config.vel_integrator_gain = 0.1
With less force feedback, I could do what I wanted.
i am grateful to you
1 Like