Manually changing MAVLink system ID for PX4 SITL instances

Hello,I am running PX4 SITL instances on separate VMware nodes (Ubuntu) and trying to connect to both instances on the ground on another instance on the network. I am using either JMAVSim or Gazebo for simulation. The problem I am facing is that QGroundControl seems to treat both instances as the same drone, and I suspect that the system ID or something else should specify that they are different.I have tried the following methods to set unique system IDs for each PX4 SITL instance:

  1. Modifying the SYSID_THISMAV parameter in the ROMFS/px4fmu_common/init.d-posix/rcS file for each instance.
  2. Setting the MAV_SYS_ID environment variable before starting each PX4 SITL instance on the separate VMware nodes.
  3. Changing the Mavlink ID from paramteres also didnt work since it needed reboot and after reboot the SITL it still shows as 1

Unfortunately, none of these methods worked, and QGroundControl still shows the system ID and MAVLink ID as 1 for both instances.I would appreciate any help or suggestions on how to manually change the MAVLink system ID for PX4 SITL instances running on different systems so that QGroundControl can recognize them as separate drones.
Thank you!

Hi @alireza_ghaderi , SYS_MAV_ID is set here

using px4_instance.px4_instance is set by, who is generated by

and is filled with the number passed with the -i option on the startup script. See for example the multi-vehicle sim guide for Gazebo

1 Like

If I understand correct, this command should be executed in the terminal:
export px4_instance 2
make px4_sitl gazebo

I did this but still doesn’t work. still, in parameters, MAV_SYS_ID shows as 1.
is there sth wrong?
can we manually hard code and change it from the startup code? or can we change the parameters that are auto-being loaded?

and can a similar technique be used with jmavsim?

After trying different methods to set unique system IDs for each PX4 SITL instance on separate VMware nodes, the solution that worked was to modify the rcS file in the build version of the PX4-Autopilot directory. The file path is
, and the line to modify is
param set MAV_SYS_ID $((px4_instance+1))
. You can manually set a different system ID by changing the value of
MAV_SYS_ID to the desired number, for example,
param set MAV_SYS_ID 2

1 Like

Supposivly we can set use a mavlink message to change SYSID_THISMAV. I have not been successful that one either

you might be able to do that in a real drone. but in SITL I don’t think since you need to reboot the sitl after changing this parameter and next time it loads, it is gonna read from rcs file again in build directory