Hi! I’m trying to do a multi-copter simulation. I’ve got much of it working but want to visualize the different instances by having each output a stream to Mission Planner. Before it gets to Mission Planner I’m forwarding the various streams to a python script which outputs all messages out on the same port which MP listens on.
Each SITL instance has it’s own SYSID_THISMAV set to something unique, at least according to dronekit (1,2,3…). However, in Mission Planner it only renders one copter with ‘1’ written over it at a time, flashing back and forth between two copters in different positions.
I believe this has to do with the system ID somehow. Further evidence is that I can manually receive the mavlink messages from a system where SYSID has been set to say 20 from 1 (given in the default parameters file), and the message.get_srcSystem() header field remains 1 even after changing SYSID_THISMAV, so I can see why ArduCopter is might be getting confused. Is the header field for srcSystems not the same as the SYSID_THISMAV parameter? I can reproduce this with a pymavlink connection reading out the srcSystem field of messages passed form a mavproxy ground station to a ArduCopter instance.
Further, the srcSystem in the mavlink message header changes if I change the SYSID_THISMAV in the default_params file… I may change this a little later in execution and suspect I can get the visualization to work if I can force the srcSystem to update!
Hi,
I am running today’s latest stable version of adrucopter. I have a GCS and a drone with a CC. I can’t seem to get my pymavlink code to retrieve the correct SYSID. I have them connected through mavproxy. In particular on the drone I run:
mavproxy.exe --mastter=COM3 --out=udp:127.0.0.1:14551 --console --map
and on the GCS I run:
mavproxy.exe --out=udp:127.0.0.1:14551 --console --map
My simple pymavlink code shown below returns:
Connected to MAVLink system with ID: 1
System ID does not match SYSID_THISMAV
on the drone param show SYSID_THISMAV returns 2
on the GCS param show SYSID_THISMAV returns 1
It seem as if its not getting the SYSID from the drone?
Any help would be useful as I need to use this to get my 2-drone system programmed.
thank you.
***** the code ******
from pymavlink import mavutil
Wait for the heartbeat message to ensure the connection is established
msg = master.wait_heartbeat()
Print information about the connected drone
if msg is not None:
system_id = msg.get_srcSystem()
print(f"Connected to MAVLink system with ID: {system_id}")
# Check if system ID matches SYSID_THISMAV
sysid_thismav = 2 # Set to the correct value of SYSID_THISMAV
if system_id == sysid_thismav:
print("System ID matches SYSID_THISMAV")
else:
print("System ID does not match SYSID_THISMAV")
else:
print(“Did not receive heartbeat message. Check your connection.”)