34 "cp_waypoints_visualizer/visualization_markers", rclcpp::QoS(rclcpp::KeepLast(1)));
41 for (
auto & waypoint : waypoints)
44 if ((
long)waypointsNames.size() > i)
46 name = waypointsNames[i];
50 name =
"waypoint_" + std::to_string(i);
53 visualization_msgs::msg::Marker marker;
57 visualization_msgs::msg::Marker markerlabel;
66 const geometry_msgs::msg::Pose & waypoint, std::string label,
67 visualization_msgs::msg::Marker & marker)
69 marker.header.frame_id =
frameid;
70 marker.header.stamp =
getNode()->now();
71 marker.ns =
"waypoints_labels";
74 marker.type = visualization_msgs::msg::Marker::TEXT_VIEW_FACING;
75 marker.action = visualization_msgs::msg::Marker::ADD;
82 marker.pose = waypoint;
83 marker.pose.position.z += 0.3;
87 const geometry_msgs::msg::Pose & waypoint, visualization_msgs::msg::Marker & marker)
89 marker.header.frame_id =
frameid;
90 marker.header.stamp =
getNode()->now();
91 marker.ns =
"waypoints";
94 marker.type = visualization_msgs::msg::Marker::SPHERE;
95 marker.action = visualization_msgs::msg::Marker::ADD;
100 marker.color.a = 1.0;
101 marker.pose = waypoint;
106 std::lock_guard<std::mutex> guard(
m_mutex_);
112 for (
auto & marker :
markers_.markers)
114 marker.header.stamp =
getNode()->now();
118 marker.color.r = 1.0;
124 marker.color.r = 0.0;
125 marker.color.g = 1.0;
134 marker.header.stamp =
getNode()->now();
138 marker.color.r = 1.0;
144 marker.color.r = 0.0;
145 marker.color.g = 1.0;
visualization_msgs::msg::MarkerArray markers_
visualization_msgs::msg::MarkerArray markerLabels_
virtual void update() override
rclcpp::Publisher< visualization_msgs::msg::MarkerArray >::SharedPtr markersPub_
void onInitialize() override
void createMarker(const geometry_msgs::msg::Pose &waypoint, visualization_msgs::msg::Marker &m)
CpWaypointsVisualizer(rclcpp::Duration duration)
void createMarkerLabel(const geometry_msgs::msg::Pose &waypoint, std::string label, visualization_msgs::msg::Marker &m)
cl_nav2z::WaypointNavigator * waypointsNavigator_
const std::vector< geometry_msgs::msg::Pose > & getWaypoints() const
long getCurrentWaypointIndex() const
const std::vector< std::string > & getWaypointNames() const
void requiresComponent(TComponent *&requiredComponentStorage, bool throwExceptionIfNotExist=false)
rclcpp::Node::SharedPtr getNode()
const std::string frameid