Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)WaypointVirtualStick
- {
- CLLocation* WpLoca = self.WPLocations[self.index];
- if (self.index < [self.WPLocations count])
- {
- NSLog(@"Current waypoint: %d", self.index);
- [self WaypointMission:WpLoca];
- }else{
- [self.timeVS invalidate];
- // self.mYaw = VirtualStickBearing;
- self.mXVelocity = 0;
- WeakRef(target);
- [self.flightController setVirtualStickModeEnabled:NO withCompletion:^(NSError * _Nullable error) {
- WeakReturn(target);
- if (error){
- NSLog(@"Exit Virtual Stick False!");
- } else{
- NSLog(@"Exit Virtual Stick Successed!");
- }
- }];
- [self.flightController setIsVirtualStickAdvancedModeEnabled:NO];
- }
- }
- - (IBAction)onFly:(id)sender
- {
- self.mXVelocity = 0;
- self.mYaw = 0;
- self.mThrottle = self.aircraftLocation.altitude;
- self.WPLocations = [[NSArray alloc] initWithObjects:(CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40561, 16.94785) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40553, 16.94816) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40542, 16.94791) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40524, 16.94793) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40536, 16.94768) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40523, 16.94742) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40544, 16.94745) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40561, 16.94716) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40561, 16.94751) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], (CLLocation*)[[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(52.40577, 16.9477) altitude:self.aircraftLocation.altitude horizontalAccuracy:200.0 verticalAccuracy:200.0 timestamp:[NSDate date]], nil];
- self.timeVS = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(WaypointVirtualStick) userInfo:nil repeats:YES];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement