Created
February 23, 2016 00:45
-
-
Save anonymous/47eb5d32236f1c7b21e9 to your computer and use it in GitHub Desktop.
follow script for ar drone, ez-builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TakeOff() | |
sleep(1500) | |
REPEATWHILE(1) | |
$leftspeed = (320-$CameraObjectCenterX)/320*100 | |
IF ($leftspeed <= 0) | |
$leftspeed = 0.01 | |
ENDIF | |
$rightspeed = (1-(640-$CameraObjectCenterX)/320)*100 | |
IF ($rightspeed <= 0) | |
$rightspeed = 0.01 | |
ENDIF | |
$upspeed = (240-$CameraObjectCenterY)/240*200 | |
IF ($upspeed <= 0) | |
$upspeed = 0.01 | |
ENDIF | |
$downspeed = (1-(480-$CameraObjectCenterY)/240)*200 | |
IF ($downspeed <= 0) | |
$downspeed = 0.01 | |
ENDIF | |
IF ( $CameraVerticalQuadrant = "Top" and $CameraHorizontalQuadrant = "Left") | |
left($leftspeed, 200) | |
sleep(100) | |
up($upspeed, 200) | |
sleep(100) | |
ENDIF | |
IF ( $CameraVerticalQuadrant = "Top" and $CameraHorizontalQuadrant = "Right" ) | |
right($rightspeed, 200) | |
sleep(100) | |
Stop() | |
up($upspeed, 200) | |
sleep(100) | |
Stop() | |
ENDIF | |
IF ( $CameraVerticalQuadrant = "Bottom" and $CameraHorizontalQuadrant = "Left" ) | |
down($downspeed, 200) | |
sleep(100) | |
left($leftspeed, 200) | |
sleep(100) | |
ENDIF | |
IF ( $CameraVerticalQuadrant = "Bottom" and $CameraHorizontalQuadrant = "Right" ) | |
down($downspeed, 200) | |
sleep(100) | |
right($rightspeed, 200) | |
sleep(100) | |
ENDIF | |
IF ($CameraObjectWidth < 250 ) | |
forward(150,100) | |
sleep(100) | |
Stop() | |
ENDIF | |
IF ($CameraObjectWidth > 350) | |
reverse(150,100) | |
sleep(100) | |
ENDIF | |
ENDREPEATWHILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment