sphero-inc / Sphero-iOS-SDK

🚫 DEPRECATED: Sphero™ is the amazing robotic ball ( sphero.com ) created by Orbotix, this is the repository for the iOS SDK for Sphero™. Visit dev site for more information:
http://sdk.sphero.com
225 stars 81 forks source link

currentHeading and currentVelocity in new beta SDK #15

Closed sodastsai closed 9 years ago

sodastsai commented 9 years ago

Hi,

great to have new SDK to build our apps with arm64 support :smile:

In previous SDK, there are 2 methods:

+ (void)currentHeading;
+ (void)currentVelocity;

from the RKRollCommand class.

By the design of the new SDK, I should ask these properties from RKSphero/RKConvenienceRobot, right? but there's no such interfaces on those classes.

btw, I also tried to fetch these value via RKRollResponse. But when I setup a RKResponseObserver to my RKConvenienceRobot object, I still could not get any response via - (void)handleResponse:(RKDeviceResponse *)response forRobot:(id<RKRobotBase>)robot method.

vves commented 9 years ago

It was an oversight to make currentHeading private. We don't track current velocity anymore. There are 2 ways to manage heading. If you are doing calculations on heading then you should probably be managing your own property. Otherwise, a way to access heading until the next release is to add the following category to the top of the file that requires the robot heading. Note that this is a readonly property and is updated internally by the [robot driveWithHeading: andVelocity:] selector in order to make [robot stop] more developer friendly.

@interface RKConvenienceRobot() @property (nonatomic, readonly) float heading; @end

Note: If tracking heading is used in order to stop driving correctly, the ConvenienceRobot takes care of the heading on [robot stop] correctly now.

sodastsai commented 9 years ago

got it, thanks :+1: