I have a Sawppy rover which I’m in the process of setting up with Ardupilot. The frame has six wheels with independent drives, four of which steer. I’ve created a Lua script for the motor control and that is working well in simulation.
My question is how to best signal to Ardupilot that this frame supports pivot turns?
From what I understand skid-steering is enabled by assigning two of the SERVOX_FUNCTIONS to 73 and 74 which is tested for in
AP_MotorsUGV::have_skid_steering. In my case the SERVOX_FUNCTIONS are set to the scripting values 94,…,103 so the controller code doesn’t know that the vehicle can turn in-place.
The Lua script uses the normalised control outputs CONTROL_OUTPUT_YAW and CONTROL_OUTPUT_THROTTLE with a mapping that the turning radius varies from [+inf, 0] as CONTROL_OUTPUT_YAW varies from [0, 1] (and reverse for negative steering). The throttle is managed independently, so the angular speed of the in-place turn varies from 0 to the max yaw rate.
I have found a work-around that only requires changes to the parameters and script:
- Set two additional servo functions to throttle L and throttle R which instructs AP to apply pivot-turns. These servo outputs will be ignored by the script:
- SERVO11_FUNCTION 73
- SERVO12_FUNCTION 74
- Modify the script so that when the steering rate is either 1 or -1 a pivot turn will be executed. The control output sets the throttle to 0 on a pivot turn, so we override this to a constant throttle value for pivot turns (say 50% throttle).
I’ve attached the script in case anyone wants to adapt it for their own Rover. I’ll upload the Gazebo model and script to github in due course.
sawppy_motor_driver.lua (10.4 KB)
Hi Rhys, im just starting printing parts for a Sawppy in Canada. Im also thinking of using ardurover from previous quadcopter experience, although this was many years ago. Curious as to your setup - receiver, serial servos or motors etc. Any chance of a few images of the internals?. Help always appreciated. Steve
Hi Steve, I built my rover following the standard build instructions - so it uses LX16A serial servos and a LewanSoul BusLinker debug board. I originally had the rover running ROS on a RPi4 using this code: https://github.com/srmainwaring/curio. It works well indoors and when equipped with a LIDAR can run the standard navigation / SLAM packages.
When running ArduPilot I use a Mateksys H743-WING and M8Q-CAN GPS module (you need an autopilot with enough flash to run scripting for the custom mixer). For telemetry I’ve used a cheap generic SiK radio which is good enough for the back garden. The original RC setup used a Graupner Falcon 12 receiver but have recently shifted to a FrSky RX6R to get the benefit of the passthrough telemetry and nice OpenTX telemetry script put together by yaapu (Yaapu Frsky Telemetry Script).
If you are using LX16A servos you need another script for the serial driver:
The protocol is similar (but not compatible) to that used for Dynamixel serials servos which are supported natively in ArduPilot.
Some builders have used brushed motors and motor controllers instead of servos to drive the wheels - that could be a good setup as I’ve found the bus-linker board to be the weak point in the hardware having experienced a couple of failures. One arrangement would be to use the autopilot PWM output for the drive motor controllers while still using servos for steering. In ArduPilot I have not yet integrated wheel odometry (supported on ROS), but I’m not convinced there’s a benefit for outdoor use.
My rover is in it’s ROS config at the moment, but when I’ve got the autopilot wired back in I’ll get some pictures and document the hardware and full AP parameter set up.