Problem getting MAVProxy running over serial on RaspberryPi

1,519 views
Skip to first unread message

Chris Anderson

unread,
May 3, 2015, 4:24:38 PM5/3/15
to drones-discuss
When I run MAVProxy on a Raspberry Pi 2 with a serial connection to Pixhawk, I get the below errors in MAVProxy.

Is this because I need to establish the serial connection (baud rate, etc) in Linux on the RasPi before I start MAVProxy? 





--
Chris Anderson
CEO, 3D Robotics

Chris Anderson

unread,
May 3, 2015, 5:28:52 PM5/3/15
to drones-discuss
Looks like one problem is that the Debian distro for Raspberry Pi ("Raspian"), takes over the serial port ("/dev/ttyAMA0") for OS purposes such as Console services and Putty for remote login. 

I might have to find a way to disable these services. 

It may be that Raspberry Pi is not the best companion computer for Pixhawk. 

-Chris

James Harrison

unread,
May 3, 2015, 5:36:41 PM5/3/15
to drones-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/05/2015 22:28, Chris Anderson wrote:
>
> I might have to find a way to disable these services.
>
> It may be that Raspberry Pi is not the best companion computer for
> Pixhawk.

Disabling /dev/ttyAMA0 for the serial console is trivially done; you
can either do it under the advanced menu in rpi-config, or simply
disable it in /etc/inittab and /boot/cmdline.txt.

http://elinux.org/RPi_Serial_Connection#Preventing_Linux_using_the_seria
l_port

- --
Cheers,
James Harrison
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQIcBAEBAgAGBQJVRpTjAAoJENTyYHL8dmp9/CsP/3jTTFQbW1DMtXMlL3casKdh
VpYSggaDojRqYE8Pw5NeTTzqI2jBqxrMxxVO4lrkgJPX7/YO0V3wmev1wyifVVnC
DE4NvgQSszs7sTbfnwSVHYxIjh9QKi5bMk79itAPJnmEdbRVNNGYU9jZHiFVMC4h
a153L66b5PjggnpXwvdWYVmcNlipPclhxf8CMLcXOFAzyAAqlH5zIEYcv0pTwe0o
IcOiEqnQ99Ho0cdrURFxiCEpXFbIX2jQB8mz6OJxdVmb1sduU4lSivXfuGv83gVf
jNH2UU5yOILbkyBSDQHsRXGeASvwRpCTR8FbEI/GXOlZR6g1X0FGbOnyb4jZnf07
9XBaOvsgvGRHupq1rrbl/v+MIL1aABG/IseelP2PRDCc68UwVH9AHYohVYVIz7M9
r8K+HXpvun4a67hQOvvsoMdpB/38c7bcaiwk8wAlfmzEqr7cftVxsTx4q8hrzQcD
Vk7xLMmxTZYrbtTO879qjpLS6AO2Ag1tAE+VBJEZ8sDu4T84zMy8DrQzQJwNijJh
6FYze8CcF+iZwuB16vQPa46Q2n+gf7cfZRqipTBppMp2PEaMPZLH8xd4oyskFBHH
im/KFjuNaoNGuH0TS9CC4h9LGHEiAR+EjYIJ3+dZjdvaw0y9iuCO4pKfiNats73p
a15Q/dbQ1ryjdkneZqCL
=356h
-----END PGP SIGNATURE-----

Chris Anderson

unread,
May 3, 2015, 5:43:39 PM5/3/15
to drones-discuss
Thanks! I'll try that now. 

-c


--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paulo Neves

unread,
May 3, 2015, 6:02:24 PM5/3/15
to drones-...@googlegroups.com
From your log it doesnt seem like it is a serial problem at all. The crash happens in the map module of mavproxy, specifically in trying to fetch something(a map?)

Also ttyAMA0 is quite uncommon. I assume you are not using an USB/FTDI interface. If the problem is unrelated(as I think it is) connecting by USB will also not work.

If you find that the ttyAMA0 is not available I can give you an udev rule so that the ardupilot is always placed in a deterministic unique device name.

Chris Anderson

