How can I control multi vehicle with joystick?

I’m trying to control three vehicle wht one joystick at the same time.

  1. Activate the joystick by connecting each of the three aircraft to QGC.
  2. Connect all three gases to qgc via udp.
  3. At this time, the joystick only communicates with the last connected aircraft.
  4. Therefore, even if I select a different aircraft, the joystick cannot be connected.
  5. To connect, I need to activate the joystick again, and the previously connected joystick is disconnected.

In order to control 3 aircraft with one joystick, I believe that the commands of the joystick should be transmitted only to the currently selected aircraft, but the connection to the other aircraft should not be disconnected.

Doesn’t the current QGC support this? Or is it supposed to be supported but there is a bug?

I am fairly certain that the feature you want is not supported by QGC.

I would expect the GCS to send MANUAL_CONTROL messages for the joystick to the current active vehicle at the point that the joystick was connected. I would not expect the target to change after that unless explicitly disconnected.

I’m not sure how you would achieve multi-vehicle joystick control. Probably you would have to write your own code to integrate with a joystick and send MANUAL_CONTROL with the target field set to 0 (broadcast). Even that might not work if the vehicles only accept directed messages (and not broadcast MANUAL_CONTROL messages).

I need to accomplish this as well. I’m planning to do so using ROS2 nodes. A node on the groundstation that publishes the current state of the joystick to a node on each vehicle node. The vehicle node would then publish directly to the necessary uorb topics.

I’m a little confused about what I’d have to publish to PX4 via uorb though. The stick inputs and buttons bitmask seem simple enough in the manual_control_setpoint topic, but I don’t know how I’m supposed to get PX4 to know what buttons should map to what action. Is there a PX4 parameter I can update or a different topic I can publish?

Also if I’m sending button input from the joystick do I need to publish to the manual_control_switches topic? Or is that just for internal use after the rc/joystick data has been parsed

See Manual Control (Joystick) Protocol · MAVLink Developer Guide

On PX4 the selected buttons in the MANUAL_CONTROL have particular meanings. So QGC (in MAVLink) lets you say “I want to do kill switch” (say) and QGC sets that pattern in the message when it is sent.

However if you’re able to talk to ROS topics you have lots of options - you can do your own mapping of particular presses to vehicle commands (say).

That’s probably enough to get you started.