How to obtain the correct PX4 instance or target_system in Multi-Vehicle Simulation with ROS 2

Hello everyone,

I’m currently working on multi-vehicle simulation using PX4 SITL, ROS 2, and Gazebo. I followed the instructions from ROS 2 Offboard Control Example and Multiple Vehicles with ROS 2 and Gazebo, but I’m facing an issue that I haven’t been able to resolve.
Here’s what I did:

After starting XRCE-DDS, I launched one instance of PX4 using the following command:
PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 1
Then, in another terminal, I ran:
ros2 run px4_ros_com offboard_control
However, neither Gazebo nor QGroundControl showed any response.

Interestingly, when I changed -i 1 to -i 0 in the PX4 launch command:
PX4_SYS_AUTOSTART=4001 PX4_SIM_MODEL=gz_x500 ./build/px4_sitl_default/bin/px4 -i 0
everything worked as expected — the offboard control example ran normally, and the vehicle appeared both in QGC and Gazebo.

I also tried modifying the target_system parameter in the ROS 2 node from 0 to 2 while using -i 1 , hoping to match the correct system ID, but none of the values had any effect.

So my question is:
Is there a known way to correctly obtain or configure the PX4 instance or target_system value for multi-vehicle simulations beyond instance 0?

Has anyone encountered this issue before? Any help or guidance would be greatly appreciated!

Thank you in advance!