Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
|
Backend logic class for WMListener. More...
#include <WMListenerWorker.hpp>
Public Member Functions | |
WMListenerWorker () | |
Constructor. More... | |
WorldModelConstPtr | getWorldModel () const |
Constructor. More... | |
void | mapCallback (const autoware_lanelet2_msgs::msg::MapBin::SharedPtr map_msg) |
Callback for new map messages. Updates the underlying map. More... | |
void | mapUpdateCallback (autoware_lanelet2_msgs::msg::MapBin::SharedPtr geofence_msg) |
Callback for new map update messages (geofence). Updates the underlying map. More... | |
void | routeCallback (const carma_planning_msgs::msg::Route::SharedPtr route_msg) |
Callback for route message. More... | |
void | ros1ClockCallback (const rosgraph_msgs::msg::Clock::SharedPtr clock_msg) |
Callback for ROS1 clock message (used in Simulation runs) More... | |
void | simClockCallback (const rosgraph_msgs::msg::Clock::SharedPtr clock_msg) |
Callback for Simulation clock message (used in Simulation runs) More... | |
void | roadwayObjectListCallback (const carma_perception_msgs::msg::RoadwayObstacleList::SharedPtr msg) |
Callback for roadway objects msg. More... | |
void | setMapCallback (std::function< void()> callback) |
Allows user to set a callback to be triggered when a map update is received. More... | |
void | setRouteCallback (std::function< void()> callback) |
Allows user to set a callback to be triggered when a route update is received. More... | |
void | setConfigSpeedLimit (double config_lim) |
Allows user to set a callback to be triggered when a map update is received. More... | |
double | getConfigSpeedLimit () const |
Returns the current configured speed limit value. More... | |
void | setVehicleParticipationType (std::string participant) |
Allows user to set a callback to be triggered when a map update is received. More... | |
std::string | getVehicleParticipationType () const |
Returns the Vehicle Participation Type value. More... | |
bool | checkIfReRoutingNeeded () const |
Check if re-routing is needed and returns re-routing flag. More... | |
void | enableUpdatesWithoutRoute () |
Enable updates without route and set route_node_flag_ as true. More... | |
LaneletRoutingGraphPtr | routingGraphFromMsg (const autoware_lanelet2_msgs::msg::RoutingGraph &msg, lanelet::LaneletMapPtr map) const |
Helper function to convert a routing graph message into a actual RoutingGraph object. More... | |
void | incomingSpatCallback (const carma_v2x_msgs::msg::SPAT::SharedPtr spat_msg) |
incoming spat message More... | |
void | isUsingSimTime (bool use_sim_time) |
set true if simulation_mode is on More... | |
void | isSpatWallTime (bool is_spat_wall_time) |
set true if incoming spat is based on wall clock More... | |
Private Member Functions | |
void | newRegemUpdateHelper (lanelet::Lanelet parent_llt, lanelet::RegulatoryElement *regem) const |
This is a helper function updates the parent_llt with specified regem. This function is needed as we need to dynamic_cast from general regem to specific type of regem based on the geofence. More... | |
Private Attributes | |
std::shared_ptr< CARMAWorldModel > | world_model_ |
bool | use_sim_time_ |
bool | is_spat_wall_time_ |
std::function< void()> | map_callback_ |
std::function< void()> | route_callback_ |
double | config_speed_limit_ |
size_t | current_map_version_ = 0 |
std::queue< autoware_lanelet2_msgs::msg::MapBin::SharedPtr > | map_update_queue_ |
boost::optional< carma_planning_msgs::msg::Route > | delayed_route_msg_ |
bool | recompute_route_flag_ =false |
bool | rerouting_flag_ =false |
bool | route_node_flag_ =false |
long | most_recent_update_msg_seq_ = -1 |
Backend logic class for WMListener.
Definition at line 34 of file WMListenerWorker.hpp.
carma_wm::WMListenerWorker::WMListenerWorker | ( | ) |
Constructor.
Definition at line 45 of file WMListenerWorker.cpp.
References world_model_.
bool carma_wm::WMListenerWorker::checkIfReRoutingNeeded | ( | ) | const |
Check if re-routing is needed and returns re-routing flag.
Definition at line 109 of file WMListenerWorker.cpp.
References rerouting_flag_.
void carma_wm::WMListenerWorker::enableUpdatesWithoutRoute | ( | ) |
Enable updates without route and set route_node_flag_ as true.
Definition at line 114 of file WMListenerWorker.cpp.
References route_node_flag_.
double carma_wm::WMListenerWorker::getConfigSpeedLimit | ( | ) | const |
Returns the current configured speed limit value.
Definition at line 713 of file WMListenerWorker.cpp.
References config_speed_limit_.
std::string carma_wm::WMListenerWorker::getVehicleParticipationType | ( | ) | const |
Returns the Vehicle Participation Type value.
Definition at line 568 of file WMListenerWorker.cpp.
References world_model_.
Referenced by routingGraphFromMsg().
WorldModelConstPtr carma_wm::WMListenerWorker::getWorldModel | ( | ) | const |
Constructor.
Definition at line 50 of file WMListenerWorker.cpp.
References world_model_.
void carma_wm::WMListenerWorker::incomingSpatCallback | ( | const carma_v2x_msgs::msg::SPAT::SharedPtr | spat_msg | ) |
incoming spat message
Definition at line 104 of file WMListenerWorker.cpp.
References is_spat_wall_time_, use_sim_time_, and world_model_.
void carma_wm::WMListenerWorker::isSpatWallTime | ( | bool | is_spat_wall_time | ) |
set true if incoming spat is based on wall clock
Definition at line 708 of file WMListenerWorker.cpp.
References is_spat_wall_time_.
void carma_wm::WMListenerWorker::isUsingSimTime | ( | bool | use_sim_time | ) |
set true if simulation_mode is on
Definition at line 704 of file WMListenerWorker.cpp.
References use_sim_time_.
void carma_wm::WMListenerWorker::mapCallback | ( | const autoware_lanelet2_msgs::msg::MapBin::SharedPtr | map_msg | ) |
Callback for new map messages. Updates the underlying map.
map_msg | The new map messages to generate the map from |
Definition at line 56 of file WMListenerWorker.cpp.
References current_map_version_, delayed_route_msg_, carma_wm::fromBinMsg(), map_callback_, map_update_queue_, mapUpdateCallback(), routeCallback(), and world_model_.
void carma_wm::WMListenerWorker::mapUpdateCallback | ( | autoware_lanelet2_msgs::msg::MapBin::SharedPtr | geofence_msg | ) |
Callback for new map update messages (geofence). Updates the underlying map.
geofence_msg | The new map update messages to generate the map edits from |
Definition at line 147 of file WMListenerWorker.cpp.
References current_map_version_, carma_wm::fromBinMsg(), process_bag::i, carma_wm::logSignalizedIntersectionManager(), map_callback_, map_update_queue_, most_recent_update_msg_seq_, newRegemUpdateHelper(), recompute_route_flag_, rerouting_flag_, route_node_flag_, routingGraphFromMsg(), and world_model_.
Referenced by mapCallback(), and routeCallback().
|
private |
This is a helper function updates the parent_llt with specified regem. This function is needed as we need to dynamic_cast from general regem to specific type of regem based on the geofence.
parent_llt | The Lanelet that need to register the regem |
regem | lanelet::RegulatoryElement* which is the type that the serializer decodes from binary NOTE: Currently this function supports items in carma_wm::GeofenceType |
Definition at line 322 of file WMListenerWorker.cpp.
References carma_wm::CARMA_TRAFFIC_LIGHT, carma_wm::DIGITAL_MINIMUM_GAP, carma_wm::DIGITAL_SPEED_LIMIT, carma_wm::DIRECTION_OF_TRAVEL, carma_wm::PASSING_CONTROL_LINE, carma_wm::REGION_ACCESS_RULE, carma_wm::resolveGeofenceType(), carma_wm::SIGNALIZED_INTERSECTION, carma_wm::STOP_RULE, and world_model_.
Referenced by mapUpdateCallback().
void carma_wm::WMListenerWorker::roadwayObjectListCallback | ( | const carma_perception_msgs::msg::RoadwayObstacleList::SharedPtr | msg | ) |
Callback for roadway objects msg.
Definition at line 573 of file WMListenerWorker.cpp.
References world_model_.
void carma_wm::WMListenerWorker::ros1ClockCallback | ( | const rosgraph_msgs::msg::Clock::SharedPtr | clock_msg | ) |
Callback for ROS1 clock message (used in Simulation runs)
Definition at line 579 of file WMListenerWorker.cpp.
References world_model_.
void carma_wm::WMListenerWorker::routeCallback | ( | const carma_planning_msgs::msg::Route::SharedPtr | route_msg | ) |
Callback for route message.
Definition at line 589 of file WMListenerWorker.cpp.
References current_map_version_, delayed_route_msg_, map_update_queue_, mapUpdateCallback(), rerouting_flag_, route_callback_, route_node_flag_, and world_model_.
Referenced by mapCallback().
LaneletRoutingGraphPtr carma_wm::WMListenerWorker::routingGraphFromMsg | ( | const autoware_lanelet2_msgs::msg::RoutingGraph & | msg, |
lanelet::LaneletMapPtr | map | ||
) | const |
Helper function to convert a routing graph message into a actual RoutingGraph object.
msg | The graph message to convert |
map | The base map this graph applies to |
Definition at line 449 of file WMListenerWorker.cpp.
References getVehicleParticipationType(), process_bag::i, sci_strategic_plugin::Left, and sci_strategic_plugin::Right.
Referenced by mapUpdateCallback().
void carma_wm::WMListenerWorker::setConfigSpeedLimit | ( | double | config_lim | ) |
Allows user to set a callback to be triggered when a map update is received.
config_lim | A callback function that will be triggered after the world model receives a new map update |
Definition at line 697 of file WMListenerWorker.cpp.
References config_speed_limit_, and world_model_.
void carma_wm::WMListenerWorker::setMapCallback | ( | std::function< void()> | callback | ) |
Allows user to set a callback to be triggered when a map update is received.
callback | A callback function that will be triggered after the world model receives a new map update |
Definition at line 687 of file WMListenerWorker.cpp.
References callback(), and map_callback_.
void carma_wm::WMListenerWorker::setRouteCallback | ( | std::function< void()> | callback | ) |
Allows user to set a callback to be triggered when a route update is received.
callback | A callback function that will be triggered after the world model is updated with a new route |
Definition at line 692 of file WMListenerWorker.cpp.
References callback(), and route_callback_.
void carma_wm::WMListenerWorker::setVehicleParticipationType | ( | std::string | participant | ) |
Allows user to set a callback to be triggered when a map update is received.
participant | A callback function that will be triggered after the world model receives a new map update |
Definition at line 718 of file WMListenerWorker.cpp.
References world_model_.
void carma_wm::WMListenerWorker::simClockCallback | ( | const rosgraph_msgs::msg::Clock::SharedPtr | clock_msg | ) |
Callback for Simulation clock message (used in Simulation runs)
Definition at line 584 of file WMListenerWorker.cpp.
References world_model_.
|
private |
Definition at line 166 of file WMListenerWorker.hpp.
Referenced by getConfigSpeedLimit(), and setConfigSpeedLimit().
|
private |
Definition at line 168 of file WMListenerWorker.hpp.
Referenced by mapCallback(), mapUpdateCallback(), and routeCallback().
|
private |
Definition at line 170 of file WMListenerWorker.hpp.
Referenced by mapCallback(), and routeCallback().
|
private |
Definition at line 162 of file WMListenerWorker.hpp.
Referenced by incomingSpatCallback(), and isSpatWallTime().
|
private |
Definition at line 163 of file WMListenerWorker.hpp.
Referenced by mapCallback(), mapUpdateCallback(), and setMapCallback().
|
private |
Definition at line 169 of file WMListenerWorker.hpp.
Referenced by mapCallback(), mapUpdateCallback(), and routeCallback().
|
private |
Definition at line 175 of file WMListenerWorker.hpp.
Referenced by mapUpdateCallback().
|
private |
Definition at line 172 of file WMListenerWorker.hpp.
Referenced by mapUpdateCallback().
|
private |
Definition at line 173 of file WMListenerWorker.hpp.
Referenced by checkIfReRoutingNeeded(), mapUpdateCallback(), and routeCallback().
|
private |
Definition at line 164 of file WMListenerWorker.hpp.
Referenced by routeCallback(), and setRouteCallback().
|
private |
Definition at line 174 of file WMListenerWorker.hpp.
Referenced by enableUpdatesWithoutRoute(), mapUpdateCallback(), and routeCallback().
|
private |
Definition at line 161 of file WMListenerWorker.hpp.
Referenced by incomingSpatCallback(), and isUsingSimTime().
|
private |
Definition at line 160 of file WMListenerWorker.hpp.
Referenced by WMListenerWorker(), getVehicleParticipationType(), getWorldModel(), incomingSpatCallback(), mapCallback(), mapUpdateCallback(), newRegemUpdateHelper(), roadwayObjectListCallback(), ros1ClockCallback(), routeCallback(), setConfigSpeedLimit(), setVehicleParticipationType(), and simClockCallback().