Class CoverageRobot

Inheritance Relationships

Derived Types

Class Documentation

class CoverageRobot

A class for the coverage planning execution framework.

Handles the plan/execute/observe cycle.

Members:

  • _initLoc: The robot’s initial location for each episode

  • _currentLoc: The robot’s current GridCell

  • _visited: A vector of locations visited by the robot (i.e. the history)

  • _timeBound: The maximum number of timesteps given to the robot

  • _xDim: The x dimension of the map

  • _yDim: The y dimension of the map

  • _bimac: The BIMac model the robot is learning

  • _groundTruthIMac: The ground truth IMac model, if specified

  • _estimationType: The type of parameter estimation for each episode’s IMac instance

Subclassed by POMDPCoverageRobot, RandomCoverageRobot

Public Functions

inline CoverageRobot(const GridCell &initLoc, int timeBound, int xDim, int yDim, std::shared_ptr<IMac> groundTruthIMac = nullptr, const ParameterEstimate &estimationType = ParameterEstimate::posteriorSample)

Initialises all member variables.

Parameters:
  • initLoc – The robot’s initial grid cell

  • timeBound – The maximum number of timesteps given to the robot

  • xDim – The length of the x dimension of the environment

  • yDim – The length of the y dimension of the environment

  • groundTruthIMac – The ground truth IMac (if we want to test planning without BiMac)

  • estimationType – The type of parameter estimation for each episode’s IMac instance

Action planNextAction(int time, std::shared_ptr<IMac> imac, const std::vector<IMacObservation> &obsVector)

Wrapper around _planFn which fills in the gaps from class members.

Parameters:
  • time – The current timestep

  • imac – The current imac estimate generated from _bimac

  • obsVector – A vector of the current observations made by the robot

Returns:

The next action for the robot to execute

ActionOutcome executeAction(const Action &action)

Wrapper around _executeFn which fills in the gaps from class members.

Parameters:

action – The action the robot should execute

Returns:

The outcome of the action

std::vector<IMacObservation> makeObservations()

Wrapper around _observeFn which fills in the gaps from class members.

Returns:

A vector of observations

void logVisitedLocations(const std::filesystem::path &outFile)

Logs a set of visited nodes to file.

Parameters:

outFile – The csv file to write the visited locations to

CoverageResult runCoverageEpisode(const std::filesystem::path &outFile)

Run the plan-execute-observe cycle for a single episode, up to _timeBound.

Parameters:

outFile – The csv file to output visited locations to

Returns:

The result (end time and prop covered) of coverage planning

virtual void episodeSetup(const GridCell &startLoc, const int &ts, const int &timeBound, std::shared_ptr<IMac> imacForEpisode)

Runs necessary setup for an episode, such as creating a planner.

Parameters:
  • startLoc – The robot’s initial location for the episode

  • ts – The initial timestep

  • timeBound – The episode time bound, which could change

  • imacForEpisode – The IMac instance being used for the planning episode

virtual void episodeCleanup()

Used for cleaning up memory/resetting things upon the end of an episode.

inline std::shared_ptr<BIMac> getBIMac()

Getter for the BIMac model.

Getter useful in case user wishes to write to file etc.

Returns:

A shared ptr to a BIMac instance

Protected Functions

void _printCurrentTransition(const GridCell &startLoc, const ActionOutcome &outcome)

Function for printing current transition to stdout.

Parameters:
  • startLoc – The robot’s location at the start of the transition

  • outcome – The action outcome

virtual Action _planFn(const GridCell &currentLoc, const std::vector<Action> &enabledActions, int ts, int timeBound, std::shared_ptr<IMac> imac, const std::vector<GridCell> &visited, const std::vector<IMacObservation> &currentObs) = 0

Internal function which generates the next action to be executed.

Wrapped around by planNextAction, which passes in the parameters.

Parameters:
  • currentLoc – The robot’s current location

  • enabledActions – A vector of enabled actions in this state

  • ts – The current timestep

  • timeBound – The time bound

  • imac – The current IMac instance

  • visited – The vector of visited locations

  • currentObs – The most recent observations

Returns:

The next action to be executed

virtual ActionOutcome _executeFn(const GridCell &currentLoc, const Action &action) = 0

Internal function for executing actions.

Wrapped around by executeAction, which passes in parameters.

Parameters:
  • currentLoc – The robot’s current location

  • action – The action to execute

Returns:

The outcome of the action

virtual std::vector<IMacObservation> _observeFn(const GridCell &currentLoc) = 0

Internal function for making observations.

Wrapped around by makeObservations, which passes in parameters.

Parameters:

currentLoc – The robot’s current location

Returns:

A vector of observations

Protected Attributes

const int _xDim = {}
const int _yDim = {}