unread,
May 3, 2015, 6:57:36 PM5/3/15
to drones-discuss
I'm using the instructions here. "ttyAMA0" is the name of the RasPi's UART (TTL serial) port. The raspi-config utility now provides the ability to turn off OS control of that serial port, so I've done that. 

The good news is that I now seem to be communicating with Pixhawk!

The bad news is that I'm still getting an error after that initial communications (see below). So it's probably not serial port related, and instead perhaps the error that Paulo suggested. 

Any idea how to resolve?







--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nigel Armstrong

unread,
May 3, 2015, 7:19:07 PM5/3/15
to drones-...@googlegroups.com
No idea exactly how to resolve this, but as Paulo said, this is an error fetching something. The http connection got back a status line it didn't know how to handle. 

From what I can see, it is connecting to http://firmware.diydrones.com/SRTM/ and trying to data from there, but I can't tell exactly why it is failing. 

Here is the line it is failing at in the code, if you would like to look around: https://github.com/tridge/MAVProxy/blob/master/MAVProxy/modules/mavproxy_map/srtm.py#L134

-Nigel

Paulo Neves

unread,
May 3, 2015, 7:59:29 PM5/3/15
to drones-...@googlegroups.com
I would disable the module altogether. You are using mavproxy through a ssh session aren't you? If so you don't have a graphical interface to display any maps making the whole module irrelevant.

Try disabling the relevant module following the instructions here:
http://tridge.github.io/MAVProxy/modules.html

Chris Anderson

unread,
May 3, 2015, 8:43:56 PM5/3/15
to drones-discuss
I'm actually using MAVProxy via VNC, which supports X-windows and graphics, but for some reason MAVProxy is not allowing access to the Window in this mode. However, if I just run "mavproxy.py --console", it does bring up the GUI. 

I think I'm going to need a screenshare debugging session with Tridge on this. Once I get it working with him, I'll update the wiki accordingly. 

-c 

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Hester

unread,
May 3, 2015, 9:01:39 PM5/3/15
to drones-...@googlegroups.com
Hi Chris,

That looks like a regression in the mavproxy_map module.  The ideal fix is for someone to go look at like 134 of srtm.py and fix the bug (I bet the server being used to provide maps has changed how it is formatting responses).

The quick fix in your case is to create a file in the homedir to unload the map module (you don't need it anyways):

echo "module unload map" >>~/.mavinit.scr

This should fix it for you...

Kevin

Drew Watson

unread,
May 4, 2015, 11:59:54 PM5/4/15
to drones-...@googlegroups.com
Late to the game here, but I've had a pretty good experience using the Pi as a companion computer to the Pixhawk (with the exception being these nagging issues:  https://github.com/diydrones/ardupilot/issues/2093 and http://stackoverflow.com/questions/29981304/how-to-correctly-install-and-import-pymavlink-using-pip).  Anyway, in case anyone else reading this runs into a similar issue, you can always test your Pi's serial connection to the APM or Pixhawk by simply using the screen command which, unfortunately, doesn't come pre-installed with the Raspian/NOOBS package that most people download.  Just type sudo apt-get install screen to install the screen application to your Pi, plug your Pixhawk into any available USB port on your Pi, and type (for the Pixhawk) sudo screen /dev/ttyACM0 115200 (or for the APM type) sudo screen /dev/ttyACM0 57600  to open a console window to your APM or Pixhawk.  Depending on whether the Pixhawk/APM just booted up or not, you should see what appears to be scrolling gibberish (encoded telemetry data) or some clear text like "Init ArduRover 2.49" (or something similar).  Alternatively, if you use the telemetry connection to link your Pi to your Pixhawk/APM (which, I believe is a 5 or 6-pin "DF-13" connection linking your Pixhawk to the Pi's GPIO pins) instead of connecting via USB, you can follow the same screen instructions above but use sudo screen /dev/ttyAMA0 115200.  As others noted, you'll first have to go in and edit the Pi's default configuration (follow this guide:  http://www.raspberrypi-spy.co.uk/2013/12/free-your-raspberry-pi-serial-port/) and disable the Pi's serial login.  Good luck. 
Reply all
Reply to author
Forward
0 new messages