cz.cuni.amis.pogamut.usar2004.agent.module.master
Class SensorSpecificModule<Module extends SuperSensor>

Package class diagram package SensorSpecificModule
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
      extended by cz.cuni.amis.pogamut.base.agent.module.SensorModule<USAR2004Bot>
          extended by cz.cuni.amis.pogamut.usar2004.agent.module.master.SensorSpecificModule<Module>
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.component.IComponent

public class SensorSpecificModule<Module extends SuperSensor>
extends cz.cuni.amis.pogamut.base.agent.module.SensorModule<USAR2004Bot>

Module that is used for particular Sensors. We can have multiple type of sensor mounted on our robot. We can use either SensorMasterModule/SensorMasterModuleQueued to gather all SEN messages or SensorSpecificModule to catch just the type we desire.

Author:
vejmanm

Field Summary
protected  boolean flagReaded
           
protected  Module sensor
           
protected  cz.cuni.amis.pogamut.usar2004.agent.module.master.SensorSpecificModule.SensorMessageListener sensorListener
           
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensorModule
worldView
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
agent, controller, eventBus, log
 
Constructor Summary
SensorSpecificModule(USAR2004Bot bot, Class<Module> c)
          Captures and provides data of the first sensor of respective type
SensorSpecificModule(USAR2004Bot bot, String name, Class<Module> c)
          If we know both type and name of sensor we want to get data from - this ctor is the one to use.
 
Method Summary
protected  void cleanUp()
           
protected  void fillModule(SensorMessage message)
          Updates sensor data when either the sensor name was not specified(Than it monitors the first Sensor of this type) or the type and name matches.
 Module getModule()
          Returns module of specified type by generics.
 boolean isReaded()
          Check method for making sure we don't use old value.
 Boolean isReady()
          Collection of sensor data check.
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sensorListener

protected cz.cuni.amis.pogamut.usar2004.agent.module.master.SensorSpecificModule.SensorMessageListener sensorListener

sensor

protected Module extends SuperSensor sensor

flagReaded

protected boolean flagReaded
Constructor Detail

SensorSpecificModule

public SensorSpecificModule(USAR2004Bot bot,
                            Class<Module> c)
Captures and provides data of the first sensor of respective type

Parameters:
bot - USAR2004Bot variable for creating sensor instance
c - Class definition of Generic class. Ideally we would want to say Module.class, but that is not possible

SensorSpecificModule

public SensorSpecificModule(USAR2004Bot bot,
                            String name,
                            Class<Module> c)
If we know both type and name of sensor we want to get data from - this ctor is the one to use.

Parameters:
bot - USAR2004Bot variable for creating sensor instance
name - Name of the module
c - Class definition of Generic class. Ideally we would want to say Module.class, but that is not possible
Method Detail

isReady

public Boolean isReady()
Collection of sensor data check.

Returns:
Returns false if either sensor collection is empty or null;

isReaded

public boolean isReaded()
Check method for making sure we don't use old value.

Returns:
Returns true if getModule() method was called sooner than a new message was listened and our sensor was updated.

getModule

public Module getModule()
Returns module of specified type by generics. That means we can call methods on this without the need to cast.

Returns:
Returns info about type of sensor picked by generic.

fillModule

protected void fillModule(SensorMessage message)
Updates sensor data when either the sensor name was not specified(Than it monitors the first Sensor of this type) or the type and name matches.

Parameters:
message -

cleanUp

protected void cleanUp()
Overrides:
cleanUp in class cz.cuni.amis.pogamut.base.agent.module.AgentModule<USAR2004Bot>


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.