Nav2 Navigation Stack - jazzy  jazzy
ROS 2 Navigation Stack
utils.cpp
1 // Copyright (c) 2023 Alberto J. Tudela Roldán
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "nav2_graceful_controller/utils.hpp"
16 
17 namespace nav2_graceful_controller
18 {
19 
20 visualization_msgs::msg::Marker createSlowdownMarker(
21  const geometry_msgs::msg::PoseStamped & motion_target, const double & slowdown_radius)
22 {
23  visualization_msgs::msg::Marker slowdown_marker;
24  slowdown_marker.header = motion_target.header;
25  slowdown_marker.ns = "slowdown";
26  slowdown_marker.id = 0;
27  slowdown_marker.type = visualization_msgs::msg::Marker::SPHERE;
28  slowdown_marker.action = visualization_msgs::msg::Marker::ADD;
29  slowdown_marker.pose = motion_target.pose;
30  slowdown_marker.pose.position.z = 0.01;
31  slowdown_marker.scale.x = slowdown_radius * 2.0;
32  slowdown_marker.scale.y = slowdown_radius * 2.0;
33  slowdown_marker.scale.z = 0.02;
34  slowdown_marker.color.a = 0.2;
35  slowdown_marker.color.r = 0.0;
36  slowdown_marker.color.g = 1.0;
37  slowdown_marker.color.b = 0.0;
38  return slowdown_marker;
39 }
40 
41 } // namespace nav2_graceful_controller