delphyne
AgentSimulationBaseBuilder< T > Class Template Reference

Detailed Description

template<typename T>
class delphyne::AgentSimulationBaseBuilder< T >

A builder for agent-based simulations.

For a system-level architecture diagram, see #5541.

Template Parameters
Oneof double, delphyne::AutoDiff or delphyne::Symbolic.

Instantiated templates for the following types are provided:

  • double

#include <src/backend/agent_simulation_builder.h>

Public Member Functions

 AgentSimulationBaseBuilder ()
 
const maliput::api::RoadGeometryGetRoadGeometry () const
 Gets the RoadGeometry from this simulation. More...
 
const maliput::api::RoadNetworkSetRoadNetwork (std::unique_ptr< maliput::api::RoadNetwork > road_network)
 Sets the RoadNetwork for this simulation and use its road geometry. More...
 
const maliput::api::RoadNetworkSetRoadNetwork (std::unique_ptr< maliput::api::RoadNetwork > road_network, const maliput::utility::ObjFeatures &features)
 Sets the RoadNetwork for this simulation. More...
 
template<class Blueprint , typename... BlueprintArgs>
Blueprint * AddAgent (BlueprintArgs &&... args)
 Constructs a Blueprint in-place and uses it to build and take ownership of an agent, which is to be wired into the simulation. More...
 
template<template< typename U > class BaseBlueprint, typename... BlueprintArgs>
BaseBlueprint< T > * AddAgent (BlueprintArgs &&... args)
 Constructs a Blueprint in-place and uses it to build and take ownership of an agent, which is to be wired into the simulation. More...
 
template<class Blueprint >
Blueprint * AddAgent (std::unique_ptr< Blueprint > blueprint)
 Uses the given blueprint to build and take ownership of an agent, which is to be wired into the simulation. More...
 
std::unique_ptr< AgentSimulationBase< T > > Build ()
 Builds the simulation. More...
 
void Reset ()
 Resets the builder internal state, leaving it ready for another building procedure. More...
 
void SetTargetRealTimeRate (double realtime_rate)
 Sets the target real-time rate for the simulation to be built. More...
 
double GetTargetRealTimeRate () const
 Gets the target real-time rate for the simulation to be built. More...
 
bool UsesFixedStepMode () const
 Whether the simulation's integrator should work on a fixed step basis or not. More...
 
const T & GetMaxStepSize () const
 Gets maximum integration step size for the simulation to be built. More...
 

Constructor & Destructor Documentation

◆ AgentSimulationBaseBuilder()

Member Function Documentation

◆ AddAgent() [1/3]

Blueprint* AddAgent ( BlueprintArgs &&...  args)

Constructs a Blueprint in-place and uses it to build and take ownership of an agent, which is to be wired into the simulation.

Parameters
argsBlueprint constructor arguments.
Returns
A bare pointer to the added AgentBaseBlueprint<T> instance, which will remain valid for the lifetime of this simulation builder.
Exceptions
std::runtime_errorif another agent with the same name has been wired already.
Template Parameters
BlueprintAn AgentBaseBlueprint<T> subclass.
BlueprintArgsBlueprint constructor arguments types.

◆ AddAgent() [2/3]

BaseBlueprint<T>* AddAgent ( BlueprintArgs &&...  args)

Constructs a Blueprint in-place and uses it to build and take ownership of an agent, which is to be wired into the simulation.

Parameters
argsBlueprint constructor arguments.
Returns
A bare pointer to the added AgentBaseBlueprint<T> instance, which will remain valid for the lifetime of this simulation builder.
Exceptions
std::runtime_errorif another agent with the same name has been wired already.
Template Parameters
BlueprintAn AgentBaseBlueprint subclass, to be specialized for T.
BlueprintArgsBlueprint constructor arguments types.

◆ AddAgent() [3/3]

Blueprint* AddAgent ( std::unique_ptr< Blueprint >  blueprint)

Uses the given blueprint to build and take ownership of an agent, which is to be wired into the simulation.

Blueprint ownership is transferred to the built agent.

Parameters
blueprintThe agent blueprint to be used.
Returns
A bare pointer to the added AgentBaseBlueprint<T> instance, which will remain valid for the lifetime of this simulation builder.
Exceptions
std::runtime_errorif blueprint is nullptr.
std::runtime_errorif another agent with the same name has been wired already.
Template Parameters
BlueprintAn AgentBaseBlueprint<T> subclass.

◆ Build()

std::unique_ptr< AgentSimulationBase< T > > Build

Builds the simulation.

Construction of the simulation's Diagram representation is completed and a Simulator is built and initialized with it. All agents' ownership is transferred to the simulation instance.

Returns
Ownership of the AgentSimulationBase instance just built.

◆ GetMaxStepSize()

const T& GetMaxStepSize ( ) const

Gets maximum integration step size for the simulation to be built.

◆ GetRoadGeometry()

const maliput::api::RoadGeometry * GetRoadGeometry

Gets the RoadGeometry from this simulation.

◆ GetTargetRealTimeRate()

double GetTargetRealTimeRate ( ) const

Gets the target real-time rate for the simulation to be built.

◆ Reset()

void Reset

Resets the builder internal state, leaving it ready for another building procedure.

◆ SetRoadNetwork() [1/2]

const maliput::api::RoadNetwork * SetRoadNetwork ( std::unique_ptr< maliput::api::RoadNetwork road_network)

Sets the RoadNetwork for this simulation and use its road geometry.

Parameters
road_networkThe road network to use for the simulation.

◆ SetRoadNetwork() [2/2]

const maliput::api::RoadNetwork * SetRoadNetwork ( std::unique_ptr< maliput::api::RoadNetwork road_network,
const maliput::utility::ObjFeatures features 
)

Sets the RoadNetwork for this simulation.

Parameters
road_networkThe road network to use for the simulation.
featuresThe road features that will be shown in the simulation.
See also
documentation of maliput::utility::ObjFeatures

◆ SetTargetRealTimeRate()

void SetTargetRealTimeRate ( double  realtime_rate)

Sets the target real-time rate for the simulation to be built.

Parameters
realtime_rateThe real-time rate to be set.
Exceptions
std::runtime_errorif realtime_rate is a negative number.

◆ UsesFixedStepMode()

bool UsesFixedStepMode ( ) const

Whether the simulation's integrator should work on a fixed step basis or not.


The documentation for this class was generated from the following files: