0
$\begingroup$

I have the following file /home/pi/mavproxy.sh which forwards the flight controller telemetry data using mavproxy to GCS(Ground Control Station)

#!/bin/bash
mavproxy.py --master=/home/pi/ttyUSB0 --baudrate 57600 --out=udp:192.168.10.12:14550

to automate this I write a linux services mavproxy.services

[Unit]
Description=Mavproxy service
After=network.target

[Service]
Type=simple
ExecStart=/home/pi/mavproxy.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

Now the problem is when I execute ./mavproxy.sh it work fine and forward telemetry data but when I reboot and do mavproxy.service Failed.

following is output of journalctl -u mavproxy.service which says KeyError: 'LOCALAPPDATA'

Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:   File "/usr/local/bin/mavproxy.py", line 1489, in <module>
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:     start_script = mp_util.dot_mavproxy("mavinit.scr")
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:   File "/usr/local/lib/python3.8/dist-packages/MAVProxy/modules/lib/mp_util.py", line 285, in dot_mavproxy
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:     dir = os.path.join(os.environ['LOCALAPPDATA'], '.mavproxy')
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:   File "/usr/lib/python3.8/os.py", line 675, in __getitem__
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]:     raise KeyError(key) from None
Mar 17 12:15:16 ubuntu mavproxy.sh[1076]: KeyError: 'LOCALAPPDATA'

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.