Using Pymavlink + ArduSub + ros_playground

Hi there,

At this point, I’m able to run sim_vehicle.py (from Ardupilot) and launch Gazebo_sitl file to move around the bluerov in the simulation environment.
Using the “mavros/rc/override” topic, I can send low level thruster commands as well.
My goal is to have rostopic “mavros/rc/override” and not the other ones, I think this can be achieved with a custom pymavlink script,

This is the custom script that I have till now, I’m missing out something fundamental here, but don’t know what. Please help me out.

#!/usr/bin/env python

import rospy
from mavros_msgs.msg import OverrideRCIn
from pymavlink import mavutil

master = None

def rc_callback(data):
	global master
	pwm = [data.channels[0], data.channels[1], data.channels[2], data.channels[3], data.channels[4], data.channels[5], data.channels[6], data.channels[7]] 
	master.mav.rc_channels_override_send(master.target_system, master.target_component, *pwm)

if __name__ == '__main__':

	rospy.init_node('custom_mavlink_interface')
	rospy.Subscriber("mavros/rc/override", OverrideRCIn, rc_callback)

	master = mavutil.mavlink_connection('tcp:127.0.0.1:5760')
        master.wait_heartbeat()
        print("connected")
	rospy.spin()

Hi @DJ95,

I’m not sure if this is the problem, but you are missing a ‘/’ in your topic name, it should be: /mavros/rc/override