hello all. Need help in setting up Rpi 3 for communicating with flight controller via MAVlink. I am following this page http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html. I am trying with flashing Apsync image because the web page says its simpler. I have few issues:
Once I insert SD card into Rpi3, do I still need to “Disable the OS control of the serial port”?
I have connected Rpi to the laptop via ethernet. Every time I try to reboot the Rpi3, there is an error saying “Session stopped” and “server unexpectedly closed network connection”. This happens every time. is this issue with my connection of rpi to laptop or issue with APsync image?
When I test the connection, with following commands,
-sudo -s
-mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter
-param show ARMING_CHECK
-param set ARMING_CHECK 0
-arm throttle
I get nothing similar whats shown in rpi console on webpage.
I am struggling with this for many days and badly need help. Thanks in advance
and when I try with serial0 (ttyS0) instead of AMA0, I get this.
root@apsync:/home/pi# mavproxy.py --master=/dev/ttyS0 --baudrate 57600 --aircraft MyCopter
Connect /dev/ttyS0 source_system=255
no script MyCopter/mavinit.scr
Log Directory: MyCopter/logs/2018-04-23/flight5
Telemetry log: MyCopter/logs/2018-04-23/flight5/flight.tlog
MAV> Waiting for heartbeat from /dev/ttyS0
P9 (@H00Exception in thread main_loop:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 801, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 754, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/local/bin/mavproxy.py”, line 751, in main_loop
master.wait_heartbeat()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 383, in wait_heartbeat
return self.recv_match(type=‘HEARTBEAT’, blocking=blocking)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 344, in recv_match
m = self.recv_msg()
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 307, in recv_msg
s = self.recv(n)
File “/usr/local/lib/python2.7/dist-packages/pymavlink/mavutil.py”, line 827, in recv
ret = self.port.read(n)
File “/usr/local/lib/python2.7/dist-packages/serial/serialposix.py”, line 501, in read
’device reports readiness to read but returned no data '
SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Please stop running things as root. It’s an unhealthy habit, and not
needed in the vast majority of cases.
Please use the “apsync” user, not “root” or “pi”.
The serial port is in use by either cmavnode or mavlink-router - you can’t
use it yourself. But both of those are broadcasting the mavlink traffic
on port 14550 (and sending to a few besides).
Hi peter,
Thanks for reply. I am now using ‘apsync’ as user and not ‘root’ and ‘pi’.
I did not quite understand the point that you made about port 14550, that cmavnod and mavlink-router broadcast traffic on this port.
I tried with
-mavproxy --master :14550
But am receiving some error.
Also another issue am facing is that I think I can establish connection between rpi3 and FC. But as soon as there is connection, within seconds the link goes down. And I start getting
I did not quite understand the point that you made about port 14550, that
cmavnod and mavlink-router broadcast traffic on this port.
I tried with
-mavproxy --master :14550
But am receiving some error.
You will need to be a little more specific…
Have you reverted the changes you made to the serial arrangements?
Also another issue am facing is that I think I can establish connection
between rpi3 and FC. But as soon as there is connection, within seconds
the link goes down. And I start getting
link 1 down
no link
no link
…
Any idea whats happening ? Thanks
If you are doing anything directly involving the serial ports you will
need to either stop cmavnode or mavlink-router (screen -r will show you
which is actually running), or do as I suggested above, by listening on a
port they are broadcasting on.
Thanks for reply Peter. Alright now the FC and Rpi are communicating and there is no loss of link. What I did was I disabled bluetooth by adding these lines to config.txt
pi@navio:~ $ mavproxy.py --master 127.0.0.1:14550
Connect 127.0.0.1:14550 source_system=255
Failed to load module: No module named adsb. Use ‘set moddebug 3’ in the MAVProxy console to enable traceback
Log Directory:
Telemetry log: mav.tlog
Waiting for heartbeat from 127.0.0.1:14550
MAV> GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to read pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
GPIO_Sysfs: Unable to get value file descriptor for pin 4.
GPIO_Sysfs: Unable to write pin 16 value.
online system 1
STABILIZE> Mode STABILIZE
Exception in thread main_loop:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 801, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 754, in run
self.__target(*self.__args, **self.__kwargs)
File “/home/pi/.local/bin/mavproxy.py”, line 783, in main_loop
master.wait_heartbeat()
File “/home/pi/.local/lib/python2.7/site-packages/pymavlink/mavutil.py”, line 383, in wait_heartbeat
return self.recv_match(type=‘HEARTBEAT’, blocking=blocking)
File “/home/pi/.local/lib/python2.7/site-packages/pymavlink/mavutil.py”, line 344, in recv_match
m = self.recv_msg()
File “/home/pi/.local/lib/python2.7/site-packages/pymavlink/mavutil.py”, line 922, in recv_msg
m = self.mav.parse_char(s)
File “/home/pi/.local/lib/python2.7/site-packages/pymavlink/dialects/v10/ardupilotmega.py”, line 9257, in parse_char
self.__callbacks(m)
File “/home/pi/.local/lib/python2.7/site-packages/pymavlink/dialects/v10/ardupilotmega.py”, line 9234, in __callbacks
self.callback(msg, *self.callback_args, **self.callback_kwargs)
File “/home/pi/.local/lib/python2.7/site-packages/MAVProxy/modules/mavproxy_link.py”, line 460, in master_callback
mavutil.mavlink.MAV_TYPE_DODECAROTOR]:
AttributeError: ‘module’ object has no attribute ‘MAV_TYPE_DODECAROTOR’