Greetings everyone!
I’m trying to make a rover-type robotic platform move autonomously using a Python program.
My setup is as it follows:
- transmitter: Radiomaster TX16S with RFD TX-MOD v.2
- receiver: RFD 900ux 2.0
- a rover with 2 stepper motors
- QGroundCotrol for mission command
- Raspberry Pi 5 for automatization
At the moment, I can control the platform in MANUAL mode using the RadioMaster TX16S remote control. Thanks to the Wi-Fi module built into the TX-MOD, I can connect via UDP to the QGC and see the telemetry data. I made a Python program to test the Pixhawk 4 - RPi connection and move the platform for 5 seconds. I will leave the code I used at the end of this post. I used pymavlink for this.
The main problem that arises is that when the remote control is turned on, the rover no longer receives movement commands, but only arms/disarms. If I turn off the remote control, the program arms the pilot, moves the rover and then disarms the pilot.
The main idea is that I would like to have both options simultaneously. When I run the program on the RPi, it should take over the rover command, execute the movements and then return to manual mode with control from the remote control.
I also tried with OFFBOARD mode, but in that case it doesn’t go into OFFBOARD mode, because the offboard signal is not detected.
I would like help from someone more experienced in this niche or some advice on what I’m doing/not doing right.
Thanks a lot in advance!
P.S. : To understand a little bit of the logic behind the code, I need to mention something else. RadioMaster sends a PPM signal via External RF to the RFD900ux and further to the pilot via the PPM RC port, and further the pilot outputs the signal via the S-BUS out port to the rover’s CPU (it only accepts S-BUS or I-BUS), thus producing the movement. Link for more detailed description: S-BUS OUT port on Pixhawk 4
from pymavlink import mavutil
import timeMAVLink connection
master = mavutil.mavlink_connection(‘/dev/ttyACM0’, baud=57600)
master.wait_heartbeat()
print(“Connected to the system”)#Arming
master.mav.command_long_send(
master.target_system, master.target_component,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,
0, 1, 0, 0, 0, 0, 0, 0)
print(“Arm”)
time.sleep(2)#Send PWM directly to the servos (1000-2000us)
for i in range(50):
master.mav.servo_output_raw_send(
0, 0,
1500, # MAIN1 - Neutral steering
0, # MAIN2 - Disabled
1600, # MAIN3 - Throttle slightly forward
0, 0, 0, 0, 0
)
print(“PWM command sent”)
time.sleep(0.1)#Automatic disarming after test
master.mav.command_long_send(
master.target_system, master.target_component,
mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,
0, 0, 0, 0, 0, 0, 0, 0)
print(“Disarm”)