- Install screen and nano packages from terminal.
sudo apt-get install screen nano
- Install MAVProxy to the root user.
sudo python3 -m pip install MAVProxy
- To forward telemetry stream using MAVProxy:
mavproxy.py --master=X --out=Y
where X is source (your vehicle) and Y is the destination.
-
Run
sudo nano ~/startup.sh
. -
Add the following:
#!/bin/bash
export LOCALAPPDATA="LOCALAPPDATA"
screen -L -Logfile vehicle_proxy.log -S vehicle_proxy -d -m bash -c "mavproxy.py --force-connected --master=127.0.0.1:14550 --out=127.0.0.1:10000 --out=127.0.0.1:20000 --daemon"
-
To explain above command:
-L
log the screen session.-Logfile file_name.ext
specify the log file name with extension.-S screen_name
specify the session name. It makes easier to resume session likescreen -r screen_name
.-d
used to start the screen session as detached.-m executable_name -c "commands"
used to run an executable with arguments.
-
Save the script by pressing Ctrl+X, y and ENTER.
-
Give permissions to the script.
sudo chmod +x ~/startup.sh
- Run the following and copy the path:
echo $(pwd)"/startup.sh"
- To run a command at start up:
- Run
sudo nano /etc/rc.local
. - Paste your copied text before
exit 0
like the following:
- Run
sh /home/m/startup.sh &
where /home/m/startup.sh
is my copied full path for example.
- This is my complete
rc.local
script:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh /home/m/startup.sh &
exit 0
- Save the script by pressing Ctrl+X, y and ENTER.
- Make the
rc.local
executable:sudo chmod +x /etc/rc.local
- Enable the service using
sudo systemctl enable rc-local.service
. - Start the service using
sudo systemctl start rc-local.service
orreboot
. - Monitor the service using
sudo systemctl status rc-local.service
. - After this operation, if you don't want to start this script to start every boot, put
#
beforesh /home/m/startup.sh &
. So therc.local
will be:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# sh /home/m/startup.sh &
exit 0