I'm working on sphero app and want to add a gysorcope based driving. As far as I understand I need to create CMMotionManager
, get the yaw
value and pass it as a parameter to instance of RKTiltDriveAlgorithm
. What I don't understand is where do I pass the RKTiltDriveAlgorithm
instance. Documentation says to pass the instance to RKRobotControl
which doesn't seem to be accessible from anywhere. RKRobotProvider
has a property for RKRobotControl
but it's not assignable. Here's my code so far
RKTiltDriveAlgorithm *tilt = [[RKTiltDriveAlgorithm alloc] initWithOrientation:[UIApplication sharedApplication].statusBarOrientation];
...
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) {
float yaw = (180/M_PI) * motion.attitude.yaw;
tilt.orientationAngle = yaw;
}];
Would appreciate some hints, thanks :)