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.
|
#include <mobilitypath_visualizer.hpp>
Public Member Functions | |
MobilityPathVisualizer (const rclcpp::NodeOptions &) | |
Constructor. More... | |
visualization_msgs::msg::MarkerArray | composeVisualizationMarker (const carma_v2x_msgs::msg::MobilityPath &msg, const MarkerColor &color) |
Compose a visualization marker for mobilitypath messages. More... | |
geometry_msgs::msg::Point | ECEFToMapPoint (const carma_v2x_msgs::msg::LocationECEF &ecef_point) const |
Accepts ECEF point in cm to convert to a point in map in meters. More... | |
visualization_msgs::msg::MarkerArray | composeLabelMarker (const visualization_msgs::msg::MarkerArray &host_marker, const std::vector< visualization_msgs::msg::MarkerArray > &cav_markers) const |
Compose a label marker that displays whether if any of the cav's path cross with that of host (respective points are within 1 meter) More... | |
std::vector< visualization_msgs::msg::MarkerArray > | matchTrajectoryTimestamps (const visualization_msgs::msg::MarkerArray &host_marker, const std::vector< visualization_msgs::msg::MarkerArray > &cav_markers) const |
Matches timestamps of CAV's individual points of cav_markers to that of host_marker and interpolates their points using the speed between points. More... | |
void | georeferenceCallback (std_msgs::msg::String::UniquePtr msg) |
Callback for map projection string to define lat/lon -> map conversion. More... | |
carma_ros2_utils::CallbackReturn | handle_on_configure (const rclcpp_lifecycle::State &) |
carma_ros2_utils::CallbackReturn | handle_on_activate (const rclcpp_lifecycle::State &) |
Private Member Functions | |
void | initialize () |
void | callbackMobilityPath (carma_v2x_msgs::msg::MobilityPath::UniquePtr msg) |
void | timer_callback () |
Private Attributes | |
carma_ros2_utils::PubPtr< visualization_msgs::msg::MarkerArray > | host_marker_pub_ |
carma_ros2_utils::PubPtr< visualization_msgs::msg::MarkerArray > | cav_marker_pub_ |
carma_ros2_utils::PubPtr< visualization_msgs::msg::MarkerArray > | label_marker_pub_ |
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityPath > | host_mob_path_sub_ |
carma_ros2_utils::SubPtr< carma_v2x_msgs::msg::MobilityPath > | cav_mob_path_sub_ |
carma_ros2_utils::SubPtr< std_msgs::msg::String > | georeference_sub_ |
std::string | georeference_ {""} |
std::shared_ptr< lanelet::projection::LocalFrameProjector > | map_projector_ |
Config | config_ |
rclcpp::TimerBase::SharedPtr | timer_ |
std::unordered_map< std::string, carma_v2x_msgs::msg::MobilityPath > | latest_cav_mob_path_msg_ |
visualization_msgs::msg::MarkerArray | host_marker_ |
std::vector< visualization_msgs::msg::MarkerArray > | cav_markers_ |
visualization_msgs::msg::MarkerArray | label_marker_ |
std::unordered_map< std::string, size_t > | prev_marker_list_size_ |
bool | host_marker_received_ = false |
Definition at line 47 of file mobilitypath_visualizer.hpp.
mobilitypath_visualizer::MobilityPathVisualizer::MobilityPathVisualizer | ( | const rclcpp::NodeOptions & | options | ) |
Constructor.
Definition at line 36 of file mobilitypath_visualizer.cpp.
References config_, mobilitypath_visualizer::Config::host_id, mobilitypath_visualizer::Config::t, mobilitypath_visualizer::Config::timer_cb_rate, mobilitypath_visualizer::Config::x, mobilitypath_visualizer::Config::y, and mobilitypath_visualizer::Config::z.
|
private |
Definition at line 128 of file mobilitypath_visualizer.cpp.
References mobilitypath_visualizer::MarkerColor::blue, cav_markers_, composeVisualizationMarker(), config_, mobilitypath_visualizer::MarkerColor::green, mobilitypath_visualizer::Config::host_id, host_marker_, host_marker_received_, latest_cav_mob_path_msg_, map_projector_, and carma_cooperative_perception::to_string().
Referenced by handle_on_configure().
visualization_msgs::msg::MarkerArray mobilitypath_visualizer::MobilityPathVisualizer::composeLabelMarker | ( | const visualization_msgs::msg::MarkerArray & | host_marker, |
const std::vector< visualization_msgs::msg::MarkerArray > & | cav_markers | ||
) | const |
Compose a label marker that displays whether if any of the cav's path cross with that of host (respective points are within 1 meter)
host_marker | Host marker's visualization marker as arrow type |
cav_markers | Other CAV marker's visualization markers as arrow type |
Definition at line 280 of file mobilitypath_visualizer.cpp.
References mobilitypath_visualizer::anonymous_namespace{mobilitypath_visualizer.cpp}::compute_2d_distance(), config_, mobilitypath_visualizer::Config::t, carma_cooperative_perception::to_string(), mobilitypath_visualizer::Config::x, mobilitypath_visualizer::Config::y, and mobilitypath_visualizer::Config::z.
Referenced by timer_callback().
visualization_msgs::msg::MarkerArray mobilitypath_visualizer::MobilityPathVisualizer::composeVisualizationMarker | ( | const carma_v2x_msgs::msg::MobilityPath & | msg, |
const MarkerColor & | color | ||
) |
Compose a visualization marker for mobilitypath messages.
msg | Mobiliy path message |
color | color to visualize the marker, for example host car should have different color than other car |
Definition at line 175 of file mobilitypath_visualizer.cpp.
References mobilitypath_visualizer::MarkerColor::blue, config_, ECEFToMapPoint(), mobilitypath_visualizer::MarkerColor::green, process_bag::i, prev_marker_list_size_, mobilitypath_visualizer::MarkerColor::red, mobilitypath_visualizer::Config::x, mobilitypath_visualizer::Config::y, and mobilitypath_visualizer::Config::z.
Referenced by callbackMobilityPath().
geometry_msgs::msg::Point mobilitypath_visualizer::MobilityPathVisualizer::ECEFToMapPoint | ( | const carma_v2x_msgs::msg::LocationECEF & | ecef_point | ) | const |
Accepts ECEF point in cm to convert to a point in map in meters.
ecef_point | ECEF point to convert in cm |
Definition at line 263 of file mobilitypath_visualizer.cpp.
References map_projector_.
Referenced by composeVisualizationMarker().
void mobilitypath_visualizer::MobilityPathVisualizer::georeferenceCallback | ( | std_msgs::msg::String::UniquePtr | msg | ) |
Callback for map projection string to define lat/lon -> map conversion.
msg The proj string defining the projection.
Definition at line 119 of file mobilitypath_visualizer.cpp.
References georeference_, and map_projector_.
Referenced by handle_on_configure().
carma_ros2_utils::CallbackReturn mobilitypath_visualizer::MobilityPathVisualizer::handle_on_activate | ( | const rclcpp_lifecycle::State & | ) |
Definition at line 87 of file mobilitypath_visualizer.cpp.
References config_, timer_, timer_callback(), and mobilitypath_visualizer::Config::timer_cb_rate.
carma_ros2_utils::CallbackReturn mobilitypath_visualizer::MobilityPathVisualizer::handle_on_configure | ( | const rclcpp_lifecycle::State & | ) |
Definition at line 52 of file mobilitypath_visualizer.cpp.
References callbackMobilityPath(), cav_marker_pub_, cav_mob_path_sub_, config_, georeference_sub_, georeferenceCallback(), mobilitypath_visualizer::Config::host_id, host_marker_pub_, host_mob_path_sub_, label_marker_pub_, mobilitypath_visualizer::Config::t, mobilitypath_visualizer::Config::timer_cb_rate, mobilitypath_visualizer::Config::x, mobilitypath_visualizer::Config::y, and mobilitypath_visualizer::Config::z.
|
private |
std::vector< visualization_msgs::msg::MarkerArray > mobilitypath_visualizer::MobilityPathVisualizer::matchTrajectoryTimestamps | ( | const visualization_msgs::msg::MarkerArray & | host_marker, |
const std::vector< visualization_msgs::msg::MarkerArray > & | cav_markers | ||
) | const |
Matches timestamps of CAV's individual points of cav_markers to that of host_marker and interpolates their points using the speed between points.
host_marker | Host marker's visualization marker as arrow type |
cav_markers | Other CAV marker's visualization markers as arrow type |
Definition at line 344 of file mobilitypath_visualizer.cpp.
Referenced by timer_callback().
|
private |
Definition at line 96 of file mobilitypath_visualizer.cpp.
References cav_marker_pub_, cav_markers_, composeLabelMarker(), host_marker_, host_marker_pub_, host_marker_received_, label_marker_, label_marker_pub_, and matchTrajectoryTimestamps().
Referenced by handle_on_activate().
|
private |
Definition at line 112 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure(), and timer_callback().
|
private |
Definition at line 140 of file mobilitypath_visualizer.hpp.
Referenced by callbackMobilityPath(), and timer_callback().
|
private |
Definition at line 117 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 126 of file mobilitypath_visualizer.hpp.
Referenced by MobilityPathVisualizer(), callbackMobilityPath(), composeLabelMarker(), composeVisualizationMarker(), handle_on_activate(), and handle_on_configure().
|
private |
Definition at line 123 of file mobilitypath_visualizer.hpp.
Referenced by georeferenceCallback().
|
private |
Definition at line 118 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 139 of file mobilitypath_visualizer.hpp.
Referenced by callbackMobilityPath(), and timer_callback().
|
private |
Definition at line 111 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure(), and timer_callback().
|
private |
Definition at line 145 of file mobilitypath_visualizer.hpp.
Referenced by callbackMobilityPath(), and timer_callback().
|
private |
Definition at line 116 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure().
|
private |
Definition at line 141 of file mobilitypath_visualizer.hpp.
Referenced by timer_callback().
|
private |
Definition at line 113 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_configure(), and timer_callback().
|
private |
Definition at line 136 of file mobilitypath_visualizer.hpp.
Referenced by callbackMobilityPath().
|
private |
Definition at line 124 of file mobilitypath_visualizer.hpp.
Referenced by callbackMobilityPath(), ECEFToMapPoint(), and georeferenceCallback().
|
private |
Definition at line 144 of file mobilitypath_visualizer.hpp.
Referenced by composeVisualizationMarker().
|
private |
Definition at line 129 of file mobilitypath_visualizer.hpp.
Referenced by handle_on_activate().