Cardboard Robot SDK
 All Classes Functions Properties
CBRobot.h
1 /*=========================================================================
2  This file is part of the Cardboard Robot SDK.
3 
4  Copyright (C) 2012 Ken Ihara.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 =========================================================================*/
19 
20 #import <Foundation/Foundation.h>
21 
23 #define CB_NOTIFICATION_CONNECTION_STATUS_CHANGED @"CBConnectionStatusChanged"
24 #define CB_NOTIFICATION_PAUSED_STATE_CHANGED @"CBPausedStateChanged"
25 
26 @class CBArmPosition;
27 @class CBArmSpeed;
28 @class CBDofVector;
29 @class CBMotorParameters;
30 @protocol CBPath;
31 
35 @interface CBRobot : NSObject
36 
43 @property (assign, nonatomic) double armLength1;
44 
51 @property (assign, nonatomic) double armLength2;
52 
58 @property (retain, nonatomic) CBArmPosition *currentPosition;
59 
61 @property (retain, nonatomic) CBArmPosition *targetPosition;
62 
64 @property (retain, nonatomic) CBArmSpeed *speed;
65 
67 @property (readonly, nonatomic) CBArmSpeed *defaultSpeed;
68 
72 @property (readonly, nonatomic) BOOL connected;
73 
75 @property (assign, nonatomic) BOOL paused;
76 
81 @property (retain, nonatomic) id <CBPath> path;
82 
83 - (id)init;
84 
85 - (void)updateFromDevice;
86 
87 - (CBMotorParameters *)motorParametersForMotor:(int)motorNumber;
88 
89 - (double)angleFromSteps:(double)steps forMotor:(int)motorNumber;
90 - (double)stepsFromAngle:(double)angle forMotor:(int)motorNumber;
91 
92 - (BOOL)isAtTargetPositionWithThreshold:(double)steps;
93 - (BOOL)isMotor:(int)motorNumber atTargetPositionWithThreshold:(double)steps;
94 
95 - (void)setHomePosition;
96 
97 @end