Cardboard Robot SDK
 All Classes Functions Properties
Properties | Public Member Functions | List of all members
CBRobot Class Reference

Detailed Description

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.
CBArmPositioncurrentPosition
 Gets or sets the current position of the robot's arm.
CBArmPositiontargetPosition
 Gets or sets the target position of the robot's arm.
CBArmSpeedspeed
 Gets or sets the desired speed of the robot's arm.
CBArmSpeeddefaultSpeed
 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< CBPathpath
 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.

Property Documentation

- (double) armLength1
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.

- (double) armLength2
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.

- (BOOL) connected
readnonatomicassign

Gets whether or not the robot device is currently connected.

Connection to the device is automatic; there's no need to manually connect.

- (CBArmPosition*) currentPosition
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.

- (CBArmSpeed*) defaultSpeed
readnonatomicassign

Gets the robot's default speed.

- (id<CBPath>) path
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.

- (BOOL) paused
readwritenonatomicassign

Gets or sets whether the robot is currently in a paused state.

- (CBArmSpeed*) speed
readwritenonatomicretain

Gets or sets the desired speed of the robot's arm.

- (CBArmPosition*) targetPosition
readwritenonatomicretain

Gets or sets the target position of the robot's arm.

Member Function Documentation

- (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.


The documentation for this class was generated from the following files: