Here are details on the ODrive setup and some Cube Orange/Ardurover setup for it.
Initial ODrive setup was done using the Hoverboard guide on the Odrive Robitics site:
https://docs.odriverobotics.com/v/0.5.4/hoverboard.html#hoverboard-motor-configuration
Cube Orange connections to ODrive
(Signal only, ground connection from shared power only to prevent ground loop)
Cube Orange Odrive 3.6 Wheel Encoder
(Programmed as inputs)
M1 (Left) 5V Red
M1 (Left) A Yellow 0.1uF to GND
Aux Out 4-------------M1 (Left) B Blue 0.1uF to GND
Aux Out 3-------------M1 (Left) Z Green 0.1uF to GND
M1 (Left) GND Black
M0 (Right) 5V Red
M0 (Right) A Yellow 0.1uF to GND
Aux Out 5-------------M0 (Right) B Blue 0.1uF to GND
Aux Out 6-------------M0 (Right) Z Green 0.1uF to GND
M0 (Right) GND Black
Main Out 1 GPIO 4 PWM Left Throttle
Main Out 3 GPIO 3 PWM Right Throttle
Encoder setup in Ardupilot:
Connect motor encoder’s A and B outputs to the autopilot (i.e. Pixhawk’s) AUX OUT 3,4,5 and 6 pins.
Normally 3,4 should be used for the left motor’s encoder, 5,6 for the right’s.
Pixhawk has 6 AUX Ports (AUX1-AUX6, referred to as SERVO9-SERVO14 in Mission Planner)
To use Aux Out 3,4,5,6 to be used as inputs
set SERVO11_FUNCTION, SERVO12_FUNCTION, SERVO13_FUNCTION, SERVO14_FUNCTION as -1
Need to reboot after enabling GPIO’s before WENC2 will be available
set WENC_TYPE and WENC2_TYPE to 1 to enable reading from two wheel encoders
set WENC_CPR and WENC2_CPR to the counts-per-revolution of the encoder. This is the number of “pings” the encoder will produce for each full revolution of the wheel
set WENC_RADIUS and WENC2_RADIUS to the radius (in meters) of each wheel (i.e. 5cm radius would be 0.05)
set WENC_POS_X and WENC_POS_Y to define the first wheel’s distance from COG
set WENC2_POS_X and WENC2_POS_Y to define the second wheel’s distance from the autopilot or COG
disable relays by setting RELAY_PIN and RELAY_PIN2 to -1 (set by default)
Found per Yuri_Rage, Origin is center of drive axle so antenna and encoder offsets are relative to that.
WENC = Left wheel, 0.266M left, 0.330M behind
WENC2 = Right wheel, 0.266M right, 0.330M behind
WENC_PINA = 53
WENC_PINB = 52
WENC2_PINA = 55
WENC2_PINB = 54
EKF Config:
set AHRS_EKF_TYPE to 3 (means use EKF3) default
set EK2_ENABLE to 0 (disable EKF2) default
set EK3_ENABLE to 1 (enable EKF3) default
set EK3_SRC1_VELXY to 7 (“WheelEncoder”) was GPS