- Install screen and nano packages from terminal.
sudo apt-get install screen nano
- Change directory to simulation directory.
cd && cd ardu-sim/
- Create a shell script.
touch ardu-sim.sh
- Open the shell script in terminal using nano.
nano ardu-sim.sh
- Type shell shebang (specifies bash binary location) to the first line of this script.
#!/bin/bash
- Add simulation software binary and startup procedures to the script.
screen -S vehicle -d -m bash -c "./arducopter -S --model + --speedup 1 --defaults parameters/copter.parm -I0"
- Add MAVProxy startup procedures.
screen -S proxy -d -m bash -c "mavproxy.py --master tcp:127.0.0.1:5760 --out 127.0.0.1:14550"
-
Save the script by pressing Ctrl+X, y and ENTER.
-
Below is the final version of the ardu-sim.sh shell script.
#!/bin/bash
screen -S vehicle -d -m bash -c "./arducopter -S --model + --speedup 1 --defaults parameters/copter.parm -I0"
screen -S proxy -d -m bash -c "mavproxy.py --master tcp:127.0.0.1:5760 --out 127.0.0.1:14550"
- Give permissions to the script.
sudo chmod +x ardu-sim.sh
- Run the script.
./ardu-sim.sh
- Open another terminal and connect to the vehicle using MAVProxy.
cd && cd ardu-sim/logs/
mavproxy.py --master 127.0.0.1:14550
- To retrieve simulation software binary session, do the below.
screen -r vehicle
-
To exit the simulation software binary session, press Ctrl+a, d and ENTER.
-
To retrieve MAVProxy session, do the below.
screen -r proxy
-
To exit the MAVProxy session, press Ctrl+a, d and ENTER.
-
To stop the simulation software binary session, do the below.
screen -S vehicle -X quit
- To stop the MAVProxy session, do the below.
screen -S proxy -X quit
- To stop both of them at the same time, do the below.
killall screen