sumo-integrator  0.4.0-alpha4+201812051700
sumo-integrator is a C++ static library that provides abstract integration tools geared towards connecting SUMO with a (any) graphic engine(s).
sumointegrator::Sumo::Entities Class Reference

Exposes facilities related to SUMO's entities. More...

#include <include/sumo-integrator/core/Entities.h>

Public Member Functions

void subscribe (TraCIAPI::TraCIScopeWrapper &, const std::string &, const std::vector< int > &, const double, const double)
 Subscribe to an entity's data feed. More...
 
types::Datamap poll (TraCIAPI::TraCIScopeWrapper &, const std::string &)
 Poll an entity's data feed. More...
 

Public Attributes

std::map< std::string, std::vector< int > > DATASETS
 Provides default datasets to be used with subscriptions. More...
 

Detailed Description

Exposes facilities related to SUMO's entities.

Author
Mattia Affabris - matti.nosp@m.a.af.nosp@m.fabri.nosp@m.s@an.nosp@m.temot.nosp@m.ion..nosp@m.com
Date
2018-11-26
2018-11-29
Version
0.4.0-alpha4
3

Handles anything related to SUMO's entities in the current simulation, including obtaining and feeding data.

Note
May only be accessed as a pointer member class of sumointegrator::Sumo (sumointegrator::Sumo::entities).

Inherits sumointegrator::Sumo::Concern.

Member Function Documentation

◆ subscribe()

void sumointegrator::Sumo::Entities::subscribe ( TraCIAPI::TraCIScopeWrapper &  entity,
const std::string &  id,
const std::vector< int > &  request,
const double  start,
const double  end 
)

Subscribe to an entity's data feed.

Once subscribed to a data feed, on each SUMO simulation tick that data is made available through poll().

Note
Subscriptions cannot be made on not yet spawned entities.
Warning
Attempting to subscribe to not yet spawned entities will terminate SUMO's simulation and close the connection with SUMO's server instance.
Units
start seconds (s)
end seconds (s)
Parameters
[in]entityThe type of entity whose feed to subscribe to.
[in]idThe id of the entity whose feed to subscribe to.
[in]requestThe requested data.
[in]startThe time the subscription starts taking effect.
[in]endThe time the subscription stops taking effect.
Debug
DEBUG_INFO - Subscription target.

◆ poll()

types::Datamap sumointegrator::Sumo::Entities::poll ( TraCIAPI::TraCIScopeWrapper &  entity,
const std::string &  id 
)

Poll an entity's data feed.

It is assumed a subscription was previously made with subscribe(). The data is collected in an std::map (types::Datamap) and can be index-accessed for usage.

Parameters
[in]entityThe type of entity whose feed to poll.
[in]idThe id of the entity whose feed to poll.
Returns
An std::map with all the requested data.
Exceptions
types::RuntimeExceptionIf no subscription was previously made.
Debug
DEBUG_DATA - Number of datapoints received from the subscription.

Member Data Documentation

◆ DATASETS

std::map<std::string, std::vector<int> > sumointegrator::Sumo::Entities::DATASETS
Initial value:
= {
{"TRANSFORM", {VAR_POSITION3D, VAR_ANGLE}},
{"VECTORS", {VAR_SPEED, VAR_ACCELERATION}},
{"STATE", {VAR_SIGNALS, VAR_STOPSTATE}}}

Provides default datasets to be used with subscriptions.

  • TRANSFORM
  • VECTORS
  • STATE

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