Hi, Although I can hold my own flying a drone using Taranis Radio, I must admit, I’m less than proficient at python programming. Although Caleb does an excellent job describing the code and presenting it in a way, this old dog can follow. It seems, I’m stuck.
I’m using the lauchSitl code as provided in the Drone Primer Videos, but it seems to either be missing a main () subroutine or perhaps I have fat fingered something wrong, either way, it will not execute and produce the error mentioned above.
See output
##################################################
gustavo@gustavo-ThinkPad-T430:~/courseRoot/dk$ clear
gustavo@gustavo-ThinkPad-T430:~/courseRoot/dk$ source dksitl/bin/activate
bash: dksitl/bin/activate: No such file or directory
gustavo@gustavo-ThinkPad-T430:~/courseRoot/dk$ cd …
gustavo@gustavo-ThinkPad-T430:~/courseRoot$ cd env
gustavo@gustavo-ThinkPad-T430:~/courseRoot/env$ source dksitl/bin/activate
(dksitl) gustavo@gustavo-ThinkPad-T430:~/courseRoot/env$ cd …/dk
(dksitl) gustavo@gustavo-ThinkPad-T430:~/courseRoot/dk$ launchSitl
os: linux, apm: copter, release: stable
SITL already Downloaded and Extracted.
Ready to boot.
Execute: /home/gustavo/.dronekit/sitl/copter-3.3/apm --home 44.5013,-88.0622,0,180 --model=quad -I 0
SITL-0> Started model quad at 44.5013,-88.0622,0,180 at speed 1.0
SITL-0.stderr> bind port 5760 for 0
Starting sketch ‘ArduCopter’
Serial port 0 on TCP port 5760
Starting SITL input
Waiting for connection …
/usr/bin/python: can’t find ‘main’ module in ‘’
(dksitl) gustavo@gustavo-ThinkPad-T430:~/courseRoot/dk$
The lauchSITL Code is:
###############################################
#!/bin/bash
kill -9 $(ps -eF | grep QG | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep ardu | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep mav | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep apm | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
##Launch a SITL instance
/usr/local/bin/dronekit-sitl copter --home 44.5013,-88.0622,0,180&
##~/courseRoot/apm/ardupilot/build/sitl/bin/arducopter -S -I0 --home=44.5013,-88.0622,0,180 --model “+” --speedup 1 --defaults /##home/~/courseRoot/apm/ardupilot/Tools/autotest/default_params/copter.parm &
sleep 5
######## Launch QGC
/usr/local/bin/QGC.AppImage 2>/dev/null&
sleep 5
##Start MAVProxy
screen -dm mavproxy.py --master=127.0.0.1:5760 --out=127.0.0.1:14550 --out=127.0.0.1:5762
##Launch the dronekit-python script
/usr/bin/python “$1” --connect 127.0.0.1:5762
function finish {
kill -9 $(ps -eF | grep QG | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep ardu | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep mav | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
kill -9 $(ps -eF | grep apm | awk -F ’ ’ ‘{print $2}’) > /dev/null 2<&1
}
trap finish EXIT