SHOTS: Remove workaround for MOUNT_CONTROL bug

The bug in ArduCopter master that made MSG_MOUNT_CONTROL fail to yaw the
copter in smart shots has been found and fixed as of Fri 12/22.  It is
merged into master and begin backported to 3.5.5.  As such, the
workaround (simultaneous CONDITION_YAW commands) can now be removed from
the smart shots.  Also cleaned up the code around it a bit.
This commit is contained in:
Matt 2017-12-22 21:34:05 -05:00
parent 4eadebe166
commit 41e7130b0f
5 changed files with 90 additions and 170 deletions

View File

@ -625,44 +625,29 @@ class FollowShot():
# if we do have a gimbal, use mount_control to set pitch and yaw # if we do have a gimbal, use mount_control to set pitch and yaw
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
msg = self.vehicle.message_factory.mount_control_encode( msg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # Target system, target component
# pitch is in centidegrees self.camPitch * 100, # Pitch in centidegrees
self.camPitch * 100, 0.0, # Roll not used
0.0, # roll self.camYaw * 100, # Yaw in centidegrees
# yaw is in centidegrees 0 # save position
0, #self.camYaw * 100, (Disabled by Matt due to ArduCopter master mount_control problem)
0 # save position
)
self.vehicle.send_mavlink(msg)
# Use MAV_CMD_CONDITION_YAW since the yaw in MSG_MOUNT_CONTROL is not working in AC35
msg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, #confirmation
self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
)
self.vehicle.send_mavlink(msg)
else:
# if we don't have a gimbal, just set CONDITION_YAW
msg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, #confirmation
self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)
else:
# if we don't have a gimbal, just set CONDITION_YAW
msg = self.vehicle.message_factory.command_long_encode(
0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, # confirmation
self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
)
self.vehicle.send_mavlink(msg)
def handleLookAtPointing(self, tempROI): def handleLookAtPointing(self, tempROI):
# set ROI # set ROI
msg = self.vehicle.message_factory.command_int_encode( msg = self.vehicle.message_factory.command_int_encode(

View File

@ -290,49 +290,31 @@ class MultipointShot():
newYaw += self.yawPitchOffsetter.yawOffset newYaw += self.yawPitchOffsetter.yawOffset
# Formulate mavlink message for mount controller. Use mount_control if using a gimbal. Use just condition_yaw if no gimbal. # Formulate mavlink message for mount controller. Use mount_control if using a gimbal. Use just condition_yaw if no gimbal.
# Modified by Matt 2017-05-18 for ArducCopter master compatibility
# mav_cmd_do_mount_control should handle gimbal pitch and copter yaw, but yaw is not working in master.
# So this mount_control command is only going to do the gimbal pitch for now.
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
pointingMsg = self.vehicle.message_factory.mount_control_encode( pointingMsg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # target system, target component
newPitch * 100, # pitch (centidegrees) newPitch * 100, # pitch in centidegrees
0.0, # roll (centidegrees) 0.0, # roll not used
newYaw * 100, # yaw (centidegrees) newYaw * 100, # yaw in centidegrees
0 # save position 0 # save position
)
self.vehicle.send_mavlink(pointingMsg)
# Temporary fix while the yaw control is not working in the above mount_control command.
pointingMsg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command
0, # confirmation
newYaw, # param 1 - target angle (degrees)
YAW_SPEED, # param 2 - yaw speed (deg/s)
0, # param 3 - direction, always shortest route for now...
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(pointingMsg) self.vehicle.send_mavlink(pointingMsg)
# if no gimbal, assume fixed mount and use condition_yaw only # if no gimbal, assume fixed mount and use condition_yaw only
else: else:
# if we don't have a gimbal, just set CONDITION_YAW # if we don't have a gimbal, just set CONDITION_YAW
pointingMsg = self.vehicle.message_factory.command_long_encode( pointingMsg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component 0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command
0, # confirmation 0, # confirmation
newYaw, # param 1 - target angle (degrees) newYaw, # param 1 - target angle (degrees)
YAW_SPEED, # param 2 - yaw speed (deg/s) YAW_SPEED, # param 2 - yaw speed (deg/s)
0, # param 3 - direction, always shortest route for now... 0, # param 3 - direction, always shortest route for now...
0.0, # relative offset 0.0, # relative offset
0, 0, 0 # params 5-7 (unused) 0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(pointingMsg) self.vehicle.send_mavlink(pointingMsg)
def interpolateCamera(self): def interpolateCamera(self):
'''Interpolate (linear) pitch and yaw between cable control points''' '''Interpolate (linear) pitch and yaw between cable control points'''
@ -847,45 +829,26 @@ class MultipointShot():
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
pointingMsg = self.vehicle.message_factory.mount_control_encode( pointingMsg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # target system, target component
newPitch * 100, # pitch (centidegrees) startPitch * 100, # pitch in centidegrees
0.0, # roll (centidegrees) 0.0, # roll not used
newYaw * 100, # yaw (centidegrees) startYaw * 100, # yaw in centidegrees
0 # save position 0 # save position
) )
self.vehicle.send_mavlink(pointingMsg) self.vehicle.send_mavlink(pointingMsg)
pointingMsg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command
0, # confirmation
startYaw, # param 1 - target angle (degrees)
ATTACH_YAW_SPEED, # param 2 - yaw speed (deg/s)
0, # param 3 - direction, always shortest route for now...
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
)
self.vehicle.send_mavlink(pointingMsg)
# pointingMsg = self.vehicle.message_factory.mount_control_encode(
# 0, 1, # target system, target component
# startPitch * 100, # pitch (centidegrees)
# 0.0, # roll (centidegrees)
# startYaw * 100, # yaw (centidegrees)
# 0 # save position
# )
# if not, assume fixed mount # if not, assume fixed mount
else: else:
# if we don't have a gimbal, just set CONDITION_YAW # if we don't have a gimbal, just set CONDITION_YAW
pointingMsg = self.vehicle.message_factory.command_long_encode( pointingMsg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component 0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command
0, # confirmation 0, # confirmation
startYaw, # param 1 - target angle (degrees) startYaw, # param 1 - target angle (degrees)
ATTACH_YAW_SPEED, # param 2 - yaw speed (deg/s) ATTACH_YAW_SPEED, # param 2 - yaw speed (deg/s)
0, # param 3 - direction, always shortest route for now... 0, # param 3 - direction, always shortest route for now...
0.0, # relative offset 0.0, # relative offset
0, 0, 0 # params 5-7 (unused) 0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(pointingMsg) self.vehicle.send_mavlink(pointingMsg)

View File

@ -469,39 +469,25 @@ class PanoShot():
# if we do have a gimbal, use mount_control to set pitch and yaw # if we do have a gimbal, use mount_control to set pitch and yaw
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
msg = self.vehicle.message_factory.mount_control_encode( msg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # Target system, target component
# pitch is in centidegrees self.camPitch * 100, # Pitch in centidegrees
self.camPitch * 100, 0.0, # Roll not used
0.0, # roll self.camYaw * 100, # Yaw in centidegrees
# yaw is in centidegrees 0 # save position
0, # self.camYaw * 100, (Disabled by Matt for now due to ArduCopter master mount_control bug. Using condition_yaw instead)
0 # save position
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)
msg = self.vehicle.message_factory.command_long_encode( # Using condition_yaw temporarily until mount_control yaw issue is fixed
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, #confirmation
self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
)
self.vehicle.send_mavlink(msg)
else: else:
# if we don't have a gimbal, just set CONDITION_YAW # if we don't have a gimbal, just set CONDITION_YAW
msg = self.vehicle.message_factory.command_long_encode( msg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component 0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, #confirmation 0, # confirmation
self.camYaw, # param 1 - target angle self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction self.camDir, # param 3 - direction
0.0, # relative offset 0.0, # relative offset
0, 0, 0 # params 5-7 (unused) 0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)

View File

@ -268,24 +268,24 @@ class SelfieShot():
# if we do have a gimbal, use mount_control to set pitch and yaw # if we do have a gimbal, use mount_control to set pitch and yaw
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
msg = self.vehicle.message_factory.mount_control_encode( msg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # Target system, target component
# pitch is in centidegrees self.camPitch * 100, # Pitch in centidegrees
self.camPitch * 100.0, 0.0, # Roll not used
0.0, # roll self.camYaw * 100, # Yaw in centidegrees
# yaw is in centidegrees 0 # save position
self.camYaw * 100.0,
0 # save position
) )
self.vehicle.send_mavlink(msg)
else: else:
# if we don't have a gimbal, just set CONDITION_YAW # if we don't have a gimbal, just set CONDITION_YAW
msg = self.vehicle.message_factory.command_long_encode( msg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component 0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, # confirmation 0, # confirmation
self.camYaw, # param 1 - target angle self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction XXX self.camDir, # param 3 - direction
0.0, # relative offset 0.0, # relative offset
0, 0, 0 # params 5-7 (unused) 0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)

View File

@ -317,39 +317,25 @@ class ZiplineShot():
# if we do have a gimbal, use mount_control to set pitch and yaw # if we do have a gimbal, use mount_control to set pitch and yaw
if self.vehicle.mount_status[0] is not None: if self.vehicle.mount_status[0] is not None:
msg = self.vehicle.message_factory.mount_control_encode( msg = self.vehicle.message_factory.mount_control_encode(
0, 1, # target system, target component 0, 1, # Target system, target component
# pitch is in centidegrees self.camPitch * 100, # Pitch in centidegrees
self.camPitch * 100.0, 0.0, # Roll not used
0.0, # roll self.camYaw * 100, # Yaw in centidegrees
0, # self.camYaw * 100.0, # yaw is in centidegrees (Disabled by Matt for now due to ArduCopter master mount_control bug. Using condition_yaw instead) 0 # save position
0 # save position
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)
msg = self.vehicle.message_factory.command_long_encode( # Using condition_yaw temporarily until mount_control yaw issue is fixed
0, 0, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command
0, # confirmation
self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction XXX
0.0, # relative offset
0, 0, 0 # params 5-7 (unused)
)
self.vehicle.send_mavlink(msg)
else: else:
# if we don't have a gimbal, just set CONDITION_YAW # if we don't have a gimbal, just set CONDITION_YAW
msg = self.vehicle.message_factory.command_long_encode( msg = self.vehicle.message_factory.command_long_encode(
0, 0, # target system, target component 0, 1, # target system, target component
mavutil.mavlink.MAV_CMD_CONDITION_YAW, # command mavutil.mavlink.MAV_CMD_CONDITION_YAW, #command
0, # confirmation 0, # confirmation
self.camYaw, # param 1 - target angle self.camYaw, # param 1 - target angle
YAW_SPEED, # param 2 - yaw speed YAW_SPEED, # param 2 - yaw speed
self.camDir, # param 3 - direction XXX self.camDir, # param 3 - direction
0.0, # relative offset 0.0, # relative offset
0, 0, 0 # params 5-7 (unused) 0, 0, 0 # params 5-7 (unused)
) )
self.vehicle.send_mavlink(msg) self.vehicle.send_mavlink(msg)