Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with simulating multiple vehicles in ArduPilot SITL through QGroundControl #47

Open
jgbjcn opened this issue Apr 28, 2023 · 0 comments

Comments

@jgbjcn
Copy link

jgbjcn commented Apr 28, 2023

I am new to everything in ArduPilot and unmanned vehicle control in general. I am hoping someone here can shed some light on what I am struggling with. Thank you in advance!

By referring to the instructions at https://github.com/Intelligent-Quads/iq_tutorials/blob/master/docs/swarming_ardupilot.md, I wanted to simulate multiple vehicles with ArduPilot SITL and QGroundControl, either with MAVProxy or not (I am unsure the benefits of including or excluding MAVProxy in this architecture), but I have always failing to achieve it. Importantly, I do not yet want to involve Gazebo at this time. Specifically, what I have done is as follows. I am running QGroundControl 4.2.6, MAVProxy 1.8.59 on Ubuntu 18.04.6 LTS.

(1) In the file /ardupilot/Tools/autotest/pysim/vehicleinfo.py, I added the following texts under the “Rover” section

            "swarm-rover-1": {
                "waf_target": "bin/ardurover",
                "default_params_filename": ["default_params/rover.parm",
                                            "default_params/swarm-rover-1.parm"]
            },

            "swarm-rover-2": {
                "waf_target": "bin/ardurover",
                "default_params_filename": ["default_params/rover.parm",
                                            "default_params/swarm-rover-2.parm"]
            },

            "swarm-rover-3": {
                "waf_target": "bin/ardurover",
                "default_params_filename": ["default_params/rover.parm",
                                            "default_params/swarm-rover-3.parm"]
            },

(2) In the folder /ardupilot/Tools/autotest/default_params, I added the files swarm-rover-1.parm, swarm-rover-2.parm, and swarm-rover-3.parm. Those files essentially have the same content, except that the SYSID_THISMAV is assigned to 1, 2, or 3 accordingly. Please see an example content as follows.

ARSPD_PIN 1
ARSPD_BUS 2
ATC_SPEED_P 0.1
ATC_STR_RAT_FF 0.75
BATT_MONITOR 4
CRUISE_SPEED 5
CRUISE_THROTTLE 30
INS_ACC2OFFS_X 0.001
INS_ACC2OFFS_Y 0.001
INS_ACC2OFFS_Z 0.001
INS_ACC2SCAL_X 1.001
INS_ACC2SCAL_Y 1.001
INS_ACC2SCAL_Z 1.001
INS_ACCOFFS_X 0.001
INS_ACCOFFS_Y 0.001
INS_ACCOFFS_Z 0.001
INS_ACCSCAL_X 1.001
INS_ACCSCAL_Y 1.001
INS_ACCSCAL_Z 1.001
MODE3 11
MODE4 10
MODE5 2
RC1_MAX 2000
RC1_MIN 1000
RC3_MAX 2000
RC3_MIN 1000
RELAY_PIN 1
RELAY_PIN2 2
SERVO1_MIN 1000
SERVO1_MAX 2000
SERVO3_MAX 2000
SERVO3_MIN 1000
# for brushed control
SIM_PIN_MASK 127
WP_RADIUS 3
WP_SPEED 5
INS_LOG_BAT_MASK 127
SYSID_THISMAV 1

(3) Now, in QGroundControl > Application Settings > Comm Links, I added the following links.
Screenshot from 2023-04-27 17-49-30

(4) Then, when I run the command sim_vehicle.py -v Rover -f swarm-rover-1 --console -I0 --out=tcpin:0.0.0.0:8100 --console -w in a new terminal window, I can already receive the following error, without even trying to start the second vehicle in another terminal. Even when I select the created link "drone1" in QGroundControl > Application Settings and press the Connect button, it does not help.
In addition, I found that, once the Connect button is pressed, there will be no effect of pressing the Disconnect button.

SIM_VEHICLE: "mavproxy.py" "--out" "127.0.0.1:14550" "--out" "127.0.0.1:14551" "--master" "tcp:127.0.0.1:5760" "--sitl" "127.0.0.1:5501" "--out" "tcpin:0.0.0.0:8100" "--console"
Connect tcp:127.0.0.1:5760 source_system=255
[Errno 111] Connection refused sleeping
[Errno 111] Connection refused sleeping
[Errno 111] Connection refused sleeping
[Errno 111] Connection refused sleeping
Failed to connect to tcp:127.0.0.1:5760 : [Errno 111] Connection refused
SIM_VEHICLE: MAVProxy exited
SIM_VEHICLE: Killing tasks

Really, with very limited knowledge about network communication, I don’t really understand the purpose of the argument --out=tcpin:0.0.0.0:8100 in this case. I know, by default, MAVProxy is set to send and receive message to and from ArduPilot SILT on 127.0.0.1:5760, and MAVProxy is set to forward message out to QGroundControl on 127.0.0.1:14551 (or 127.0.0.1:14550? I am not sure). So, here, the network address 0.0.0.0:8100 is used by QGroundControl to send feedback messages to MAVProxy, as that is a TCP IN address for MAVProxy? Following this logic, the Comm Link section in QGroundControl is only used to define the port for outgoing messages from QGroundControl? Where is the port for incoming messages defined for QGroundControl? Where are those default network addresses defined for MAVProxy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant