org.robokind.api.motion.servos
Interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,ServoType extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>

Type Parameters:
IdType - Identifier type used by this ServoController's Servos
ServoType - ServoController's Servo type
ServoConf - ServoConfig type
ControllerConf - ServoControllerConfig type
All Superinterfaces:
org.robokind.api.common.property.PropertyChangeSource
All Known Implementing Classes:
AbstractServoController

public interface ServoController<IdType,ServoConf extends ServoConfig<IdType>,ServoType extends Servo<IdType,ServoConf>,ControllerConf extends ServoControllerConfig<IdType,ServoConf>>
extends org.robokind.api.common.property.PropertyChangeSource

A ServoController provides control of a collection of Servos and the means of directly controlling them.

Author:
Matthew Stevenson

Nested Class Summary
static class ServoController.Id
          Id is an immutable globally unique identifier for a ServoController.
static class ServoController.ServoId<ServoIdType>
          ServoId is an immutable globally unique identifier for a Servo belonging to a Controller.
 
Field Summary
static String PROP_CONNECTION_STATUS
          Property string for ConnectionStatus.
static String PROP_ENABLED
          Property string for Enabled.
static String PROP_ERROR_MESSAGES
          Property string for ErrorMessages.
static String PROP_SERVO_ADD
          Property string for AddServo.
static String PROP_SERVO_REMOVE
          Property string for RemoveServo.
static String PROP_SERVOS
          Property string for Servos.
static String PROP_VERSION
          Used to specify the VersionProperty of a type of ServoController.
 
Method Summary
 boolean connect()
          Connects the ServoController to the underlying device to begin using.
 boolean containsId(ServoController.ServoId<IdType> id)
          Returns true if the controller contains a Servo for the given Servo id.
 boolean containsIds(Set<ServoController.ServoId<IdType>> ids)
          Returns true if the controller contains a Servo for each of the given Servo ids.
 boolean disconnect()
          Disconnects the underlying device, freeing any resources that have been locked.
 ControllerConf getConfig()
          Returns the ServoController's ServoControllerConfig.
 ConnectionStatus getConnectionStatus()
          Return the current ConnectionStatus.
 Boolean getEnabled()
          If enabled, this ServoController should accept move commands.
 List<String> getErrorMessages()
          Returns the current error messages.
 ServoController.Id getId()
          Returns the ServoController.Id identifying this ServoController.
 ServoType getServo(ServoController.ServoId<IdType> id)
          Returns the Servo with the given id.
 Class<IdType> getServoIdClass()
          Returns the Class of the Id used by the ServoController's Servos.
 List<ServoType> getServos()
          Returns a List of the controller's Servos.
 boolean moveAllServos(long lenMillisec)
          Move all of the controller's Servos.
 boolean moveServo(ServoController.ServoId<IdType> id, long lenMillisec)
          Move the Servo with the given Servo id to its goal position in the given time.
 boolean moveServos(ServoController.ServoId<IdType>[] ids, int len, int offset, long lenMillisec)
          Move the Servos with the given Servo ids to their goal positions.
 void setEnabled(Boolean enabled)
          If enabled, this ServoController should accept move commands.
 
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

PROP_VERSION

static final String PROP_VERSION
Used to specify the VersionProperty of a type of ServoController. This is used when registering a Service for a ServoController with OSGi.

See Also:
Constant Field Values

PROP_CONNECTION_STATUS

static final String PROP_CONNECTION_STATUS
Property string for ConnectionStatus.

See Also:
Constant Field Values

PROP_ERROR_MESSAGES

static final String PROP_ERROR_MESSAGES
Property string for ErrorMessages.

See Also:
Constant Field Values

PROP_SERVO_ADD

static final String PROP_SERVO_ADD
Property string for AddServo.

See Also:
Constant Field Values

PROP_SERVO_REMOVE

static final String PROP_SERVO_REMOVE
Property string for RemoveServo.

See Also:
Constant Field Values

PROP_SERVOS

static final String PROP_SERVOS
Property string for Servos.

See Also:
Constant Field Values

PROP_ENABLED

static final String PROP_ENABLED
Property string for Enabled.

See Also:
Constant Field Values
Method Detail

getId

ServoController.Id getId()
Returns the ServoController.Id identifying this ServoController.

Returns:

getServos

List<ServoType> getServos()
Returns a List of the controller's Servos.

Returns:
List of the controller's Servos

getServo

ServoType getServo(ServoController.ServoId<IdType> id)
Returns the Servo with the given id.

Parameters:
id - the Servo id
Returns:
Servo with the given id

containsIds

boolean containsIds(Set<ServoController.ServoId<IdType>> ids)
Returns true if the controller contains a Servo for each of the given Servo ids.

Parameters:
ids - Set of Servo ids to check
Returns:
true if the controller contains a Servo for each of the given Servo ids

containsId

boolean containsId(ServoController.ServoId<IdType> id)
Returns true if the controller contains a Servo for the given Servo id.

Parameters:
id - Servo id to check
Returns:
true if the controller contains a Servo for the given Servo id

connect

boolean connect()
Connects the ServoController to the underlying device to begin using. The ServoController is expected to be inoperable before calling connect.

Returns:
true if successfully connected

disconnect

boolean disconnect()
Disconnects the underlying device, freeing any resources that have been locked.

Returns:
true id successfully disconnected

moveServo

boolean moveServo(ServoController.ServoId<IdType> id,
                  long lenMillisec)
Move the Servo with the given Servo id to its goal position in the given time.

Parameters:
id - Servo id of the Servo to move
lenMillisec - number of milliseconds for the movement to take
Returns:
false if there is an error moving the Servo

moveServos

boolean moveServos(ServoController.ServoId<IdType>[] ids,
                   int len,
                   int offset,
                   long lenMillisec)
Move the Servos with the given Servo ids to their goal positions. If the controller does not contain a given id, that id is ignored.

Parameters:
ids - Servo ids of the Servos to move
len - number of ids
offset - start index
lenMillisec - number of milliseconds for the movement to take
Returns:
false is there is an error moving a Servo

moveAllServos

boolean moveAllServos(long lenMillisec)
Move all of the controller's Servos.

Parameters:
lenMillisec - number of milliseconds for the movement to take
Returns:
false if there is an error with one or more Servos

getConnectionStatus

ConnectionStatus getConnectionStatus()
Return the current ConnectionStatus.

Returns:
current ConnectionStatus

getErrorMessages

List<String> getErrorMessages()
Returns the current error messages.

Returns:
current error messages

getConfig

ControllerConf getConfig()
Returns the ServoController's ServoControllerConfig.

Returns:
this ServoController's ServoControllerConfig

setEnabled

void setEnabled(Boolean enabled)
If enabled, this ServoController should accept move commands. If not enabled, this ServoController should not move.

Parameters:
enabled -

getEnabled

Boolean getEnabled()
If enabled, this ServoController should accept move commands. If not enabled, this ServoController should not move.

Returns:
true if enabled

getServoIdClass

Class<IdType> getServoIdClass()
Returns the Class of the Id used by the ServoController's Servos.

Returns:
Class of the Id used by the ServoController's Servos


Copyright © 2011-2013. All Rights Reserved.