SITL Gazebo RC/joystick inputs via ROS?

just a simple basic question:

Which ros-topic allows me to track the joystick(instead of real RC) in sitl-simulation?

mavros/rc/in is empty
mavros/rc/override is empty
mavros/hitl/rc_inputs is empty
mavros/manual_control/control is empty
mavors/manual_control/send is empty
… I’m out of ideas where to look now…

I mean I can fly my drone in sitl with a PS3 controller fine and somehow these data must be transferred via QGC to my ‘sitl’ px4… but for my ROS-systems all topics I looked in were empty.
I would just like to track these inputs as easy as real RC inputs to enable SITL testing and don’t use the real drone everytime…
Currently I work with the RC channels in my offboard control so I need some kind of help or a workaround - any help is appreciated.

I found this old post: SITL Remote Control simulation
But it seems outdated because normal RC control is working or do I need to think of sending my gamepad-inputs as custom ros message to mimic somekind of RC inputs, instead of working with the joystick control?

Kind regards

I don’t know how to do manual control using MAVROS (maybe @Jaeyoung-Lim knows) but you can also connect a joystick in QGC to fly in SITL.

1 Like

yeah I know - flying in Sitl is not a problem.

But I want to listen to the ‘Inputs’ of my joystick during my sitl-testing - like tracking my rc-inputs while flying a real drone.

In ROS I can echo the mavros/rc/in if I have a real world scenario, but during sitl I can not find any joystick inputs… I tried a workaround to start a joystick-node which will publish the inputs of the gamepad - but on the one side this is not so straight forward and on the other side I would like to work with my offboard control on the same topics/message_formats/etc as in a real world scenario.

It just feels like I’m missing something.

@hsu-ret Just curious, how are you connected to SITL with mavros when you are using the joystick through QGC. Do you still get valid topics out of mavros? (e.g. imu)

@Jaeyoung-LimAs far as I remember I followed px4-documentation with this:

I start the px4-sitl via the command
make px4_sitl gazebo

then I launch mavros
roslaunch mavros px4.launch
where my “fcu_url” is defaulted to “udp:://::14540@”

And of course I start QGC where I choosed to enable a PS3 controller via the joystick option.
(to disable the joystick mouse inputs I went with a ‘xinput disable’ terminal command)
The rostopics seems to be fine and the imu-topic is publishing valid data.
On top of that I use an ROS network wit two computers but all the stuff written above is launched on my ROS_Master (inclusive the sitl).

@hsu-ret Have you tried setting up the gcs_url on the mavros side?

@Jaeyoung-Lim hmm before I just had a an empty space as default and everything else runs fine.
I set it just to “udp:://@” but it changed nothing.

I tried a bunch of other gcs_url but it seems like its making everything worse - so I may need some help to set them up correctly…

@hsu-ret What do you mean by making everything worse?

@Jaeyoung-Lim So everything is getting worse means a lot of errors - which I haven’t recieved before.

The simulation documentation mentions the udp port 14550 is used for GCS communication, so I tried to set gcu_url to "udp:://::14550@” and "udp:://::14550@” if there might be something occupied, but both give me some errors in the px4_sitl terminal:
ERROR [mavlink] Local frame 18 not supported. Unable to publish pose and velocity

Sounds like you should try another frame.

@JulianOes Thx for your reply… But I seems setting up the correct gcu_url is the problem here - maybe because I still don’t know whats happening there with which ip and port…
I mean I didn’t used any special frame here, just plane sitl code (not the current one… so maybe I need to update the firmware) but there is nothing changed about the frames…

I just tried a workaround with a custom joystick node on my ros system and this works, so I think I’m fine and will just do some remapping to mavros/rc/in.

For anyone who needs this workaround look for the ROS Joystick Drivers Stack package (maybe delete some of the folders you don’t need, f.e. wiimote drivers because they might throw some errors out – could be a ros dist problem I use kinetic ) and run a
rosrun joy joy_node