de.jaetzold.art
Class RawActuator

java.lang.Object
  |
  +--de.jaetzold.art.RawSensor
        |
        +--de.jaetzold.art.RawActuator
All Implemented Interfaces:
Actuator, EventListener, PropertyChangeListener, Sensor, SensorPeer
Direct Known Subclasses:
Motor

public class RawActuator
extends RawSensor
implements Actuator

This class represents a basic output-device of a hardware-interface. Each output device, such as an Actuator or a Motor needs to be connected to an ActuatorPort first. Through connecting with a Port this Object gets its peer which is required for proper use.

See Also:
connectWith(ActuatorPort)

Inner classes inherited from class de.jaetzold.art.RawSensor
RawSensor.ValueSensorPort
 
Field Summary
protected  boolean localReturn
          This is false by default.
protected  VetoableChangeSupport vetos
           
protected  boolean waitForCompletion
          This is true by default.
 
Fields inherited from class de.jaetzold.art.RawSensor
changes, precision, precisionSet, propertyChangeEventDescriptor
 
Constructor Summary
RawActuator()
           
 
Method Summary
 void addVetoableChangeListener(VetoableChangeListener l)
          For Listeners which can refuse some values to be set.
 void connectWith(ActuatorPort port)
          Connects this Object with the given Port.
 void connectWith(SensorPort port)
          Connects this Sensor with the given Port.
protected  double convertToActuatorIncoming(double externalValue)
           
protected  double convertToActuatorOutgoing(double internalValue)
           
 void disconnect()
          Disconnects this Sensor from it's Peer and it's Port.
 Conversion getActuatorIncomingConversionDelegate()
           
 Conversion getActuatorOutgoingConversionDelegate()
           
 boolean getLocalReturn()
          Returns the whether value-returning methods assume no one else is using this Actuator.
 double getValue()
          Returns the value this Sensor represents as a double.
 boolean getWaitForCompletion()
          Returns the default for synchronous or asynchronous behavior of state-changing methods.
 void removeVetoableChangeListener(VetoableChangeListener l)
          For Listeners which can refuse some values to be set.
 void setActuatorIncomingConversionDelegate(Conversion delegate)
           
 void setActuatorOutgoingConversionDelegate(Conversion delegate)
           
 void setLocalReturn(boolean returnMode)
          Controls the behaviour of value-returning Methods.
 void setReversed(boolean reversed)
          Controls whether this Actuator should treat negative values as positive and the other way round.
 void setValue(double value)
          Set this Actuator to the value given as a parameter.
 void setValue(double value, boolean waitMode)
          Set this Actuator to the Value given as a parameter.
 void setWaitForCompletion(boolean waitMode)
          Controls when state-changing Methods return.
 
Methods inherited from class de.jaetzold.art.RawSensor
addPropertyChangeListener, addSensorListener, addSensorListener, connectWith, convertToIncoming, convertToOutgoing, disableEvent, enableEvent, getChangeEventsEnabled, getDeliversFloatingPoint, getIncomingConversionDelegate, getIntValue, getOutgoingConversionDelegate, getPeer, getPeerCacheEnabled, getPort, getPrecision, getSensorPort, isConnected, isIncomingConversionCacheable, isOutgoingConversionCacheable, isReversed, processEvent, propertyChange, removePropertyChangeListener, removeSensorListener, removeSensorListener, setChangeEventsEnabled, setIncomingConversionDelegate, setOutgoingConversionDelegate, setPeerCacheEnabled, setPrecision, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.jaetzold.art.Sensor
addPropertyChangeListener, addSensorListener, connectWith, getIntValue, getPort, getPrecision, getSensorPort, isConnected, processEvent, propertyChange, removePropertyChangeListener, removeSensorListener, update
 

Field Detail

vetos

protected VetoableChangeSupport vetos

waitForCompletion

protected boolean waitForCompletion
This is true by default.
See Also:
setWaitForCompletion(boolean)

localReturn

protected boolean localReturn
This is false by default.
See Also:
setLocalReturn(boolean)
Constructor Detail

RawActuator

public RawActuator()
Method Detail

convertToActuatorOutgoing

protected double convertToActuatorOutgoing(double internalValue)

convertToActuatorIncoming

protected double convertToActuatorIncoming(double externalValue)

setActuatorIncomingConversionDelegate

public void setActuatorIncomingConversionDelegate(Conversion delegate)

getActuatorIncomingConversionDelegate

public Conversion getActuatorIncomingConversionDelegate()

setActuatorOutgoingConversionDelegate

public void setActuatorOutgoingConversionDelegate(Conversion delegate)

getActuatorOutgoingConversionDelegate

public Conversion getActuatorOutgoingConversionDelegate()

setValue

