pymavlink

171 views
Skip to first unread message

Ligia Frangello

unread,
Feb 15, 2018, 7:38:44 PM2/15/18
to MAVLink
Hello all,

I am trying to connect to UgCS through mavlink to simulate a vehicle.

In other other words, I have trying to bound socket / server connection to listen for GCS connections and then stream mavlink messages over that as soon as a client connects.
But I can't seem to connect to the right ports or use the right code to send a message through a port.

I have tried using mavutil.py: 

self.master = mavutil.mavlink_connection( "udp:127.0.0.1:14550", source_system=1 )
self.master.mav = mavutil.mavlink.MAVLink(self.master, srcSystem=self.master.source_system, srcComponent=1)
msg
= self.master.mav.heartbeat_encode( 0,0,0,0)
conn
.send( msg.get_msgbuf())

but I get the error: 

Traceback (most recent call last):
 
File "server.py", line 28, in <module>
    conn
.send( msg.get_msgbuf() )
 
File "/usr/local/lib/python2.7/dist-packages/pymavlink/dialects/v10/ardupilotmega.py", line 91, in get_msgbuf
   
return bytearray(self._msgbuf)
TypeError: 'NoneType' object is not iterable


I don't know why it is trying to use ardupilotmega.py. 

Does anyone know of any documentation on how to use pymavlink to connect to a port and send mavlink messages?

Thank you.

Afshin Mardani

unread,
Oct 31, 2018, 7:13:05 AM10/31/18
to MAVLink
Hi Ligia,

Is your problem solved? If yes, Can you please explain me the solution. I have an issue like what you explained and your help will be appreciated.
Thank you

Hamish Willee

unread,
Oct 31, 2018, 9:53:11 PM10/31/18
to MAVLink
Documentation on Pymavlink recently updated here: https://mavlink.io/en/mavgen_python/

This explains how to connect and send/receive
Reply all
Reply to author
Forward
0 new messages