org.robokind.impl.motion.pololu
Class MaestroController
java.lang.Object
org.robokind.api.common.property.PropertyChangeNotifier
org.robokind.api.motion.servos.AbstractServoController<Id,ServoConf,S,ControllerConf>
org.robokind.impl.motion.serial.SerialServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
org.robokind.impl.motion.pololu.MaestroController
- All Implemented Interfaces:
- org.robokind.api.common.property.PropertyChangeSource, org.robokind.api.motion.servos.ServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
public class MaestroController
- extends org.robokind.impl.motion.serial.SerialServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
ServoController for a Pololu Mini-Maestro servo control board.
- Author:
- Matthew Stevenson
Nested classes/interfaces inherited from interface org.robokind.api.motion.servos.ServoController |
org.robokind.api.motion.servos.ServoController.Id, org.robokind.api.motion.servos.ServoController.ServoId<ServoIdType> |
Fields inherited from class org.robokind.impl.motion.serial.SerialServoController |
myPort, myTimeoutLength |
Fields inherited from class org.robokind.api.motion.servos.AbstractServoController |
myChangeMonitor, myConfig, myConnectionStatus, myServoMap, myServos |
Fields inherited from interface org.robokind.api.motion.servos.ServoController |
PROP_CONNECTION_STATUS, PROP_ENABLED, PROP_ERROR_MESSAGES, PROP_SERVO_ADD, PROP_SERVO_REMOVE, PROP_SERVOS, PROP_VERSION |
Methods inherited from class org.robokind.impl.motion.serial.SerialServoController |
connect, disconnect, getErrorMessages, setTimeoutLength |
Methods inherited from class org.robokind.api.motion.servos.AbstractServoController |
addingServo, addServo, changeServoId, containsId, containsIds, getConfig, getConnectionStatus, getId, getServo, getServos, removeServo, removingServo, servoId, setConnectStatus |
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier |
addPropertyChangeListener, addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource |
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
VERSION_NAME
public static final String VERSION_NAME
- Controller type version name.
- See Also:
- Constant Field Values
VERSION_NUMBER
public static final String VERSION_NUMBER
- Controller type version number.
- See Also:
- Constant Field Values
VERSION
public static final org.robokind.api.common.config.VersionProperty VERSION
- Controller type version.
MaestroController
public MaestroController(MaestroControllerConfig config)
- Creates a MaestroController from the given SerialServoControllerConfig.
- Parameters:
config
- SerialServoControllerConfig for creating the controller
setServos
protected boolean setServos()
- Specified by:
setServos
in class org.robokind.impl.motion.serial.SerialServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
moveServo
public boolean moveServo(org.robokind.api.motion.servos.ServoController.ServoId<MaestroServo.Id> id,
long lenMillisec)
moveServos
public boolean moveServos(org.robokind.api.motion.servos.ServoController.ServoId<MaestroServo.Id>[] ids,
int len,
int offset,
long lenMillisec)
- Moves the joints with the given ids.
The Pololu protocol allows for consecutive servos to be moved with a
single command. To take advantage of this, we must find the consecutive
blocks of physical ids from the given list of logical ids.
First we mad logical ids to physical ids, and sort the array.
Then we iterate through the sorted ids and find the consecutive runs.
- Parameters:
ids
- list of Logical Ids of Servos to move.
- Returns:
- true if the joints were successfully moved.
moveConsecutiveServos
protected boolean moveConsecutiveServos(MaestroServo.Id startId,
byte count)
- Moves multiple Servos with consecutive physical ids in a single command.
WARNING: This does not check if the the Servo is enabled.
- Parameters:
startId
- physical id of the first Servo in the sequencecount
- number of joint in the sequence to move
- Returns:
- true if successful
moveAllServos
public boolean moveAllServos(long lenMillisec)
connectServo
protected MaestroServo connectServo(org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id> config)
- Specified by:
connectServo
in class org.robokind.api.motion.servos.AbstractServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
disconnectServo
protected boolean disconnectServo(org.robokind.api.motion.servos.ServoController.ServoId<MaestroServo.Id> id)
- Specified by:
disconnectServo
in class org.robokind.api.motion.servos.AbstractServoController<MaestroServo.Id,org.robokind.api.motion.servos.config.ServoConfig<MaestroServo.Id>,MaestroServo,MaestroControllerConfig>
changeServoPhysicalId
protected void changeServoPhysicalId(MaestroServo.Id oldId,
MaestroServo.Id newId)
- Changes the physical id of the Servo and notifies listeners.
- Parameters:
oldId
- previous physical idnewId
- new physical id
setEnabled
public void setEnabled(Boolean enabled)
getEnabled
public Boolean getEnabled()
getServoIdClass
public Class<MaestroServo.Id> getServoIdClass()
Copyright © 2011. All Rights Reserved.