org.robokind.api.motion.servos
Class AbstractServo<Id,Conf extends ServoConfig<Id>,Ctrl extends ServoController<Id,Conf,? extends AbstractServo<Id,Conf,Ctrl>,? extends ServoControllerConfig<Id,Conf>>>

java.lang.Object
  extended by org.robokind.api.common.property.PropertyChangeNotifier
      extended by org.robokind.api.motion.servos.AbstractServo<Id,Conf,Ctrl>
Type Parameters:
Id - Identifier type for this Servo
Conf - ServoConfig type for this Servo
Ctrl - Servo's parent ServoController's type
All Implemented Interfaces:
PropertyChangeListener, EventListener, org.robokind.api.common.property.PropertyChangeSource, Servo<Id,Conf>

public abstract class AbstractServo<Id,Conf extends ServoConfig<Id>,Ctrl extends ServoController<Id,Conf,? extends AbstractServo<Id,Conf,Ctrl>,? extends ServoControllerConfig<Id,Conf>>>
extends org.robokind.api.common.property.PropertyChangeNotifier
implements Servo<Id,Conf>, PropertyChangeListener

Abstract implementation providing much of the functionality need to implement various Servos.

Author:
Matthew Stevenson

Field Summary
protected  Conf myConfig
          The Servo's configuration parameters.
protected  Ctrl myController
          The Servo's parent ServoController.
protected  org.robokind.api.common.position.NormalizedDouble myGoalPosition
          The Servo's current goal position.
protected  Id myServoId
          The Servo's Id
 
Fields inherited from interface org.robokind.api.motion.servos.Servo
PROP_ENABLED, PROP_GOAL_POSITION
 
Constructor Summary
AbstractServo(Conf config, Ctrl controller)
          Creates a new AbstractServo from the given Servo configuration parameters and ServoController.
 
Method Summary
 Integer getAbsoluteGoalPosition()
          Returns the absolute goal position as used by the ServoController.
 Conf getConfig()
          Returns the Servo's configuration values.
 Ctrl getController()
          Returns the Servo's parent ServoController.
 org.robokind.api.common.position.NormalizedDouble getGoalPosition()
          Returns the goal position.
 Id getId()
          Returns the Servo's id.
 org.robokind.api.common.position.NormalizableRange<Double> getPositionRange()
          Returns the NormalizableRange describing the range of motion.
 void propertyChange(PropertyChangeEvent pce)
           
 void setGoalPosition(org.robokind.api.common.position.NormalizedDouble pos)
          Sets the goal position.
 
Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, 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.motion.servos.Servo
getDefaultPosition, getEnabled, getMaxPosition, getMinPosition, getName, setEnabled
 
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

myServoId

protected Id myServoId
The Servo's Id


myConfig

protected Conf extends ServoConfig<Id> myConfig
The Servo's configuration parameters.


myController

protected Ctrl extends ServoController<Id,Conf,? extends AbstractServo<Id,Conf,Ctrl>,? extends ServoControllerConfig<Id,Conf>> myController
The Servo's parent ServoController.


myGoalPosition

protected org.robokind.api.common.position.NormalizedDouble myGoalPosition
The Servo's current goal position.

Constructor Detail

AbstractServo

public AbstractServo(Conf config,
                     Ctrl controller)
Creates a new AbstractServo from the given Servo configuration parameters and ServoController.

Parameters:
config - Servo configuration parameters
controller - Servo's parent ServoController
Method Detail

getId

public Id getId()
Description copied from interface: Servo
Returns the Servo's id.

Specified by:
getId in interface Servo<Id,Conf extends ServoConfig<Id>>
Returns:
Servo's id

getController

public Ctrl getController()
Description copied from interface: Servo
Returns the Servo's parent ServoController.

Specified by:
getController in interface Servo<Id,Conf extends ServoConfig<Id>>
Returns:
Servo's parent ServoController

getConfig

public Conf getConfig()
Description copied from interface: Servo
Returns the Servo's configuration values.

Specified by:
getConfig in interface Servo<Id,Conf extends ServoConfig<Id>>
Returns:
Servo's configuration values

getGoalPosition

public org.robokind.api.common.position.NormalizedDouble getGoalPosition()
Description copied from interface: Servo
Returns the goal position.

Specified by:
getGoalPosition in interface Servo<Id,Conf extends ServoConfig<Id>>
Returns:
current goal position

getAbsoluteGoalPosition

public Integer getAbsoluteGoalPosition()
Returns the absolute goal position as used by the ServoController.

Returns:
the absolute goal position as used by the ServoController

setGoalPosition

public void setGoalPosition(org.robokind.api.common.position.NormalizedDouble pos)
Description copied from interface: Servo
Sets the goal position.

Specified by:
setGoalPosition in interface Servo<Id,Conf extends ServoConfig<Id>>
Parameters:
pos - the goal position

propertyChange

public void propertyChange(PropertyChangeEvent pce)
Specified by:
propertyChange in interface PropertyChangeListener

getPositionRange

public org.robokind.api.common.position.NormalizableRange<Double> getPositionRange()
Description copied from interface: Servo
Returns the NormalizableRange describing the range of motion.

Specified by:
getPositionRange in interface Servo<Id,Conf extends ServoConfig<Id>>
Returns:
NormalizableRange describing the range of motion


Copyright © 2011-2013. All Rights Reserved.