Class temporal_penalty_handler

Inheritance Relationships

Base Types

  • public rer::client< temporal_penalty_handler >

  • public rmultithread::lockable

Class Documentation

class temporal_penalty_handler : public rer::client<temporal_penalty_handler>, public rmultithread::lockable

The penalty handler for penalties for robots (e.g. how long they have to wait when they pickup/drop a block).

Does not do much more than provide the penalty list, and functions for manipulating it to derived classes.

Public Types

using const_iterator_type = typename std::list<temporal_penalty>::const_iterator

Public Functions

temporal_penalty_handler(const ctv::config::temporal_penalty_config *const config, const std::string &name)

Initialize the penalty handler.

Parameters:
  • config – Parameters for temporal penalties.

  • name – The name of the handler, for differentiating handler instances in logging statements.

temporal_penalty_handler(const temporal_penalty_handler&) = delete
~temporal_penalty_handler(void) override = default
bool is_penalty_satisfied(const controller::base_controller &controller, const rtypes::timestep &t) const

Determine if a robot has satisfied the temporal_penalty it is currently serving yet.

Parameters:
  • controller – The robot to check. If the robot is not currently serving a penalty, FALSE will be returned.

  • timestep – The current timestep.

Returns:

TRUE If the robot is currently waiting AND it has satisfied its penalty.

bool is_serving_penalty(const controller::base_controller &controller, bool lock = true) const

If TRUE, then the specified robot is currently serving a cache penalty.

Parameters:
  • controller – The controller to check penalty serving for.

  • lock – Is locking required around penalty list modifications or not? Should ALWAYS be TRUE if the function is called external to this class.

inline const std::string &name(void) const

Get the name of the penalty handler (for debugging)

temporal_penalty_handler &operator=(const temporal_penalty_handler&) = delete
void penalty_abort(const controller::base_controller &controller)

Abort a robot’s serving of its penalty.

This should only be done if the robot aborts its task WHILE also serving a penalty.

Parameters:

controller – The robot to abort the penalty for.

rtypes::timestep penalty_calc(const rtypes::timestep &t) const

Calculate the penalty for a robot to serve for the operation, given the current timestep and the configured penalty waveform.

const_iterator_type penalty_find(const controller::base_controller &controller, bool lock = true) const
temporal_penalty penalty_next(void) const

Get the next penalty which will be satisfied from the list.

void penalty_remove(const temporal_penalty &victim, bool lock = true)

Remove the specified penalty from the list once the robot it corresponds to has served its penalty.

Parameters:
  • victim – The penalty to remove.

  • lock – Is locking required around penalty list modifications or not? Should ALWAYS be TRUE if the function is called external to this class.

Protected Functions

rtypes::timestep penalty_add(const controller::base_controller *controller, const rtypes::type_uuid &id, const rtypes::timestep &orig_duration, const rtypes::timestep &start)