Groups
Groups
Sign in
Groups
Groups
MAVLink
Conversations
About
Send feedback
Help
Trying to send some commands to pixhawk from pymavlink. What am I missing?
1,055 views
Skip to first unread message
Luk Jo
unread,
Apr 19, 2016, 6:16:12 PM
4/19/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to MAVLink
Hi, i'm trying to set up some communication between linux computer and pixhawk via USB using pymavlink. To get started i just wanted to send some simple commands to pixhawk like
MAV_CMD_COMPONENT_ARM_DISARM
, or
MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN
to see if it's working, but it doesn't. Please look at my python code:
#!/usr/bin/env python
'''
test mavlink messages
'''
import sys, struct, time, os
from curses import ascii
from pymavlink.dialects.v10 import common as mavlink
import mavtest
from pymavlink import mavutil
mav = mavlink.MAVLink_header(76,9,0,1,1)
command= mavlink.MAVLink_command_long_message(1,0,400,0,1,0,0,0,0,0,0) #arm pixhawk
msg = command.pack(mav) #prepare message to send
ser = mavutil.MavlinkSerialPort("/dev/ttyACM0", 115200,0,0,3,1) #open up serial port in debug mode
ser.write(msg) #send command via serial port
print msg
And here is my terminal OUTPUT:
root@kali:~/mavlink/pymavlink/examples# python mavlinktest1.py
Connecting with MAVLink to /dev/ttyACM0 ...
HEARTBEAT OK
Locked serial device
�! L�?� �>
root@kali:~/mavlink/pymavlink/examples#
As you can see it is receiving heartbeat, that means we have some sort of communication. But sending my message to pixhawk doesn't have any effect. For example when I try to send ARM command from mavproxy i can hear buzzer beeps etc.
Thank you for any suggestions :)
Reply all
Reply to author
Forward
0 new messages