修改坐标系变换

This commit is contained in:
Robin Shaun 2020-10-25 00:01:41 +08:00
parent 2ee8968d2c
commit 5c3e34c3bb
1 changed files with 11 additions and 44 deletions

View File

@ -106,8 +106,6 @@ class Communication:
target_raw_pose = PositionTarget()
target_raw_pose.coordinate_frame = self.coordinate_frame
if self.platform.split('-')[-2] == '16.04':
if self.coordinate_frame == 1:
target_raw_pose.position.x = x
target_raw_pose.position.y = y
target_raw_pose.position.z = z
@ -120,37 +118,6 @@ class Communication:
target_raw_pose.acceleration_or_force.y = afy
target_raw_pose.acceleration_or_force.z = afz
else:
target_raw_pose.position.x = -y
target_raw_pose.position.y = x
target_raw_pose.position.z = z
target_raw_pose.velocity.x = -vy
target_raw_pose.velocity.y = vx
target_raw_pose.velocity.z = vz
target_raw_pose.acceleration_or_force.x = afx
target_raw_pose.acceleration_or_force.y = afy
target_raw_pose.acceleration_or_force.z = afz
elif self.platform.split('-')[-2] == '18.04':
target_raw_pose.position.x = x
target_raw_pose.position.y = y
target_raw_pose.position.z = z
target_raw_pose.velocity.x = vx
target_raw_pose.velocity.y = vy
target_raw_pose.velocity.z = vz
target_raw_pose.acceleration_or_force.x = afx
target_raw_pose.acceleration_or_force.y = afy
target_raw_pose.acceleration_or_force.z = afz
else:
print('XTDrone only supports Ubuntu16.04 and Ubuntu18.04 now.')
sys.exit(0)
target_raw_pose.yaw = yaw
target_raw_pose.yaw_rate = yaw_rate