diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-15 22:07:03 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-15 22:07:03 +0200 |
commit | e696ed5509d001e181c33a2379d634e76190c42a (patch) | |
tree | 8fd3e88c0782ceb90e6b9589daa1290d548058fd /mavlink/share/pyshared/pymavlink/examples/mavtest.py | |
parent | 79aa600d29c66e4619aacf73e71e51df13560205 (diff) | |
parent | 619433d36911b9c3923bae666d3632beb713935f (diff) | |
download | px4-firmware-e696ed5509d001e181c33a2379d634e76190c42a.tar.gz px4-firmware-e696ed5509d001e181c33a2379d634e76190c42a.tar.bz2 px4-firmware-e696ed5509d001e181c33a2379d634e76190c42a.zip |
Merged master
Diffstat (limited to 'mavlink/share/pyshared/pymavlink/examples/mavtest.py')
-rw-r--r-- | mavlink/share/pyshared/pymavlink/examples/mavtest.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/mavlink/share/pyshared/pymavlink/examples/mavtest.py b/mavlink/share/pyshared/pymavlink/examples/mavtest.py deleted file mode 100644 index 3c385e48a..000000000 --- a/mavlink/share/pyshared/pymavlink/examples/mavtest.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python - -import sys, os - -# allow import from the parent directory, where mavlink.py is -sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) - -import mavlink - -class fifo(object): - def __init__(self): - self.buf = [] - def write(self, data): - self.buf += data - return len(data) - def read(self): - return self.buf.pop(0) - -f = fifo() - -# create a mavlink instance, which will do IO on file object 'f' -mav = mavlink.MAVLink(f) - -# set the WP_RADIUS parameter on the MAV at the end of the link -mav.param_set_send(7, 1, "WP_RADIUS", 101) - -# alternatively, produce a MAVLink_param_set object -# this can be sent via your own transport if you like -m = mav.param_set_encode(7, 1, "WP_RADIUS", 101) - -# get the encoded message as a buffer -b = m.get_msgbuf() - -# decode an incoming message -m2 = mav.decode(b) - -# show what fields it has -print("Got a message with id %u and fields %s" % (m2.get_msgId(), m2.get_fieldnames())) - -# print out the fields -print(m2) |