scenario_simulator_v2 C++ API
Public Member Functions | List of all members
traffic_simulator::entity::EntityManager Class Reference

#include <entity_manager.hpp>

Public Member Functions

auto setTrafficLights (const std::shared_ptr< traffic_simulator::TrafficLights > &traffic_lights_ptr) -> void
 
template<typename Node >
auto getOrigin (Node &node) const
 
template<class NodeT , class AllocatorT = std::allocator<void>>
 EntityManager (NodeT &&node, const Configuration &configuration, const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &node_parameters)
 
 ~EntityManager ()=default
 
visualization_msgs::msg::MarkerArray makeDebugMarker () const
 
auto updateNpcLogic (const std::string &name, const double current_time, const double step_time) -> const CanonicalizedEntityStatus &
 
void broadcastEntityTransform ()
 
void broadcastTransform (const geometry_msgs::msg::PoseStamped &pose, const bool static_transform=true)
 
bool despawnEntity (const std::string &name)
 
auto isEntityExist (const std::string &name) const -> bool
 
auto getEntityNames () const -> const std::vector< std::string >
 
auto getEntityPointer (const std::string &name) const -> std::shared_ptr< traffic_simulator::entity::EntityBase >
 
auto getEntity (const std::string &name) -> entity::EntityBase &
 
auto getEntity (const std::string &name) const -> const entity::EntityBase &
 
auto getEgoEntity (const std::string &name) -> entity::EgoEntity &
 
auto getEgoEntity (const std::string &name) const -> const entity::EgoEntity &
 
auto getHdmapUtils () -> const std::shared_ptr< hdmap_utils::HdMapUtils > &
 
auto getNumberOfEgo () const -> std::size_t
 
auto getObstacle (const std::string &name) -> std::optional< traffic_simulator_msgs::msg::Obstacle >
 
auto getPedestrianParameters (const std::string &name) const -> const traffic_simulator_msgs::msg::PedestrianParameters &
 
auto getVehicleParameters (const std::string &name) const -> const traffic_simulator_msgs::msg::VehicleParameters &
 
auto getWaypoints (const std::string &name) -> traffic_simulator_msgs::msg::WaypointsArray
 
template<typename T >
auto getGoalPoses (const std::string &name) -> std::vector< T >
 
auto isAnyEgoSpawned () const -> bool
 
auto getFirstEgoName () const -> std::optional< std::string >
 
void resetBehaviorPlugin (const std::string &name, const std::string &behavior_plugin_name)
 Reset behavior plugin of the target entity. The internal behavior is to take over the various parameters and save them, then respawn the Entity and set the parameters. More...
 
void setVerbose (const bool verbose)
 
template<typename Entity , typename Pose , typename Parameters , typename... Ts>
auto spawnEntity (const std::string &name, const Pose &pose, const Parameters &parameters, const double current_time, Ts &&... xs)
 
template<typename MessageT , typename... Args>
auto createPublisher (Args &&... args)
 
template<typename MessageT , typename... Args>
auto createSubscription (Args &&... args)
 
void update (const double current_time, const double step_time)
 
void updateHdmapMarker ()
 
auto startNpcLogic (const double current_time) -> void
 
auto isNpcLogicStarted () const -> bool
 

Constructor & Destructor Documentation

◆ EntityManager()

template<class NodeT , class AllocatorT = std::allocator<void>>
traffic_simulator::entity::EntityManager::EntityManager ( NodeT &&  node,
const Configuration configuration,
const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &  node_parameters 
)
inlineexplicit

◆ ~EntityManager()

traffic_simulator::entity::EntityManager::~EntityManager ( )
default

Member Function Documentation

◆ broadcastEntityTransform()

auto traffic_simulator::entity::EntityManager::broadcastEntityTransform ( )
Note
This part of the process is intended to ensure that frames are issued in a position that makes it as easy as possible to see the entities that will appear in the scenario. In the past, we used to publish the frames of all entities, but that would be too heavy processing, so we publish the average of the coordinates of all entities.
This is the intended implementation. It is easier to create rviz config if the name "ego" is fixed, so the frame_id "ego" is issued regardless of the name of the ego entity.

◆ broadcastTransform()

void traffic_simulator::entity::EntityManager::broadcastTransform ( const geometry_msgs::msg::PoseStamped &  pose,
const bool  static_transform = true 
)

◆ createPublisher()

template<typename MessageT , typename... Args>
auto traffic_simulator::entity::EntityManager::createPublisher ( Args &&...  args)
inline

◆ createSubscription()

template<typename MessageT , typename... Args>
auto traffic_simulator::entity::EntityManager::createSubscription ( Args &&...  args)
inline

◆ despawnEntity()

bool traffic_simulator::entity::EntityManager::despawnEntity ( const std::string &  name)

◆ getEgoEntity() [1/2]

auto traffic_simulator::entity::EntityManager::getEgoEntity ( const std::string &  name) -> entity::EgoEntity &

