Class block_carrying_controller

Inheritance Relationships

Base Type

  • public cssblocks::metrics::drop_metrics

Class Documentation

class block_carrying_controller : public cssblocks::metrics::drop_metrics

Defines the interface and common functionality for all controllers which are capable of carrying blocks.

Public Functions

block_carrying_controller(const block_carrying_controller&) = delete
block_carrying_controller(void) = default
virtual ~block_carrying_controller(void)
void block(std::unique_ptr<crepr::base_block3D> block)

Set the block that the robot is carrying. We use a unique_ptr to convey that the robot owns the block it picks up from a C++ point of view. In actuality it gets a clone of the block in the arena map.

inline crepr::base_block3D *block(void)
inline const crepr::base_block3D *block(void) const

Return the block robot is carrying, or NULL if the robot is not currently carrying a block.

virtual bool block_detect(const block_detect_context &context) = 0

If TRUE, then the robot thinks that it is on top of a block.

On rare occasions this may be a false positive, which is why it is also checked in the loop functions before passing any events to the controller. One such occasion that is known to occur is the first timestep, because the sensors have not yet finished initializing, and will return the values that are incidentally the same as those that correspond to a block being found.

std::unique_ptr<crepr::base_block3D> block_release(void)

Release the held block as part of a drop operation.

inline bool is_carrying_block(void) const

Return if the robot is currently carrying a block.

const block_carrying_controller &operator=(const block_carrying_controller&) = delete
void reset(void)