Created
February 3, 2020 16:05
-
-
Save sfalexrog/dc4394310293a074f8b879e0d5a5f988 to your computer and use it in GitHub Desktop.
Read and print thrust using mavros and MAVLink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import rospy | |
from mavros import mavlink | |
from pymavlink import mavutil | |
from mavros_msgs.msg import Mavlink | |
rospy.init_node('thrust_read') | |
link = mavutil.mavlink.MAVLink('', 255, 1) | |
def mavlink_message_handler(msg): | |
if msg.msgid == 140: | |
mav_bytes_msg = mavlink.convert_to_bytes(msg) | |
mav_msg = link.decode(mav_bytes_msg) | |
print(mav_msg.controls[3]) | |
mavlink_sub = rospy.Subscriber('mavlink/from', Mavlink, mavlink_message_handler) | |
rospy.spin() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment