Skip to content

Commit

Permalink
Modify flip function to work better in aruco_map frame with both Clev…
Browse files Browse the repository at this point in the history
…er 3 & 4

(cherry picked from commit a5021d4)
  • Loading branch information
goldarte committed Jun 25, 2019
1 parent 9790d2b commit 1474bf6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Drone/FlightLib/FlightLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,10 @@ def takeoff(z=Z_TAKEOFF, speed=SPEED_TAKEOFF, frame_id='body', freq=FREQUENCY,
#print("Takeoff succeeded!")
return 'success'

def flip(min_z = FLIP_MIN_Z): #TODO Flip in different directions
def flip(min_z = FLIP_MIN_Z, frame_id = FRAME_ID): #TODO Flip in different directions
logger.info("Flip started!")

start_telemetry = get_telemetry() # memorize starting position
start_telemetry = get_telemetry(frame_id=frame_id) # memorize starting position

if start_telemetry.z < min_z - TOLERANCE:
logger.warning("Can't do flip! Flip failed!")
Expand All @@ -377,9 +377,9 @@ def flip(min_z = FLIP_MIN_Z): #TODO Flip in different directions
while True:
telem = get_telemetry()

if -math.pi + 0.1 < telem.roll < -0.2:
if abs(telem.roll) > math.pi/2:
break

logger.info('Flip succeeded!')
#print('Flip succeeded!')
navto(x=start_telemetry.x, y=start_telemetry.y, z=start_telemetry.z, yaw=start_telemetry.yaw) # finish flip
navto(x=start_telemetry.x, y=start_telemetry.y, z=start_telemetry.z, yaw=start_telemetry.yaw, frame_id=frame_id) # finish flip
2 changes: 1 addition & 1 deletion Drone/copter_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _command_emergency_led_fill(**kwargs):

@messaging.message_callback("flip")
def _copter_flip():
FlightLib.flip()
FlightLib.flip(frame_id=client.active_client.FRAME_ID)

@messaging.message_callback("takeoff")
def _command_takeoff(**kwargs):
Expand Down

0 comments on commit 1474bf6

Please sign in to comment.