delphyne
|
A runnable agent-based simulation, using Drake's system framework as its backbone.
T | must be a valid Eigen ScalarType. |
Instantiated templates for the following ScalarTypes are provided:
These are already available to link against in the containing library.
#include <include/delphyne/mi6/agent_simulation.h>
Public Member Functions | |
AgentSimulationBase (std::unique_ptr< drake::systems::Simulator< T >> simulator, std::unique_ptr< drake::systems::Diagram< T >> diagram, std::map< std::string, std::unique_ptr< AgentBase< T >>> agents, std::unique_ptr< const maliput::api::RoadGeometry > road_geometry, drake::geometry::SceneGraph< T > *scene_graph, SceneSystem *scene_system) | |
Constructs a simulation. More... | |
AgentSimulationBase (std::unique_ptr< drake::systems::Simulator< T >> simulator, std::unique_ptr< drake::systems::Diagram< T >> diagram, std::map< std::string, std::unique_ptr< AgentBase< T >>> agents, std::unique_ptr< const maliput::api::RoadNetwork > road_network, drake::geometry::SceneGraph< T > *scene_graph, SceneSystem *scene_system) | |
Constructs a simulation. More... | |
template<class AgentType > | |
const AgentType & | GetAgentByName (const std::string &name) |
Returns a reference to the name d agent of the given type. More... | |
template<template< typename U > class AgentBaseType> | |
const AgentBaseType< T > & | GetAgentByName (const std::string &name) |
Returns a mutable reference to the name d agent of the given type. More... | |
const AgentBase< T > & | GetAgentByName (const std::string &name) const |
Returns a reference to the name d agent. More... | |
template<class AgentType > | |
AgentType * | GetMutableAgentByName (const std::string &name) |
Returns a mutable reference to the name d agent of the given type. More... | |
template<template< typename U > class AgentBaseType> | |
AgentBaseType< T > * | GetMutableAgentByName (const std::string &name) |
Returns a mutable reference to the name d agent of the given type. More... | |
AgentBase< T > * | GetMutableAgentByName (const std::string &name) |
Returns a mutable reference to the name d agent. More... | |
std::unique_ptr< ignition::msgs::Scene > | GetVisualScene () |
Returns the simulation scene, full of visuals. More... | |
drake::systems::rendering::PoseBundle< T > | GetCurrentPoses () const |
Returns the current poses of all agents in the simulation. More... | |
std::vector< AgentBaseCollision< T > > | GetCollisions () const |
Returns all agent pairs that are currently in collision. More... | |
void | SetRealTimeRate (double realtime_rate) |
Sets the real-time rate for this simulation. More... | |
double | GetRealTimeRate () const |
Gets the real-time rate for this simulation. More... | |
void | StepBy (const T &time_step) |
Advances simulated time by the given time_step in seconds. More... | |
const T & | GetCurrentTime () const |
Returns the current simulation time in seconds. More... | |
const drake::systems::Diagram< T > & | GetDiagram () const |
Gets a reference to the simulation diagram representation. More... | |
const drake::systems::Context< T > & | GetContext () const |
Gets a reference to the simulation context. More... | |
drake::systems::Context< T > * | GetMutableContext () |
Gets a mutable reference to the simulation context. More... | |
|
explicit |
Constructs a simulation.
simulator | the Simulator instance to advance this simulation. |
diagram | the Diagram representation of this simulation. |
agents | all the Agents associated with this simulation. |
road_geometry | the RoadGeometry associated with this simulation. |
scene_graph | a reference to the SceneGraph in this simulation, for all sorts of geometrical queries. |
scene_system | a reference to the scene composing system in this simulation |
|
explicit |
Constructs a simulation.
simulator | the Simulator instance to advance this simulation. |
diagram | the Diagram representation of this simulation. |
agents | all the Agents associated with this simulation. |
road_network | the RoadNetwork associated with this simulation. |
scene_graph | a reference to the SceneGraph in this simulation, for all sorts of geometrical queries. |
scene_system | a reference to the scene composing system in this simulation |
const AgentType& GetAgentByName | ( | const std::string & | name | ) |
Returns a reference to the name
d agent of the given type.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
std::bad_cast | if the agent was found but it is not of the expected type. |
AgentType | An AgentBase<T> subclass. |
const AgentBaseType<T>& GetAgentByName | ( | const std::string & | name | ) |
Returns a mutable reference to the name
d agent of the given type.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
std::bad_cast | if the agent was found but it is not of the expected type. |
AgentBaseType | An AgentBase subclass, to be specialized for T. |
const delphyne::AgentBase< T > & GetAgentByName | ( | const std::string & | name | ) | const |
Returns a reference to the name
d agent.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
std::vector< AgentBaseCollision< T > > GetCollisions |
Returns all agent pairs that are currently in collision.
const drake::systems::Context<T>& GetContext | ( | ) | const |
Gets a reference to the simulation context.
drake::systems::rendering::PoseBundle< T > GetCurrentPoses |
Returns the current poses of all agents in the simulation.
const T& GetCurrentTime | ( | ) | const |
Returns the current simulation time in seconds.
const drake::systems::Diagram<T>& GetDiagram | ( | ) | const |
Gets a reference to the simulation diagram representation.
AgentType* GetMutableAgentByName | ( | const std::string & | name | ) |
Returns a mutable reference to the name
d agent of the given type.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
AgentType | An AgentBase<T> subclass. |
AgentBaseType<T>* GetMutableAgentByName | ( | const std::string & | name | ) |
Returns a mutable reference to the name
d agent of the given type.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
AgentBaseType | An AgentBase subclass, to be specialized for T. |
delphyne::AgentBase< T > * GetMutableAgentByName | ( | const std::string & | name | ) |
Returns a mutable reference to the name
d agent.
[in] | name | The name of the agent. |
std::runtime_error | if no agent with the given name is known by the simulator. |
drake::systems::Context<T>* GetMutableContext | ( | ) |
Gets a mutable reference to the simulation context.
double GetRealTimeRate | ( | ) | const |
Gets the real-time rate for this simulation.
std::unique_ptr< ignition::msgs::Scene > GetVisualScene |
Returns the simulation scene, full of visuals.
void SetRealTimeRate | ( | double | realtime_rate | ) |
Sets the real-time rate for this simulation.
void StepBy | ( | const T & | time_step | ) |
Advances simulated time by the given time_step
in seconds.