The main cardboard robot class.
Most functionality to control the robot can be accessed from here.
#import <CBRobot.h>
Properties | |
double | armLength1 |
Gets or sets the length of the first arm segment (from pivot to pivot), measured in centimeters. | |
double | armLength2 |
Gets or sets the length of the second arm segment (from pivot to pivot), measured in centimeters. | |
CBArmPosition * | currentPosition |
Gets or sets the current position of the robot's arm. | |
CBArmPosition * | targetPosition |
Gets or sets the target position of the robot's arm. | |
CBArmSpeed * | speed |
Gets or sets the desired speed of the robot's arm. | |
CBArmSpeed * | defaultSpeed |
Gets the robot's default speed. | |
BOOL | connected |
Gets whether or not the robot device is currently connected. | |
BOOL | paused |
Gets or sets whether the robot is currently in a paused state. | |
id< CBPath > | path |
Specifies the path that the robot should execute. |
Public Member Functions | |
(id) | - init |
Initializes a robot instance. | |
(void) | - updateFromDevice |
Updates the CBRobot's currentPosition property from the device. | |
(CBMotorParameters *) | - motorParametersForMotor: |
Returns the set of parameters for the given motor (1 through 4). | |
(double) | - angleFromSteps:forMotor: |
Converts a step count into an angle (in radians) for the given motor (1 through 4). | |
(double) | - stepsFromAngle:forMotor: |
Converts an angle (in radians) into a step count for the given motor (1 through 4). | |
(BOOL) | - isAtTargetPositionWithThreshold: |
Returns YES if each motor of the robot is within the given number of steps of its target position (not rounded). | |
(BOOL) | - isMotor:atTargetPositionWithThreshold: |
Returns YES if the given motor (1 - 4) is within the given number of steps of the target position (not rounded). | |
(void) | - setHomePosition |
Sets the current position as the new home position / zero position. |
|
readwritenonatomicassign |
Gets or sets the length of the first arm segment (from pivot to pivot), measured in centimeters.
You should generally only need to change this value if you replace the arm segment with a custom-sized one.
|
readwritenonatomicassign |
Gets or sets the length of the second arm segment (from pivot to pivot), measured in centimeters.
You should generally only need to change this value if you replace the arm segment with a custom-sized one.
|
readnonatomicassign |
Gets whether or not the robot device is currently connected.
Connection to the device is automatic; there's no need to manually connect.
|
readwritenonatomicretain |
Gets or sets the current position of the robot's arm.
This value is frequently overwritten with data read from the device, and setting it will generally have no effect. Set targetPosition and speed instead to make the robot's arm move.
|
readnonatomicassign |
Gets the robot's default speed.
|
readwritenonatomicretain |
Specifies the path that the robot should execute.
Note that the target position and speed cannot be updated manually while a path is executing. Set this property to nil to have the robot stop executing the current path.
|
readwritenonatomicassign |
Gets or sets whether the robot is currently in a paused state.
|
readwritenonatomicretain |
Gets or sets the desired speed of the robot's arm.
|
readwritenonatomicretain |
Gets or sets the target position of the robot's arm.
- (double) angleFromSteps: | (double) | steps | |
forMotor: | (int) | motorNumber | |
Converts a step count into an angle (in radians) for the given motor (1 through 4).
Does NOT round the step count to a whole number.
- (id) init |
Initializes a robot instance.
Connection to the actual robot device is automatic after the CBRobot instance is created.
- (CBMotorParameters *) motorParametersForMotor: | (int) | motorNumber |
Returns the set of parameters for the given motor (1 through 4).
- (void) setHomePosition |
Sets the current position as the new home position / zero position.
- (double) stepsFromAngle: | (double) | angle | |
forMotor: | (int) | motorNumber | |
Converts an angle (in radians) into a step count for the given motor (1 through 4).
Does NOT round the resulting step count to a whole number.