Hi all, I’m doing some basic robustness (disconnect/reconnect) checks and I’ve found an unexpected issue. I assume I’m missing something simple here???
The setup is:
Pixhawk autopilot with serial connection to Raspberry Pi, connected to local network.
SSH into Raspberry Pi from PC on local network to start MAVProxy using command:
mavproxy.py --master=/dev/ttyAMA0 --out 192.168.0.[nn]:14550
Now in this state I am able to run MAVProxy commands in the shell (great) and I can open Mission Planner on the computer at the target IP address and connect to the Pixhawk via UDP (awesome).
All good, all great.
Robustness checks: I can disconnect the serial connection, and any of the network connections, and when reconnected the Mission Planner session automatically continues on as if nothing happened.
However, if I kill the SSH session - noting that the UDP stream continues to work (which is great) - I can’t find my way back in.
I can open a new SSH session, and I can see that the mavproxy process is running. However, now if I want to run MAVProxy commands in the shell, I need to start a new MAVProxy session. This both slows down the UDP session, and produces gobbledegook in my shell.
I hope/assume that it’s possible to re-enter an existing, running MAVProxy session. Perhaps someone can tell me what I’m missing?
Many thanks in advance.
First, install screen if not installed on your raspberry pi:
sudo apt-get install screen
Start the mavproxy like:
screen -S telemetry_proxy -d -m bash -c "mavproxy.py --master=/dev/ttyAMA0 --out 192.168.0.[nn]:14550"
This will start mavproxy in detached mode.
If you want to go in to the screen session:
screen -r telemetry_proxy
If you want to exit from the screen without killing it:
Press Ctrl + a, and then press d.
This will detach the screen from your terminal.
You can safely disconnect from the ssh connection.
Woah, it’s like magic! Thanks heaps Mustafa.
Interestingly, that full command did not appear to do anything, and
screen -r telemetry_proxy returned an error to the effect that there is no screen to be resumed. ----- update – this was due to a typo, the command actually works. ----- Thankfully there’s heaps of info on using screen, and a more basic usage (start a screen, then enter the command) is just fine for my needs.
Probably inside the screen, it can’t find the mavproxy command.
Did you install the mavproxy with sudo or not?
You can trace the error by typing screen and pressing enter on the terminal.
Now you are in a nameless screen session.
Then you can start your mavproxy instance, and can see the error.
BTW you can also find the direct path of your installed mavproxy.py like
/usr/local/bin/mavproxy.py and run the instance like it.
It is just a path issue.
Ah, yeah wouldn’t you know it turned out to be operator error I had typed:
screen -S telemetry_proxy -d -m bash -c "mavproxy.py --master=/dec/ttyAMA0 --out 192.168.0.22:14550"
screen -S telemetry_proxy -d -m bash -c "mavproxy.py --master=/dev/ttyAMA0 --out 192.168.0.22:14550"
Thanks again, screen does exactly what I was hoping for.
mavproxy is a bit heavy for a RPi
Maybe mavlink-router with a system service with autostart on boot is a better option for your usecase
you can still send mavlink commands from missionplanner or by running mavproxy on your PC (connecting to mavlink-router on the RPi)
Noted thanks @grone. I’m interested in trying mavlink-router but the documentation indicates that I need to compile it from source before I can use it. I’m not a computer geek - just a guy working on an aviation project. Is there a way I can install mavlink-router as sudo apt-get install, or pip install?
I don’t know of any debian packages for mavlink-router but build/install instructions are pretty straightforward on raspbian
i believe tmux also provides similar functionality