Base class#

#include "navground/sim/scenario.h"
struct Scenario : public virtual navground::core::HasRegister<Scenario>#

A scenario describes a distribution of World that can be sampled to perform an experiment.

Subclassed by navground::sim::AntipodalScenario, navground::sim::CollisionsScenario, navground::sim::CorridorScenario, navground::sim::CrossScenario, navground::sim::CrossTorusScenario, navground::sim::SimpleScenario

Public Types

using Type = Scenario#
using Init = std::function<void(World*, std::optional<unsigned>)>#

A world initializer: a function that takes as input world and optional seed and perform some initialization on the world.

using Inits = std::map<std::string, Init>#

A collection of world initializers

Public Functions

inline explicit Scenario(const Inits &inits = {})#

Constructs a new instance.

Parameters:

inits[in] The collection of world initializers to use.

virtual void init_world(World *world, std::optional<int> seed = std::nullopt)#

Initializes the world.

Parameters:
  • world – The world

  • seed – The random seed

std::shared_ptr<World> make_world(std::optional<int> seed = std::nullopt)#

Creates and initialize a world.

Parameters:

seed – The random seed

inline std::string add_init(const Init &initializer)#

Adds a world initializer.

Parameters:

initializer[in] The initializer

Returns:

The associated key

inline void set_init(const std::string &key, const Init &initializer)#

Sets a world initializer.

Parameters:
  • key[in] The key

  • initializer[in] The initializer

inline void remove_init(const std::string &key)#

Remove the last added world initializer.

Parameters:

key[in] The key

inline void clear_inits()#

Removed all initializers.

inline const Inits &get_inits() const#

Gets the world initializers.

Returns:

The initializers.

inline void add_group(const std::shared_ptr<Group> &group)#

Adds a group.

Parameters:

group[in] The group

inline void remove_group()#

Remove the last added group.

inline void clear_groups()#

Remove all groups.

inline void reset(std::optional<unsigned> index = std::nullopt)#

Public Members

std::vector<std::shared_ptr<Group>> groups#

Groups

std::vector<Disc> obstacles#

Obstacles

std::vector<LineSegment> walls#

Walls to add

std::map<std::string, std::shared_ptr<PropertySampler>> property_samplers#

A map of property samplers name -> sampler used configure the sampled object.

std::optional<sim::BoundingBox> bounding_box#

An optional bounding box

struct Group#

A group of agents that can be generated and added to the world.

Subclassed by navground::sim::AgentSampler< W >

Public Functions

virtual void add_to_world(World *world, std::optional<unsigned> seed = std::nullopt) = 0#

Generate and add agents to the world.

Parameters:
  • world – The world

  • seed – An optional random seed

virtual ~Group() = default#