Hi, i need some help please.
I’m trying to simulate 2 drones as described in the the Ardupilot documentation/simulation http://ardupilot.org/dev/docs/sitl-with-airsim.html . I followed the steps and press play on Airsim, then executed “follow-copter.sh” from “~/ardupilot” directory but it isn’t spawning the 2 drones in Airsim. Everithing seems fine, the waf build is ok and the UDP ports but i get this UDP multicast error and i don’t know how to solve it. (IP shouldn’t be 127.0.0.1??)
I think the problem is that i’m running on Windows10/Cygwin and “follow-copter.sh” was writen for linux (the next step in the documentation is to run “mavproxy.py” to attach MAVproxy but i can`t find this script anywhere in Cygwin). If this is the case, someone should especify this issue in the documentation to not confuse Windows users.
This is what i get when i run $ libraries/SITL/examples/Airsim/follow-copter.sh 127.0.0.1 from ~/ardupilot
Setting top to : /home/Jose Peck/ardupilot
Setting out to : /home/Jose Peck/ardupilot/build
Autoconfiguration : enabled
Setting board to : sitl
Using toolchain : native
Checking for ‘g++’ (C++ compiler) : /usr/bin/g++
Checking for ‘gcc’ (C compiler) : /usr/bin/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for feenableexcept : no
Checking for HAVE_CMATH_ISFINITE : yes
Checking for HAVE_CMATH_ISINF : yes
Checking for HAVE_CMATH_ISNAN : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : yes
Checking for header endian.h : yes
Checking for header byteswap.h : yes
Checking for HAVE_MEMRCHR : no
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.16
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 2.7.16
Source is git repository : yes
Update submodules : yes
Checking for program ‘git’ : /usr/bin/git
Checking for program ‘size’ : /usr/bin/size
Benchmarks : disabled
Unit tests : enabled
Scripting : enabled
Scripting runtime checks : enabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (14.887s)
Waf: Entering directory /home/Jose Peck/ardupilot/build/sitl' Embedding file sandbox.lua:libraries/AP_Scripting/scripts/sandbox.lua Waf: Leaving directory
/home/Jose Peck/ardupilot/build/sitl’
BUILD SUMMARY
Build directory: /home/Jose Peck/ardupilot/build/sitl
Target Text Data BSS Total
bin/arducopter 2642573 82868 416 2725857
Build commands will be stored in build/sitl/compile_commands.json
‘copter’ finished successfully (44.741s)
Starting copter 1
Starting SITL Airsim
Bind SITL sensor input at 127.0.0.1:9003
AirSim control interface set to 127.0.0.1:9002
Starting sketch ‘ArduCopter’
Starting SITL input
Using Irlock at port : 9005
UDP connection 127.0.0.1:14550
Loaded defaults from /home/copter.parm,/home/quadX.parm
UDP multicast connection 239.255.145.50:14550
multicast bind failed on port 14550 - Cannot assign requested address
~/ardupilot/copter1 ~/ardupilot
~/ardupilot
Starting SITL Airsim
Bind SITL sensor input at 127.0.0.1:9013
AirSim control interface set to 127.0.0.1:9012
Starting sketch ‘ArduCopter’
Starting SITL input
Using Irlock at port : 9015
bind port 5770 for 0
Serial port 0 on TCP port 5770
Loaded defaults from /home/copter.parm,/home/quadX.parm,follow.parm
UDP multicast connection 239.255.145.50:14550
multicast bind failed on port 14550 - Cannot assign requested address
This is my Airsim settings.json
{
“SettingsVersion”: 1.2,
“LocalHostIp”: “127.0.0.1”,
“SimMode”: “Multirotor”,
“OriginGeopoint”: {
“Latitude”: -35.363261,
“Longitude”: 149.165230,
“Altitude”: 583
},
“Vehicles”: {
“Copter1”: {
“VehicleType”: “ArduCopter”,
“UseSerial”: false,
“DefaultVehicleState”: “Disarmed”,
“UdpIp”: “127.0.0.1”,
“UdpPort”: 9003,
“SitlPort”: 9002
},
“Copter2”: {
“VehicleType”: “ArduCopter”,
“UseSerial”: false,
“DefaultVehicleState”: “Disarmed”,
“UdpIp”: “127.0.0.1”,
“UdpPort”: 9013,
“SitlPort”: 9012,
“X”: 0,
“Y”: 3,
“Z”: 0
}
}
}
And this is my version of the follow-copter.sh. i made some path modifications because i had a problem reading into a directory with whitespace.
#!/bin/bash
assume we start the script from the root directory
ROOTDIR="$PWD"
COPTER=ardupilot/build/sitl/bin/arducopter.exe
GCS_IP=$1
BASE_DEFAULTS="/home/copter.parm,/home/quadX.parm"
[ -x “$COPTER” ] || {
./waf configure --board sitl
./waf copter
}
start up main rover in the current directory
/home/‘Jose Peck’/ardupilot/build/sitl/bin/arducopter.exe --model airsim-copter --uartA udpclient:$GCS_IP --uartC mcast: --defaults $BASE_DEFAULTS &
now start another copter to follow the first, using
a separate directory to keep the eeprom.bin and logs separate
for increasing the number of copters, change the number in seq
for i in $(seq 1); do
echo “Starting copter $i”
mkdir -p copter$i
SYSID=$(expr $i + 1)
FOLL_SYSID=$(expr $SYSID - 1)
# create default parameter file for the follower
cat <<EOF > copter$i/follow.parm
SYSID_THISMAV $SYSID
FOLL_ENABLE 1
FOLL_OFS_X -5
FOLL_OFS_TYPE 1
FOLL_SYSID $FOLL_SYSID
FOLL_DIST_MAX 1000
EOF
pushd copter$i
/home/‘Jose Peck’/ardupilot/build/sitl/bin/arducopter.exe --model airsim-copter --uartA tcp:0 --uartC mcast: --instance $i --defaults $BASE_DEFAULTS,follow.parm &
popd
done
wait