![]() |
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).
|
Exposes facilities related to the ego entity. More...
#include <include/sumo-integrator/core/Ego.h>
Public Member Functions | |
void | subscribe (const std::vector< int > &, const double, const double, const double) |
Subscribe to the data feed of neighbouring vehicles. More... | |
types::Datamaps | poll () |
Poll the neighbouring vehicles data feed. More... | |
void | move (const types::Position &) |
Move an ego entity. More... | |
void | move (const std::string &, const types::Position &) |
Move an ego entity. More... | |
std::string | get_id () |
Get the id of the ego entity. More... | |
void | set_id (const std::string &) |
Set the id of the ego entity. More... | |
Exposes facilities related to the ego entity.
Handles the ego entity within SUMO's simulation. It is assumed only one "main" ego entity exists, although it is possible to alter the state of other entities as if they were ego entities themselves.
sumointegrator::Sumo
(sumointegrator::Sumo::ego
). Inherits sumointegrator::Sumo::Concern.
void sumointegrator::Sumo::Ego::subscribe | ( | const std::vector< int > & | request, |
const double | radius, | ||
const double | start, | ||
const double | end | ||
) |
Subscribe to the data feed of neighbouring vehicles.
Data is received from only those vehicles within a circle cantered in the ego vehicle and with the given radius. Once subscribed to a data feed, on each SUMO simulation tick that data is made available through poll()
.
start
seconds (s)end
seconds (s)[in] | request | The requested data. |
[in] | start | The time the subscription starts taking effect. |
[in] | end | The time the subscription stops taking effect. |
[in] | radius | The radius of the circle area. |
DEBUG_INFO
- Subscription target. DEBUG_DATA
- Number of vehicles in the radius. types::Datamaps sumointegrator::Sumo::Ego::poll | ( | ) |
Poll the neighbouring vehicles data feed.
It is assumed a subscription was previously made with subscribe()
. The data is collected in an std::map
(types::Datamaps
) and can be index-accessed for usage; the amount of datasets received depends on the number of vehicles within the radius specified with subscribe()
.
std::map
of entries, the keys being the vehicles and the corresponding content being an std::map
of entries with all the requested data.DEBUG_DATA
- Number of datapoints received from the subscription for each vehicle. void sumointegrator::Sumo::Ego::move | ( | const types::Position & | position | ) |
Move an ego entity.
The ego entity is placed at the given coordinates, with no interpolation or extrapolation made on its state vectors between subsequent move()
s. SUMO is capable of interacting with this ego entity based on (subsequent) position(s) alone.
id
of the SUMO entity acting as the ego entity must be set first with set_id()
.position
meters (m), meters (m), meters (m)[in] | position | The target 3D position. |
types::RuntimeException | If the id is not set. |
move(const std::string&, const Position&)
void sumointegrator::Sumo::Ego::move | ( | const std::string & | id, |
const types::Position & | position | ||
) |
Move an ego entity.
The SUMO entity identified by its id
is placed in the given coordinates, with no interpolation or extrapolation made on its state vectors between subsequent move(const std::string&, const Position&)
. This method is useful to move entities other than the "main" ego.
position
meters (m), meters (m), meters (m)[in] | id | The id of the SUMO entity. |
[in] | position | The target 3D position. |
move(const Position&)
std::string sumointegrator::Sumo::Ego::get_id | ( | ) |
Get the id
of the ego entity.
id
of the ego entity. void sumointegrator::Sumo::Ego::set_id | ( | const std::string & | id | ) |
Set the id
of the ego entity.
[in] | id | The id of the ego entity. |