Skip to content

Latest commit

 

History

History
77 lines (41 loc) · 1.84 KB

simulation-starter-script.md

File metadata and controls

77 lines (41 loc) · 1.84 KB

Creating simulation environment starter shell script

  1. Install screen and nano packages from terminal.

sudo apt-get install screen nano

  1. Change directory to simulation directory.

cd && cd ardu-sim/

  1. Create a shell script.

touch ardu-sim.sh

  1. Open the shell script in terminal using nano.

nano ardu-sim.sh

  1. Type shell shebang (specifies bash binary location) to the first line of this script.

#!/bin/bash

  1. 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"

  1. 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"

  1. Save the script by pressing Ctrl+X, y and ENTER.

  2. 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"
  1. Give permissions to the script.

sudo chmod +x ardu-sim.sh

  1. Run the script.

./ardu-sim.sh

  1. Open another terminal and connect to the vehicle using MAVProxy.

cd && cd ardu-sim/logs/

mavproxy.py --master 127.0.0.1:14550

  1. To retrieve simulation software binary session, do the below.

screen -r vehicle

  1. To exit the simulation software binary session, press Ctrl+a, d and ENTER.

  2. To retrieve MAVProxy session, do the below.

screen -r proxy

  1. To exit the MAVProxy session, press Ctrl+a, d and ENTER.

  2. To stop the simulation software binary session, do the below.

screen -S vehicle -X quit

  1. To stop the MAVProxy session, do the below.

screen -S proxy -X quit

  1. To stop both of them at the same time, do the below.

killall screen