◆ getEgoEntity() [2/2]

auto traffic_simulator::entity::EntityManager::getEgoEntity ( const std::string &  name) const -> const entity::EgoEntity &

◆ getEntity() [1/2]

auto traffic_simulator::entity::EntityManager::getEntity ( const std::string &  name) -> entity::EntityBase &

◆ getEntity() [2/2]

auto traffic_simulator::entity::EntityManager::getEntity ( const std::string &  name) const -> const entity::EntityBase &

◆ getEntityNames()

auto traffic_simulator::entity::EntityManager::getEntityNames ( ) const -> const std::vector<std::string>

◆ getEntityPointer()

auto traffic_simulator::entity::EntityManager::getEntityPointer ( const std::string &  name) const -> std::shared_ptr<traffic_simulator::entity::EntityBase>

◆ getFirstEgoName()

auto traffic_simulator::entity::EntityManager::getFirstEgoName ( ) const -> std::optional<std::string>

◆ getGoalPoses()

template<typename T >
auto traffic_simulator::entity::EntityManager::getGoalPoses ( const std::string &  name) -> std::vector<T>
inline

◆ getHdmapUtils()

auto traffic_simulator::entity::EntityManager::getHdmapUtils ( ) -> const std::shared_ptr<hdmap_utils::HdMapUtils> &

◆ getNumberOfEgo()

auto traffic_simulator::entity::EntityManager::getNumberOfEgo ( ) const -> std::size_t

◆ getObstacle()

auto traffic_simulator::entity::EntityManager::getObstacle ( const std::string &  name) -> std::optional<traffic_simulator_msgs::msg::Obstacle>

◆ getOrigin()

template<typename Node >
auto traffic_simulator::entity::EntityManager::getOrigin ( Node &  node) const
inline

◆ getPedestrianParameters()

auto traffic_simulator::entity::EntityManager::getPedestrianParameters ( const std::string &  name) const -> const traffic_simulator_msgs::msg::PedestrianParameters &

◆ getVehicleParameters()

auto traffic_simulator::entity::EntityManager::getVehicleParameters ( const std::string &  name) const -> const traffic_simulator_msgs::msg::VehicleParameters &

◆ getWaypoints()

auto traffic_simulator::entity::EntityManager::getWaypoints ( const std::string &  name) -> traffic_simulator_msgs::msg::WaypointsArray

◆ isAnyEgoSpawned()

auto traffic_simulator::entity::EntityManager::isAnyEgoSpawned ( ) const -> bool

◆ isEntityExist()

auto traffic_simulator::entity::EntityManager::isEntityExist ( const std::string &  name) const -> bool

◆ isNpcLogicStarted()

auto traffic_simulator::entity::EntityManager::isNpcLogicStarted ( ) const -> bool
inline

◆ makeDebugMarker()

visualization_msgs::msg::MarkerArray traffic_simulator::entity::EntityManager::makeDebugMarker ( ) const

◆ resetBehaviorPlugin()

void traffic_simulator::entity::EntityManager::resetBehaviorPlugin ( const std::string &  name,
const std::string &  behavior_plugin_name 
)

Reset behavior plugin of the target entity. The internal behavior is to take over the various parameters and save them, then respawn the Entity and set the parameters.

Parameters
nameThe name of the target entity.
behavior_plugin_nameThe name of the behavior plugin you want to set.
See also
traffic_simulator::entity::PedestrianEntity::BuiltinBehavior
traffic_simulator::entity::VehicleEntity::BuiltinBehavior

◆ setTrafficLights()

auto traffic_simulator::entity::EntityManager::setTrafficLights ( const std::shared_ptr< traffic_simulator::TrafficLights > &  traffic_lights_ptr) -> void
inline

This function is necessary because the TrafficLights object is created after the EntityManager, so it cannot be assigned during the call of the EntityManager constructor. TrafficLights cannot be created before the EntityManager due to the dependency on HdMapUtils.

◆ setVerbose()

void traffic_simulator::entity::EntityManager::setVerbose ( const bool  verbose)

◆ spawnEntity()

template<typename Entity , typename Pose , typename Parameters , typename... Ts>
auto traffic_simulator::entity::EntityManager::spawnEntity ( const std::string &  name,
const Pose pose,
const Parameters &  parameters,
const double  current_time,
Ts &&...  xs 
)
inline

◆ startNpcLogic()

auto traffic_simulator::entity::EntityManager::startNpcLogic ( const double  current_time) -> void

◆ update()

void traffic_simulator::entity::EntityManager::update ( const double  current_time,
const double  step_time 
)

◆ updateHdmapMarker()

void traffic_simulator::entity::EntityManager::updateHdmapMarker ( )

◆ updateNpcLogic()

auto traffic_simulator::entity::EntityManager::updateNpcLogic ( const std::string &  name,
const double  current_time,
const double  step_time 
) -> const CanonicalizedEntityStatus &

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