Template Class pd_adaptor

Inheritance Relationships

Base Types

Class Documentation

template<typename TController>
class pd_adaptor : public rer::client<pd_adaptor<TController>>, public cosm::tv::population_dynamics

Adapts ctv::population_dynamics to work within the ARGoS simulator.

Template Parameters:

TControllertype – Must be one of the argos 2D/Q3D controllers, BUT can also be a block carrying controller.

Public Types

using env_dynamics_type = ctv::env_dynamics<TController>
template<typename T>
using is2D = std::is_base_of<cpargos::controller::adaptor2D, T>
template<typename T>
using isQ3D = std::is_base_of<cpargos::controller::adaptorQ3D, T>

Public Functions

pd_adaptor(const ctv::config::population_dynamics_config *config, cpargos::swarm_manager_adaptor *sm, env_dynamics_type *envd, const rmath::vector2d &arena_dim, rmath::rng *rng)
pd_adaptor(const pd_adaptor&) = delete
const pd_adaptor &operator=(const pd_adaptor&) = delete
inline virtual void pre_kill_cleanup(TController*)

Handle any cleanup for the specified controller that needs to be performed on it to maintain simulation fidelity before it is permanently removed from the simulation. Examples:

  • The robot is currently carrying a block, and you don’t want that block to be permanently lost after the robot is killed.

virtual op_result robot_add(int max_pop, const rtypes::type_uuid &id) override

Add a new robot to the swarm with the specified ID.

Parameters:
  • max_pop – Maximum swarm population (-1 indicates no limit)

  • id – The ID of the robot to add.

Returns:

The ID of the robot that was added (rtypes::constants::kNoUUID if the robot could not be added), along with the current swarm size.

virtual op_result robot_kill(void) override

Kill a random robot within the swarm.

Returns:

The ID of the robot that was added (rtypes::constants::kNoUUID if the robot could not be killed), along with the current swarm size.

virtual op_result robot_malfunction(void) override

Temporarily remove a robot from simulation/the swarm.

Returns:

The ID of the robot that was temporarily removed (rtypes::constants::kNoUUID if no robot could be removed), along with the current swarm size.

virtual op_result robot_repair(const rtypes::type_uuid &id) override

Restore a the specified robot which had been temporarily removed from the swarm/simulation.

Returns:

The ID of the robot that was restored (rtypes::constants::kNoUUID if no robot could be restored), along with the current swarm size.

Public Static Attributes

static constexpr const size_t kMaxOperationAttempts = 1000

When adding/removing a robot, try this many times to complete the operation.