public void setValue(double value)
Description copied from interface: Actuator
Set this Actuator to the value given as a parameter. If this Actuator is connected with an ActuatorPeer the Peer is informed about this, otherwise an Exception might be thrown.
Specified by:
setValue in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
Parameters:
value - the value this Actuator should have.
Throws:
NotConnectedException - if this Actuator has no Peer or the Peer itself isn't connected (e.g. because the connection to the hardware went down)
See Also:
Actuator.setValue(double,boolean), Actuator.setWaitForCompletion(boolean)

setValue

public void setValue(double value,
                     boolean waitMode)
Description copied from interface: Actuator
Set this Actuator to the Value given as a parameter. If waitForCompletion is false this method may return before the new value has been sent to the hardware. This way the method could return almost immediatly and informing the peer and thus the hardware may happen asynchronous. If for some reason the value is not o.k. for this Actuator it is not required to accept the value and it is also not required to report that through an Exception. It may fail for example if one of the registered VetoableChangeListener-instances vetoes. In this case the method should return without changing anything.
Specified by:
setValue in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
Parameters:
value - the value this Actuator should have.
waitForCompletion - whether this method may set the value asynchronous.
Throws:
NotConnectedException - if this Actuator has no Peer or the Peer itself isn't connected (e.g. because the connection to the hardware went down)
See Also:
Actuator.setWaitForCompletion(boolean), Actuator.setValue(double), Sensor.isConnected(), Actuator.addVetoableChangeListener(VetoableChangeListener)

getValue

public double getValue()
Description copied from interface: Sensor
Returns the value this Sensor represents as a double.
Specified by:
getValue in interface Sensor
Overrides:
getValue in class RawSensor

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener l)
Description copied from interface: Actuator
For Listeners which can refuse some values to be set. This is for now not really used and tested in ART, but at least RawActuator makes takes these listeners into account.
Specified by:
addVetoableChangeListener in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
See Also:
setValue(double)

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener l)
Description copied from interface: Actuator
For Listeners which can refuse some values to be set.
Specified by:
removeVetoableChangeListener in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
See Also:
Actuator.addVetoableChangeListener(VetoableChangeListener)

disconnect

public void disconnect()
Description copied from interface: Sensor
Disconnects this Sensor from it's Peer and it's Port. This is implicitly called when the Sensor is already connected and asked to connect with another Port.
Specified by:
disconnect in interface Sensor
Overrides:
disconnect in class RawSensor
Following copied from interface: de.jaetzold.art.Sensor
See Also:
Sensor.connectWith(Port)

connectWith

public void connectWith(ActuatorPort port)
Connects this Object with the given Port. This sets the peer for this Object and is therefore required before it can be properly used.

connectWith

public void connectWith(SensorPort port)
Description copied from class: RawSensor
Connects this Sensor with the given Port. The Sensor gets its peer from the Port so it is therefore required before the Sensor can be properly used.
Overrides:
connectWith in class RawSensor
Following copied from class: de.jaetzold.art.RawSensor
See Also:
RawSensor.ValueSensorPort, RawSensor.connectWith(Port)

setReversed

public void setReversed(boolean reversed)
Controls whether this Actuator should treat negative values as positive and the other way round. That way this state defines what "+" for the algorithm means for the robot.
Overrides:
setReversed in class RawSensor

getWaitForCompletion

public boolean getWaitForCompletion()
Description copied from interface: Actuator
Returns the default for synchronous or asynchronous behavior of state-changing methods.
Specified by:
getWaitForCompletion in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
See Also:
Actuator.setWaitForCompletion(boolean)

setWaitForCompletion

public void setWaitForCompletion(boolean waitMode)
Description copied from interface: Actuator
Controls when state-changing Methods return. If waitMode is true, every Method which changes the state of the Actuator should per default wait until the update in the Hardware-Interface had happened. This does not block the Method from returning because of a timeout. Setting this to false means the calls can happen asynchronous (but retain order).
Specified by:
setWaitForCompletion in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
Parameters:
waitMode - whether state-changing methods may return immediately
See Also:
Actuator.setValue(double), ActuatorPeer.setValue(double,boolean)

getLocalReturn

public boolean getLocalReturn()
Description copied from interface: Actuator
Returns the whether value-returning methods assume no one else is using this Actuator.
Specified by:
getLocalReturn in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
See Also:
Actuator.setLocalReturn(boolean)

setLocalReturn

public void setLocalReturn(boolean returnMode)
Description copied from interface: Actuator
Controls the behaviour of value-returning Methods. If it is true, every Method returns the value this Actuator wants the Hardware-Output to resemble. If it is false the value the Peer thinks this Hardware-Output really has is returned.
Specified by:
setLocalReturn in interface Actuator
Following copied from interface: de.jaetzold.art.Actuator
Parameters:
returnMode - whether value-returning methods should assume that the value last set is the one the Actuator really has.
See Also:
Sensor.getValue()