Autonomous Racing  1
f1tenth Project Group of Technical University Dortmund, Germany
rviz_geometry_publisher.cpp
Go to the documentation of this file.
1 #include "rviz_geometry_publisher.h"
2 
3 RvizGeometryPublisher::RvizGeometryPublisher(ros::NodeHandle node_handle, const std::string& topic,
4  const std::string& frame)
5  : m_frame(frame)
6 {
7  this->m_marker_publisher = node_handle.advertise<visualization_msgs::Marker>(topic, 10);
8 }
9 
11  std_msgs::ColorRGBA color, float width)
12 {
13  visualization_msgs::Marker line_list;
14  line_list.header.frame_id = this->m_frame;
15  line_list.header.stamp = ros::Time::now();
16  line_list.ns = "points_and_lines";
17  line_list.action = visualization_msgs::Marker::ADD;
18  line_list.pose.orientation.w = 1.0;
19 
20  line_list.id = id;
21  line_list.type = visualization_msgs::Marker::LINE_LIST;
22  line_list.scale.x = width;
23  line_list.color = color;
24 
25  line_list.points.push_back(point1);
26  line_list.points.push_back(point2);
27 
28  this->m_marker_publisher.publish(line_list);
29 }
30 
31 geometry_msgs::Point createPoint(double x, double y, double z)
32 {
34  p.x = x;
35  p.y = y;
36  p.z = z;
37  return p;
38 }
39 
40 std_msgs::ColorRGBA createColor(double r, double g, double b, double a)
41 {
42  std_msgs::ColorRGBA c;
43  c.r = r;
44  c.g = g;
45  c.b = b;
46  c.a = a;
47  return c;
48 }
geometry_msgs::Point createPoint(float x, float y, float z)
std_msgs::ColorRGBA createColor(double r, double g, double b, double a)
RvizGeometryPublisher(ros::NodeHandle node_handle, const std::string &topic, const std::string &frame)
Point
Definition: circle.py:8
void drawLine(int id, geometry_msgs::Point point1, geometry_msgs::Point point2, std_msgs::ColorRGBA color, float width)