mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 10:03:35 +08:00
Added Roll Pitch Yawrate Thrust offboard test. Testing...
This commit is contained in:
@@ -10,7 +10,7 @@ from mavros_msgs.msg import Altitude, ExtendedState, HomePosition, State, \
|
||||
from mavros_msgs.srv import CommandBool, ParamGet, SetMode, WaypointClear, \
|
||||
WaypointPush
|
||||
from pymavlink import mavutil
|
||||
from sensor_msgs.msg import NavSatFix
|
||||
from sensor_msgs.msg import NavSatFix, Imu
|
||||
from six.moves import xrange
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ class MavrosTestCommon(unittest.TestCase):
|
||||
self.altitude = Altitude()
|
||||
self.extended_state = ExtendedState()
|
||||
self.global_position = NavSatFix()
|
||||
self.imu_data = Imu()
|
||||
self.home_position = HomePosition()
|
||||
self.local_position = PoseStamped()
|
||||
self.mission_wp = WaypointList()
|
||||
@@ -32,7 +33,7 @@ class MavrosTestCommon(unittest.TestCase):
|
||||
key: False
|
||||
for key in [
|
||||
'alt', 'ext_state', 'global_pos', 'home_pos', 'local_pos',
|
||||
'mission_wp', 'state'
|
||||
'mission_wp', 'state', 'imu'
|
||||
]
|
||||
}
|
||||
|
||||
@@ -66,6 +67,9 @@ class MavrosTestCommon(unittest.TestCase):
|
||||
self.global_pos_sub = rospy.Subscriber('mavros/global_position/global',
|
||||
NavSatFix,
|
||||
self.global_position_callback)
|
||||
self.imu_data_sub = rospy.Subscriber('mavros/imu/data',
|
||||
Imu,
|
||||
self.imu_data_callback)
|
||||
self.home_pos_sub = rospy.Subscriber('mavros/home_position/home',
|
||||
HomePosition,
|
||||
self.home_position_callback)
|
||||
@@ -114,6 +118,12 @@ class MavrosTestCommon(unittest.TestCase):
|
||||
if not self.sub_topics_ready['global_pos']:
|
||||
self.sub_topics_ready['global_pos'] = True
|
||||
|
||||
def imu_data_callback(self, data):
|
||||
self.imu_data = data
|
||||
|
||||
if not self.sub_topics_ready['imu']:
|
||||
self.sub_topics_ready['imu'] = True
|
||||
|
||||
def home_position_callback(self, data):
|
||||
self.home_position = data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user