You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
373 B
Python
14 lines
373 B
Python
|
3 years ago
|
#!/usr/bin/env python3
|
||
|
|
#coding:utf-8
|
||
|
|
import rospy
|
||
|
|
from mavros_msgs.msg import Waypoint
|
||
|
|
|
||
|
|
def callBack(data):
|
||
|
|
print (data.param1)
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
nodeName = 'subscriber_py'
|
||
|
|
rospy.init_node(nodeName)
|
||
|
|
topicName = '/DroneStatus'
|
||
|
|
subscriber = rospy.Subscriber(topicName,Waypoint,callBack) #從topic獲取string再呼叫callback
|
||
|
|
rospy.spin()
|