ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Mavros multi-vehicle simulation

asked 2015-05-01 02:17:11 -0500

molinsp gravatar image

Hello,

I'm trying to setup a simulation environment for a multi-vehicle system using mavros and I have come up with some issues:

My idea is to run multiple APM SITL (Ardu Copter) instances, each of those connected to a mavros node via TCP (to simulate a serial connection of an onboard computer) and use UDP Mavlink bridge to connect all vehicles to QGroundControl.

1) APM_SITL <--(TCP:5760)--> mavros <--(UDP:14550/1)--> QGroundControl

I modified sim_vehicle.sh so that it doesn't directly launch mavproxy. Then I connect mavros via serial and use gcs_url to create the mavlink bridge to QGroundControl (listening on UDP 14550):

roslaunch mavros apm2.launch fcu_url:=tcp://localhost:5760 gcs_url:=udp://localhost:14551@localhost:14550

Doing this I'm able to see the vehicle in QGroundControl but for some reason the connection doesn't seem to work properly and I see no changes in the system when I run a mavros program.

When I do not disable mavproxy (that is, I run each SITL instance with mavproxy connected to TCP 5760) and connect QGroundControl via UDP, it works fine. But if I try to connect mavros via TCP (to one of the two other open serial ports 5762 or 5763) I get this same issue: https://groups.google.com/forum/#!topic/drones-discuss/I8sGdE-g8I0

2) mavros <--(TCP:5762)--> APM_SITL <--(TCP:5760)--> mavproxy <--(UDP:14550/1)--> QGroundControl

Another issue I'm encountering is the use of different system ID's. I can change the parameter in APM (SYSID_THISMAV) but don't really know how to use tgt_system and tgt_component

Any help is highly appreciated!

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2015-05-01 08:39:24 -0500

vooon gravatar image

Mavros not desined for multiple drone connections. Start new instance for each drone.

Also you should preconfigure different system id on each drone. E.g. connect to each and change SYSID_THISMAV. Then use same number in tgt_system.

edit flag offensive delete link more

Comments

Yes this is clear to me. My question is wether my approach of connecting mavros via TCP (as in 1) and use mavlink bridge is right. It is not even working now for 1 uav and I don't know if this is because I'm using gcs_url wrong or because ArduCopter SITL require mavproxy for some reason.

molinsp gravatar image molinsp  ( 2015-05-01 09:29:44 -0500 )edit

Tcp url is ok, perhaps you may not use gcs url, because mavproxy by default starts one. But check tcp port, 5760 - serial1 used by mavproxy, try 5761/2.

vooon gravatar image vooon  ( 2015-05-01 09:53:16 -0500 )edit

I tried using 5762/3 (which are both open) but I get the same issue than here: https://groups.google.com/forum/#!top... . It continuously switches from stabilize to "Mode Mode(0x000000c0)". Is this an issue with mavros?

molinsp gravatar image molinsp  ( 2015-05-01 11:07:44 -0500 )edit

Strange, but it more related to firmware. Mode stringify may fallback to MODE(hex) or CMODE(num). Usually mode() when there no custom mode bit.

vooon gravatar image vooon  ( 2015-05-01 11:50:14 -0500 )edit

Also you may try connect to mavproxy udp ports.

vooon gravatar image vooon  ( 2015-05-01 11:51:31 -0500 )edit

Hi, I am having the same problem, mavros continuously sends Stabilize and "Mode Mode(0x000000c0)". Did anyone find a solution?

Thomas. gravatar image Thomas.  ( 2015-05-08 19:59:57 -0500 )edit

@Thomas what firmware you used? What diagnostics say?

Mode(0xc0) → MAV_MODE_FLAG: SAFETY_ARMED | MANUAL_INPUT_ENABLED

No CUSTOM_MODE_ENABLED => only MODE(hex).

vooon gravatar image vooon  ( 2015-05-09 04:45:26 -0500 )edit

Hi vooon, I started roscore, then simulator with: sim_vehicle.sh --console --map --aircraft test Then I used mavros to connect to the simulator: "roslaunch mavros apm.launch fcu_url:=udp://127.0.0.1:5762 gcs_url:=udp://@" "rostopic echo /mavros/imu/data_raw" works How can I get info you asked for?

Thomas. gravatar image Thomas.  ( 2015-05-10 18:11:29 -0500 )edit
0

answered 2015-10-17 15:35:28 -0500

thanks a lot for your post. Could you please share how you did multi-vehicle simulation representing the vehicles on the same map and how you actually made the changes in the SYSID_THISMAV. Thanks a lot for your help.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2015-05-01 02:17:11 -0500

Seen: 3,315 times

Last updated: Oct 17 '15