Apollo  6.0
Open source self driving car software
Public Member Functions | Static Public Attributes | List of all members
apollo::dreamview::SimulationWorldService Class Reference

This is a major component of the Simulation backend, which maintains a SimulationWorld object and keeps updating it. The SimulationWorld represents the most up-to-date information about all the objects in the emulated world, including the car, the planning trajectory, etc. NOTE: This class is not thread-safe. More...

#include <simulation_world_service.h>

Collaboration diagram for apollo::dreamview::SimulationWorldService:
Collaboration graph

Public Member Functions

 SimulationWorldService (const MapService *map_service, bool routing_from_file=false)
 Constructor of SimulationWorldService. More...
 
const SimulationWorld & world () const
 Get a read-only view of the SimulationWorld. More...
 
nlohmann::json GetUpdateAsJson (double radius) const
 Returns the json representation of the SimulationWorld object. This is a public API used by offline dreamview. More...
 
void GetWireFormatString (double radius, std::string *sim_world, std::string *sim_world_with_planning_data)
 Returns the binary representation of the SimulationWorld object. More...
 
nlohmann::json GetMapElements (double radius) const
 Returns the json representation of the map element Ids and hash within the given radius from the car. More...
 
void Update ()
 The function Update() is periodically called to check for updates from the external messages. All the updates will be written to the SimulationWorld object to reflect the latest status. More...
 
void SetToClear ()
 Sets the flag to clear the owned simulation world object. More...
 
bool ReadyToPush () const
 Check whether the SimulationWorld object has enough information. The backend won't push the SimulationWorld to frontend if it is not ready. More...
 
void PublishMonitorMessage (apollo::common::monitor::MonitorMessageItem::LogLevel log_level, const std::string &msg)
 Publish message to the monitor. More...
 
void PublishNavigationInfo (const std::shared_ptr< apollo::relative_map::NavigationInfo > &)
 
void PublishRoutingRequest (const std::shared_ptr< apollo::routing::RoutingRequest > &)
 
void PublishTask (const std::shared_ptr< apollo::task_manager::Task > &)
 
void GetMapElementIds (double radius, MapElementIds *ids) const
 
const apollo::hdmap::Map & GetRelativeMap () const
 
nlohmann::json GetRoutePathAsJson () const
 
void DumpMessages ()
 

Static Public Attributes

static constexpr int kMaxMonitorItems = 30
 

Detailed Description

This is a major component of the Simulation backend, which maintains a SimulationWorld object and keeps updating it. The SimulationWorld represents the most up-to-date information about all the objects in the emulated world, including the car, the planning trajectory, etc. NOTE: This class is not thread-safe.

Constructor & Destructor Documentation

◆ SimulationWorldService()

apollo::dreamview::SimulationWorldService::SimulationWorldService ( const MapService map_service,
bool  routing_from_file = false 
)

Constructor of SimulationWorldService.

Parameters
map_servicethe pointer of MapService.
routing_from_filewhether to read initial routing from file.

Member Function Documentation

◆ DumpMessages()

void apollo::dreamview::SimulationWorldService::DumpMessages ( )

◆ GetMapElementIds()

void apollo::dreamview::SimulationWorldService::GetMapElementIds ( double  radius,
MapElementIds *  ids 
) const

◆ GetMapElements()

nlohmann::json apollo::dreamview::SimulationWorldService::GetMapElements ( double  radius) const

Returns the json representation of the map element Ids and hash within the given radius from the car.

Parameters
radiusthe search distance from the current car location
Returns
Json object that contains mapElementIds and mapHash.

◆ GetRelativeMap()

const apollo::hdmap::Map& apollo::dreamview::SimulationWorldService::GetRelativeMap ( ) const

◆ GetRoutePathAsJson()

nlohmann::json apollo::dreamview::SimulationWorldService::GetRoutePathAsJson ( ) const

◆ GetUpdateAsJson()

nlohmann::json apollo::dreamview::SimulationWorldService::GetUpdateAsJson ( double  radius) const

Returns the json representation of the SimulationWorld object. This is a public API used by offline dreamview.

Parameters
radiusthe search distance from the current car location
Returns
Json object equivalence of the SimulationWorld object.

◆ GetWireFormatString()

void apollo::dreamview::SimulationWorldService::GetWireFormatString ( double  radius,
std::string *  sim_world,
std::string *  sim_world_with_planning_data 
)

Returns the binary representation of the SimulationWorld object.

Parameters
radiusthe search distance from the current car location.
sim_worldoutput of binary format sim_world string.
sim_world_with_planning_dataoutput of binary format sim_world string with planning_data.

◆ PublishMonitorMessage()

void apollo::dreamview::SimulationWorldService::PublishMonitorMessage ( apollo::common::monitor::MonitorMessageItem::LogLevel  log_level,
const std::string &  msg 
)

Publish message to the monitor.

Parameters
msgthe string to send to monitor
log_leveldefined in modules/common/monitor_log/proto/monitor_log.proto

◆ PublishNavigationInfo()

void apollo::dreamview::SimulationWorldService::PublishNavigationInfo ( const std::shared_ptr< apollo::relative_map::NavigationInfo > &  )

◆ PublishRoutingRequest()

void apollo::dreamview::SimulationWorldService::PublishRoutingRequest ( const std::shared_ptr< apollo::routing::RoutingRequest > &  )

◆ PublishTask()

void apollo::dreamview::SimulationWorldService::PublishTask ( const std::shared_ptr< apollo::task_manager::Task > &  )

◆ ReadyToPush()

bool apollo::dreamview::SimulationWorldService::ReadyToPush ( ) const
inline

Check whether the SimulationWorld object has enough information. The backend won't push the SimulationWorld to frontend if it is not ready.

Returns
True if the object is ready to push.

◆ SetToClear()

void apollo::dreamview::SimulationWorldService::SetToClear ( )
inline

Sets the flag to clear the owned simulation world object.

◆ Update()

void apollo::dreamview::SimulationWorldService::Update ( )

The function Update() is periodically called to check for updates from the external messages. All the updates will be written to the SimulationWorld object to reflect the latest status.

◆ world()

const SimulationWorld& apollo::dreamview::SimulationWorldService::world ( ) const
inline

Get a read-only view of the SimulationWorld.

Returns
Constant reference to the SimulationWorld object.

Member Data Documentation

◆ kMaxMonitorItems

constexpr int apollo::dreamview::SimulationWorldService::kMaxMonitorItems = 30
static

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