RobotKit API
|
00001 // 00002 // RKDriveControl.h 00003 // RobotKit 00004 // 00005 // Copyright 2010 Orbotix Inc. All rights reserved. 00006 // 00007 00008 #import <UIKit/UIKit.h> 00009 #import <CoreMotion/CoreMotion.h> 00010 00013 @class RKRobotControl; 00014 @class RKRobotProvider; 00015 @class RKRobot; 00016 @class RKAccelerometerFilter; 00017 00019 typedef enum _RKDriveControlType { 00021 RKDriveControlUserDefined, 00023 RKDriveControlJoyStick, 00025 RKDriveControlTilt 00026 } RKDriveControlType; 00027 00032 @interface RKDriveControl : NSObject 00033 { 00034 @private 00035 CMMotionManager *motionManager; 00036 NSOperationQueue *motionQueue; 00037 RKAccelerometerFilter *accelerometerFilter; 00038 00039 BOOL driving; 00040 RKDriveControlType driveControlType; 00041 double velocityScale; 00042 double stopOffset; 00043 CGSize joyStickSize; 00044 00045 BOOL showsRobotLostControlAlert; 00046 } 00047 00048 #pragma mark Object References 00049 00050 @property (nonatomic, readonly) RKRobotProvider *robotProvider; 00052 @property (nonatomic, readonly) RKRobotControl *robotControl; 00054 @property (nonatomic, readonly) RKRobot *robot; 00056 @property (nonatomic, readonly) CMMotionManager *motionManager; 00057 00058 #pragma mark Driving Properties 00059 00060 @property (nonatomic, readonly) BOOL driving; 00062 @property (nonatomic, assign) CGSize joyStickSize; 00064 @property (nonatomic, assign) UIInterfaceOrientation tiltOrientation; 00068 @property (nonatomic, assign) double velocityScale; 00072 @property (nonatomic, assign) double stopOffset; 00074 @property (nonatomic, assign) id driveTarget; 00080 @property (nonatomic, assign) SEL driveConversionAction; 00081 00082 #pragma mark State Properties 00083 00086 @property (nonatomic, assign) BOOL handlesCoreMotionUpdates; 00088 @property (nonatomic, assign) BOOL showsRobotLostControlAlert; 00089 00090 00094 + (RKDriveControl *)sharedDriveControl; 00095 00100 - (void)setup; 00101 00106 - (void)tearDown; 00107 00108 #pragma mark - 00109 #pragma mark Driving Interface 00110 00118 - (void)startDriving:(RKDriveControlType)type; 00119 00125 - (void)driveWithJoyStickPosition:(CGPoint)newPoint; 00126 00132 - (void)driveWithAcceleration:(CMAcceleration)acceleration; 00133 00137 - (void)stopDriving; 00138 00142 - (void)jump; 00143 00144 @end