Class SensorActuator
- java.lang.Object
-
- jadex.quickstart.cleanerworld.environment.SensorActuator
-
public class SensorActuator extends java.lang.Object
The sensor / actuator gives access to the perceived environment and provides operations to manipulate the environment. Each cleaner agent should create its own sensor/actuator.
-
-
Field Summary
Fields Modifier and Type Field Description IInternalAccess
agent
The agent.
-
Constructor Summary
Constructors Constructor Description SensorActuator()
Create a sensor for a new cleaner robot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dropWasteInWastebin(IWaste waste, IWastebin wastebin)
Drop a piece of waste.java.util.Set<IChargingstation>
getChargingstations()
Get the known charging stations.java.util.Set<ICleaner>
getCleaners()
Get the known other cleaners.ICleaner
getSelf()
Get the knowledge about the cleaner itself.ILocation
getTarget()
Get the current movement target, if any.java.util.Set<IWastebin>
getWastebins()
Get the known waste pieces.java.util.Set<IWaste>
getWastes()
Get the known waste pieces.boolean
isDaytime()
Check, if it is at day or at night.void
manageChargingstationsIn(java.util.Set<IChargingstation> chargingstations)
Use the provided set to manage the known charging station objects.void
manageCleanersIn(java.util.Set<ICleaner> cleaners)
Use the provided set to manage the known cleaner objects.void
manageWastebinsIn(java.util.Set<IWastebin> wastebins)
Use the provided set to manage the known waste bin objects.void
manageWastesIn(java.util.Set<IWaste> wastes)
Use the provided set to manage the known waste objects.void
moveTo(double x, double y)
Move to the given location.void
moveTo(ILocation location)
Move to the given location.void
pickUpWaste(IWaste waste)
Try to pick up some piece of waste.void
recharge(IChargingstation chargingstation, double level)
Recharge a cleaner at a charging station to a desired charging level.
-
-
-
Field Detail
-
agent
public IInternalAccess agent
The agent. Must be public due to Java Reflection Restrictions
-
-
Method Detail
-
getSelf
public ICleaner getSelf()
Get the knowledge about the cleaner itself.- Returns:
- The cleaner object.
-
isDaytime
public boolean isDaytime()
Check, if it is at day or at night.- Returns:
- true, if at day.
-
getCleaners
public java.util.Set<ICleaner> getCleaners()
Get the known other cleaners.- Returns:
- a Set of Cleaner objects.
-
getWastes
public java.util.Set<IWaste> getWastes()
Get the known waste pieces.- Returns:
- a Set of Waste objects.
-
getChargingstations
public java.util.Set<IChargingstation> getChargingstations()
Get the known charging stations.- Returns:
- a Set of Chargingstation objects.
-
getWastebins
public java.util.Set<IWastebin> getWastebins()
Get the known waste pieces.- Returns:
- a Set of Waste objects.
-
manageWastesIn
public void manageWastesIn(java.util.Set<IWaste> wastes)
Use the provided set to manage the known waste objects. Allows using custom data structures such as BDI belief sets directly.
-
manageWastebinsIn
public void manageWastebinsIn(java.util.Set<IWastebin> wastebins)
Use the provided set to manage the known waste bin objects. Allows using custom data structures such as BDI belief sets directly.
-
manageChargingstationsIn
public void manageChargingstationsIn(java.util.Set<IChargingstation> chargingstations)
Use the provided set to manage the known charging station objects. Allows using custom data structures such as BDI belief sets directly.
-
manageCleanersIn
public void manageCleanersIn(java.util.Set<ICleaner> cleaners)
Use the provided set to manage the known cleaner objects. Allows using custom data structures such as BDI belief sets directly.
-
moveTo
public void moveTo(ILocation location)
Move to the given location. Blocks until the location is reached or a failure occurs.- Parameters:
location
- The location.
-
moveTo
public void moveTo(double x, double y)
Move to the given location. Blocks until the location is reached or a failure occurs.- Parameters:
x
- X coordinate.y
- Y coordinate.
-
recharge
public void recharge(IChargingstation chargingstation, double level)
Recharge a cleaner at a charging station to a desired charging level. The cleaner needs to be at the location of the charging station Note, the charging rate gets slower over 70% charge state.- Parameters:
chargingstation
- The charging station to recharge at.level
- The desired charging level between 0 and 1.
-
getTarget
public ILocation getTarget()
Get the current movement target, if any.- Returns:
- The target or null when no current target.
-
pickUpWaste
public void pickUpWaste(IWaste waste)
Try to pick up some piece of waste.- Parameters:
waste
- The waste.
-
-