Advertisement
Bartosz_Popielarczyk

Untitled

Jul 26th, 2022
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(void) updateVirtualStick
  2. {
  3.     // In rollPitchVelocity mode, the pitch property in DJIVirtualStickFlightControlData represents the Y direction velocity.
  4.     // The roll property represents the X direction velocity.
  5.     DJIVirtualStickFlightControlData ctrlData = {0};
  6.     ctrlData.pitch = self.mYVelocity;
  7.     ctrlData.roll = self.mXVelocity;
  8.     ctrlData.yaw = self.mYaw;
  9.     ctrlData.verticalThrottle = self.mThrottle;
  10.     WeakRef(target);
  11.     if (self.flightController && self.flightController.isVirtualStickControlModeAvailable) {
  12.         [self.flightController sendVirtualStickFlightControlData:ctrlData withCompletion:^(NSError * _Nullable error) {
  13.             WeakReturn(target);
  14.             if (error) {
  15.                 NSLog(@"Send Control Data error!");
  16.             }
  17.             else
  18.             {
  19.                 NSLog(@"Send Control Data succeeded!");
  20.             }
  21.            
  22.         }];
  23.     }
  24.     else{
  25.         NSLog(@"Virtual Stick Control Mode not Availabe!");
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement