私は sphero アプリに取り組んでおり、gysorcope ベースの運転を追加したいと考えています。私が理解している限り、 を作成しCMMotionManager
、値を取得して、yaw
それをパラメータとして のインスタンスに渡す必要がありますRKTiltDriveAlgorithm
。私が理解していないのは、RKTiltDriveAlgorithm
インスタンスをどこに渡すかです。ドキュメントにはRKRobotControl
、どこからでもアクセスできないように見えるインスタンスを渡すように書かれています。RKRobotProvider
のプロパティがありますが、RKRobotControl
割り当て可能ではありません。これまでの私のコードは次のとおりです
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;
}];
いくつかのヒントをいただければ幸いです、ありがとう:)