rviz_visual_tools.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2017, PickNik Consulting
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the Univ of CO, Boulder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman <dave@picknik.ai>, Andy McEvoy
36  Desc: Helper functions for displaying basic shape markers in Rviz
37 */
38 
39 #pragma once
40 
41 #include <ros/ros.h>
42 
43 // C++
44 #include <string>
45 #include <vector>
46 
47 // Eigen
48 #include <Eigen/Geometry>
50 
51 // Rviz
52 #include <visualization_msgs/Marker.h>
53 #include <visualization_msgs/MarkerArray.h>
54 
55 // Boost
56 #include <boost/shared_ptr.hpp>
57 
58 // Messages
59 #include <shape_msgs/Mesh.h>
60 #include <std_msgs/ColorRGBA.h>
61 #include <graph_msgs/GeometryGraph.h>
62 #include <geometry_msgs/PoseArray.h>
63 #include <geometry_msgs/PoseStamped.h>
64 #include <geometry_msgs/Polygon.h>
65 #include <trajectory_msgs/JointTrajectory.h>
66 
67 // rviz_visual_tools
70 
71 // Import/export for windows dll's and visibility for gcc shared libraries.
72 
73 #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
74 #ifdef rviz_visual_tools_EXPORTS // we are building a shared lib/dll
75 #define RVIZ_VISUAL_TOOLS_DECL ROS_HELPER_EXPORT
76 #else // we are using shared lib/dll
77 #define RVIZ_VISUAL_TOOLS_DECL ROS_HELPER_IMPORT
78 #endif
79 #else // ros is being built around static libraries
80 #define RVIZ_VISUAL_TOOLS_DECL
81 #endif
82 
83 namespace rviz_visual_tools
84 {
85 // Default constants
86 static const std::string RVIZ_MARKER_TOPIC = "/rviz_visual_tools";
87 static const double SMALL_SCALE = 0.001;
88 static const double LARGE_SCALE = 100;
89 
90 // Note: when adding new colors to colors, also add them to getRandColor() function
91 enum colors
92 {
93  BLACK = 0,
94  BROWN = 1,
95  BLUE = 2,
96  CYAN = 3,
97  GREY = 4,
98  DARK_GREY = 5,
99  GREEN = 6,
101  MAGENTA = 8,
102  ORANGE = 9,
103  PURPLE = 10,
104  RED = 11,
105  PINK = 12,
106  WHITE = 13,
107  YELLOW = 14,
111  RAND = 18,
112  CLEAR = 19,
113  DEFAULT = 20 // i.e. 'do not change default color'
114 };
115 
116 enum scales
117 {
119  XXXSMALL = 2,
120  XXSMALL = 3,
121  XSMALL = 4,
122  SMALL = 5,
123  MEDIUM = 6, // same as REGULAR
124  LARGE = 7,
125  XLARGE = 8,
126  XXLARGE = 9,
127  XXXLARGE = 10,
128  XXXXLARGE = 11,
129 };
130 
132 {
133  XYZ = 0,
134  ZYX, // This is the ROS standard: http://www.ros.org/reps/rep-0103.html
136 };
137 
142 {
143  double x_min_, x_max_;
144  double y_min_, y_max_;
145  double z_min_, z_max_;
149 
150  RandomPoseBounds(double x_min = 0.0, double x_max = 1.0, double y_min = 0.0, double y_max = 1.0, double z_min = 0.0,
151  double z_max = 1.0, double elevation_min = 0.0, double elevation_max = M_PI,
152  double azimuth_min = 0.0, double azimuth_max = 2 * M_PI, double angle_min = 0.0,
153  double angle_max = 2 * M_PI)
154  {
155  x_min_ = x_min;
156  x_max_ = x_max;
157  y_min_ = y_min;
158  y_max_ = y_max;
159  z_min_ = z_min;
160  z_max_ = z_max;
161  elevation_min_ = elevation_min;
162  elevation_max_ = elevation_max;
163  azimuth_min_ = azimuth_min;
164  azimuth_max_ = azimuth_max;
165  angle_min_ = angle_min;
166  angle_max_ = angle_max;
167  }
168 };
169 
174 {
176 
177  explicit RandomCuboidBounds(double cuboid_size_min = 0.02, double cuboid_size_max = 0.15)
178  {
179  cuboid_size_min_ = cuboid_size_min;
180  cuboid_size_max_ = cuboid_size_max;
181  }
182 };
183 
185 {
186 private:
190  void initialize();
191 
192 public:
199  explicit RvizVisualTools(std::string base_frame, std::string marker_topic = RVIZ_MARKER_TOPIC,
200  ros::NodeHandle nh = ros::NodeHandle("~"));
205  {
206  }
207 
211  bool deleteAllMarkers();
212 
217  void resetMarkerCounts();
218 
223  bool loadRvizMarkers();
224 
226  void setMarkerTopic(const std::string& topic)
227  {
228  marker_topic_ = topic;
229  }
230 
236  void loadMarkerPub(bool wait_for_subscriber = false, bool latched = false);
237 
241  void waitForMarkerPub();
242  void waitForMarkerPub(double wait_time);
243 
251  bool waitForSubscriber(const ros::Publisher& pub, double wait_time = 0.5, bool blocking = false);
252 
257  void setAlpha(double alpha)
258  {
259  alpha_ = alpha;
260  }
265  void setLifetime(double lifetime);
266 
271  static colors getRandColor();
272 
278  std_msgs::ColorRGBA getColor(colors color) const;
279 
281  static colors intToRvizColor(std::size_t color);
282 
284  static rviz_visual_tools::scales intToRvizScale(std::size_t scale);
285 
287  static std::string scaleToString(scales scale);
288 
293  std_msgs::ColorRGBA createRandColor() const;
294 
299  static double slerp(double start, double end, double range, double value);
300 
305  std_msgs::ColorRGBA getColorScale(double value) const;
306 
313  geometry_msgs::Vector3 getScale(scales scale, double marker_scale = 1.0) const;
314 
321  Eigen::Isometry3d getVectorBetweenPoints(const Eigen::Vector3d& a, const Eigen::Vector3d& b) const;
322 
329  Eigen::Vector3d getCenterPoint(const Eigen::Vector3d& a, const Eigen::Vector3d& b) const;
330 
335  const std::string getBaseFrame() const
336  {
337  return base_frame_;
338  }
344  void setBaseFrame(const std::string& base_frame)
345  {
346  base_frame_ = base_frame;
347  loadRvizMarkers();
348  }
349 
353  double getGlobalScale() const
354  {
355  return global_scale_;
356  }
360  void setGlobalScale(double global_scale)
361  {
362  global_scale_ = global_scale;
363  }
369  bool publishMarker(visualization_msgs::Marker& marker);
370 
376  void enableBatchPublishing(bool enable = true);
377 
382  void enableFrameLocking(bool enable = true);
383 
391  bool triggerEvery(std::size_t queueSize);
392 
397  bool trigger();
398 
404  bool publishMarkers(visualization_msgs::MarkerArray& markers);
405 
413  bool publishCone(const Eigen::Isometry3d& pose, double angle, colors color = TRANSLUCENT, double scale = 1.0);
414  bool publishCone(const geometry_msgs::Pose& pose, double angle, colors color = TRANSLUCENT, double scale = 1.0);
415 
429  bool publishABCDPlane(const double A, const double B, const double C, const double D, colors color = TRANSLUCENT,
430  double x_width = 1.0, double y_width = 1.0);
431 
439  bool publishXYPlane(const Eigen::Isometry3d& pose, colors color = TRANSLUCENT, double scale = 1.0);
440  bool publishXYPlane(const geometry_msgs::Pose& pose, colors color = TRANSLUCENT, double scale = 1.0);
441 
449  bool publishXZPlane(const Eigen::Isometry3d& pose, colors color = TRANSLUCENT, double scale = 1.0);
450  bool publishXZPlane(const geometry_msgs::Pose& pose, colors color = TRANSLUCENT, double scale = 1.0);
451 
459  bool publishYZPlane(const Eigen::Isometry3d& pose, colors color = TRANSLUCENT, double scale = 1.0);
460  bool publishYZPlane(const geometry_msgs::Pose& pose, colors color = TRANSLUCENT, double scale = 1.0);
461 
472  bool publishSphere(const Eigen::Isometry3d& pose, colors color = BLUE, scales scale = MEDIUM,
473  const std::string& ns = "Sphere", std::size_t id = 0);
474  bool publishSphere(const Eigen::Vector3d& point, colors color = BLUE, scales scale = MEDIUM,
475  const std::string& ns = "Sphere", std::size_t id = 0);
476  bool publishSphere(const Eigen::Vector3d& point, colors color, double scale, const std::string& ns = "Sphere",
477  std::size_t id = 0);
478  bool publishSphere(const geometry_msgs::Point& point, colors color = BLUE, scales scale = MEDIUM,
479  const std::string& ns = "Sphere", std::size_t id = 0);
480  bool publishSphere(const geometry_msgs::Pose& pose, colors color = BLUE, scales scale = MEDIUM,
481  const std::string& ns = "Sphere", std::size_t id = 0);
482  bool publishSphere(const geometry_msgs::Pose& pose, colors color, double scale, const std::string& ns = "Sphere",
483  std::size_t id = 0);
484  bool publishSphere(const geometry_msgs::Pose& pose, colors color, const geometry_msgs::Vector3 scale,
485  const std::string& ns = "Sphere", std::size_t id = 0);
486  bool publishSphere(const geometry_msgs::Pose& pose, const std_msgs::ColorRGBA& color,
487  const geometry_msgs::Vector3 scale, const std::string& ns = "Sphere", std::size_t id = 0);
488  bool publishSphere(const Eigen::Isometry3d& pose, const std_msgs::ColorRGBA& color,
489  const geometry_msgs::Vector3 scale, const std::string& ns = "Sphere", std::size_t id = 0);
490  bool publishSphere(const Eigen::Vector3d& point, const std_msgs::ColorRGBA& color, const geometry_msgs::Vector3 scale,
491  const std::string& ns = "Sphere", std::size_t id = 0);
492  bool publishSphere(const geometry_msgs::PoseStamped& pose, colors color, const geometry_msgs::Vector3 scale,
493  const std::string& ns = "Sphere", std::size_t id = 0);
494 
503  bool publishSpheres(const EigenSTL::vector_Vector3d& points, colors color = BLUE, scales scale = MEDIUM,
504  const std::string& ns = "Spheres");
505  bool publishSpheres(const EigenSTL::vector_Vector3d& points, colors color, double scale = 0.1,
506  const std::string& ns = "Spheres");
507  bool publishSpheres(const std::vector<geometry_msgs::Point>& points, colors color = BLUE, scales scale = MEDIUM,
508  const std::string& ns = "Spheres");
509  bool publishSpheres(const std::vector<geometry_msgs::Point>& points, colors color = BLUE, double scale = 0.1,
510  const std::string& ns = "Spheres");
511  bool publishSpheres(const std::vector<geometry_msgs::Point>& points, colors color,
512  const geometry_msgs::Vector3& scale, const std::string& ns = "Spheres");
513 
522  bool publishSpheres(const EigenSTL::vector_Vector3d& points, const std::vector<colors>& colors, scales scale = MEDIUM,
523  const std::string& ns = "Spheres");
524  bool publishSpheres(const std::vector<geometry_msgs::Point>& points, const std::vector<std_msgs::ColorRGBA>& colors,
525  const geometry_msgs::Vector3& scale, const std::string& ns = "Spheres");
526 
535  bool publishXArrow(const Eigen::Isometry3d& pose, colors color = RED, scales scale = MEDIUM, double length = 0.0);
536  bool publishXArrow(const geometry_msgs::Pose& pose, colors color = RED, scales scale = MEDIUM, double length = 0.0);
537  bool publishXArrow(const geometry_msgs::PoseStamped& pose, colors color = RED, scales scale = MEDIUM,
538  double length = 0.0);
539 
548  bool publishYArrow(const Eigen::Isometry3d& pose, colors color = GREEN, scales scale = MEDIUM, double length = 0.0);
549  bool publishYArrow(const geometry_msgs::Pose& pose, colors color = GREEN, scales scale = MEDIUM, double length = 0.0);
550  bool publishYArrow(const geometry_msgs::PoseStamped& pose, colors color = GREEN, scales scale = MEDIUM,
551  double length = 0.0);
552 
561  bool publishZArrow(const Eigen::Isometry3d& pose, colors color = BLUE, scales scale = MEDIUM, double length = 0.0,
562  std::size_t id = 0);
563  bool publishZArrow(const geometry_msgs::Pose& pose, colors color = BLUE, scales scale = MEDIUM, double length = 0.0);
564  bool publishZArrow(const geometry_msgs::PoseStamped& pose, colors color = BLUE, scales scale = MEDIUM,
565  double length = 0.0);
566  bool publishZArrow(const geometry_msgs::PoseStamped& pose, colors color = BLUE, scales scale = MEDIUM,
567  double length = 0.0, std::size_t id = 0);
568 
579  bool publishArrow(const Eigen::Isometry3d& pose, colors color = BLUE, scales scale = MEDIUM, double length = 0.0,
580  std::size_t id = 0);
581  bool publishArrow(const geometry_msgs::Pose& pose, colors color = BLUE, scales scale = MEDIUM, double length = 0.0,
582  std::size_t id = 0);
583  bool publishArrow(const geometry_msgs::PoseStamped& pose, colors color = BLUE, scales scale = MEDIUM,
584  double length = 0.0, std::size_t id = 0);
585  bool publishArrow(const geometry_msgs::Point& start, const geometry_msgs::Point& end, colors color = BLUE,
586  scales scale = MEDIUM, std::size_t id = 0);
587 
595  bool publishCuboid(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color = BLUE);
596  bool publishCuboid(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2, colors color = BLUE,
597  const std::string& ns = "Cuboid", std::size_t id = 0);
598 
608  bool publishCuboid(const geometry_msgs::Pose& pose, double depth, double width, double height, colors color = BLUE);
609  bool publishCuboid(const Eigen::Isometry3d& pose, double depth, double width, double height, colors color = BLUE);
610 
618  bool publishCuboid(const Eigen::Isometry3d& pose, const Eigen::Vector3d& size, colors color = BLUE);
619  bool publishCuboid(const geometry_msgs::Pose& pose, const geometry_msgs::Vector3& size, colors color = BLUE);
620 
629  bool publishLine(const Eigen::Isometry3d& point1, const Eigen::Isometry3d& point2, colors color = BLUE,
630  scales scale = MEDIUM);
631  bool publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color = BLUE,
632  scales scale = MEDIUM);
633  bool publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color, double radius);
634  bool publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, const std_msgs::ColorRGBA& color,
635  scales scale = MEDIUM);
636  bool publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, const std_msgs::ColorRGBA& color,
637  double radius);
638  bool publishLine(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2, colors color = BLUE,
639  scales scale = MEDIUM);
640  bool publishLine(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2,
641  const std_msgs::ColorRGBA& color, scales scale = MEDIUM);
642  bool publishLine(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2,
643  const std_msgs::ColorRGBA& color, const geometry_msgs::Vector3& scale);
644 
653  bool publishLines(const EigenSTL::vector_Vector3d& aPoints, const EigenSTL::vector_Vector3d& bPoints,
654  const std::vector<colors>& colors, scales scale = MEDIUM);
655  bool publishLines(const std::vector<geometry_msgs::Point>& aPoints, const std::vector<geometry_msgs::Point>& bPoints,
656  const std::vector<std_msgs::ColorRGBA>& colors, const geometry_msgs::Vector3& scale);
657 
666  bool publishLineStrip(const std::vector<geometry_msgs::Point>& path, colors color = RED, scales scale = MEDIUM,
667  const std::string& ns = "Path");
668 
677  bool publishPath(const std::vector<geometry_msgs::Pose>& path, colors color = RED, scales scale = MEDIUM,
678  const std::string& ns = "Path");
679  bool publishPath(const std::vector<geometry_msgs::Point>& path, colors color, scales scale,
680  const std::string& ns = "Path");
681  bool publishPath(const EigenSTL::vector_Isometry3d& path, colors color, scales scale, const std::string& ns = "Path");
682  bool publishPath(const EigenSTL::vector_Vector3d& path, colors color, scales scale, const std::string& ns = "Path");
683  bool publishPath(const std::vector<geometry_msgs::Point>& path, colors color = RED, double radius = 0.01,
684  const std::string& ns = "Path");
685  bool publishPath(const EigenSTL::vector_Vector3d& path, colors color = RED, double radius = 0.01,
686  const std::string& ns = "Path");
687  bool publishPath(const EigenSTL::vector_Isometry3d& path, colors color = RED, double radius = 0.01,
688  const std::string& ns = "Path");
689 
699  bool publishPath(const EigenSTL::vector_Vector3d& path, const std::vector<colors>& colors, double radius = 0.01,
700  const std::string& ns = "Path");
701 
702  bool publishPath(const EigenSTL::vector_Vector3d& path, const std::vector<std_msgs::ColorRGBA>& colors, double radius,
703  const std::string& ns = "Path");
704 
713  bool publishPolygon(const geometry_msgs::Polygon& polygon, colors color = RED, scales scale = MEDIUM,
714  const std::string& ns = "Polygon");
715 
728  bool publishWireframeCuboid(const Eigen::Isometry3d& pose, double depth, double width, double height,
729  colors color = BLUE, const std::string& ns = "Wireframe Cuboid", std::size_t id = 0);
730 
741  bool publishWireframeCuboid(const Eigen::Isometry3d& pose, const Eigen::Vector3d& min_point,
742  const Eigen::Vector3d& max_point, colors color = BLUE,
743  const std::string& ns = "Wireframe Cuboid", std::size_t id = 0);
744 
754  bool publishWireframeRectangle(const Eigen::Isometry3d& pose, double height, double width, colors color = BLUE,
755  scales scale = MEDIUM, std::size_t id = 0);
756  bool publishWireframeRectangle(const Eigen::Isometry3d& pose, const Eigen::Vector3d& p1_in,
757  const Eigen::Vector3d& p2_in, const Eigen::Vector3d& p3_in,
758  const Eigen::Vector3d& p4_in, colors color, scales scale);
767  bool publishAxisLabeled(const Eigen::Isometry3d& pose, const std::string& label, scales scale = MEDIUM,
768  colors color = WHITE);
769  bool publishAxisLabeled(const geometry_msgs::Pose& pose, const std::string& label, scales scale = MEDIUM,
770  colors color = WHITE);
771 
781  bool publishAxis(const geometry_msgs::Pose& pose, scales scale = MEDIUM, const std::string& ns = "Axis");
782  bool publishAxis(const Eigen::Isometry3d& pose, scales scale = MEDIUM, const std::string& ns = "Axis");
783  bool publishAxis(const geometry_msgs::Pose& pose, double length, double radius = 0.01, const std::string& ns = "Axis");
784  bool publishAxis(const Eigen::Isometry3d& pose, double length, double radius = 0.01, const std::string& ns = "Axis");
785 
786 private:
795  bool publishAxisInternal(const Eigen::Isometry3d& pose, double length = 0.1, double radius = 0.01,
796  const std::string& ns = "Axis");
797 
798 public:
807  bool publishAxisPath(const EigenSTL::vector_Isometry3d& path, scales scale = MEDIUM,
808  const std::string& ns = "Axis Path");
809  bool publishAxisPath(const EigenSTL::vector_Isometry3d& path, double length = 0.1, double radius = 0.01,
810  const std::string& ns = "Axis Path");
811 
820  bool publishCylinder(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color = BLUE,
821  scales scale = MEDIUM, const std::string& ns = "Cylinder");
822  bool publishCylinder(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color, double radius = 0.01,
823  const std::string& ns = "Cylinder");
824  bool publishCylinder(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, const std_msgs::ColorRGBA& color,
825  double radius = 0.01, const std::string& ns = "Cylinder");
826 
835  bool publishCylinder(const Eigen::Isometry3d& pose, colors color = BLUE, double height = 0.1, double radius = 0.01,
836  const std::string& ns = "Cylinder");
837  bool publishCylinder(const geometry_msgs::Pose& pose, colors color = BLUE, double height = 0.1, double radius = 0.01,
838  const std::string& ns = "Cylinder");
839  bool publishCylinder(const geometry_msgs::Pose& pose, const std_msgs::ColorRGBA& color, double height = 0.1,
840  double radius = 0.01, const std::string& ns = "Cylinder");
841 
853  bool publishMesh(const Eigen::Isometry3d& pose, const std::string& file_name, colors color = CLEAR, double scale = 1,
854  const std::string& ns = "mesh", std::size_t id = 0);
855  bool publishMesh(const geometry_msgs::Pose& pose, const std::string& file_name, colors color = CLEAR,
856  double scale = 1, const std::string& ns = "mesh", std::size_t id = 0);
857 
869  bool publishMesh(const Eigen::Isometry3d& pose, const shape_msgs::Mesh& mesh, colors color = CLEAR, double scale = 1,
870  const std::string& ns = "mesh", std::size_t id = 0);
871  bool publishMesh(const geometry_msgs::Pose& pose, const shape_msgs::Mesh& mesh, colors color = CLEAR,
872  double scale = 1, const std::string& ns = "mesh", std::size_t id = 0);
873 
881  bool publishGraph(const graph_msgs::GeometryGraph& graph, colors color, double radius);
882 
892  bool publishText(const Eigen::Isometry3d& pose, const std::string& text, colors color = WHITE, scales scale = MEDIUM,
893  bool static_id = true);
894  bool publishText(const Eigen::Isometry3d& pose, const std::string& text, colors color,
895  const geometry_msgs::Vector3 scale, bool static_id = true);
896  bool publishText(const geometry_msgs::Pose& pose, const std::string& text, colors color = WHITE,
897  scales scale = MEDIUM, bool static_id = true);
898  bool publishText(const geometry_msgs::Pose& pose, const std::string& text, colors color,
899  const geometry_msgs::Vector3 scale, bool static_id = true);
900 
906  static geometry_msgs::Pose convertPose(const Eigen::Isometry3d& pose);
907 
913  static void convertPoseSafe(const Eigen::Isometry3d& pose, geometry_msgs::Pose& pose_msg);
914 
921  static Eigen::Isometry3d convertPose(const geometry_msgs::Pose& pose);
922 
928  static void convertPoseSafe(const geometry_msgs::Pose& pose_msg, Eigen::Isometry3d& pose);
929 
936  static Eigen::Isometry3d convertPoint32ToPose(const geometry_msgs::Point32& point);
937 
941  static geometry_msgs::Pose convertPointToPose(const geometry_msgs::Point& point);
942  static Eigen::Isometry3d convertPointToPose(const Eigen::Vector3d& point);
943 
950  static geometry_msgs::Point convertPoseToPoint(const Eigen::Isometry3d& pose);
951 
958  static Eigen::Vector3d convertPoint(const geometry_msgs::Point& point);
959 
966  static Eigen::Vector3d convertPoint32(const geometry_msgs::Point32& point);
967 
974  static geometry_msgs::Point32 convertPoint32(const Eigen::Vector3d& point);
975 
982  static geometry_msgs::Point convertPoint(const geometry_msgs::Vector3& point);
983 
990  static geometry_msgs::Point convertPoint(const Eigen::Vector3d& point);
991 
1002  static Eigen::Isometry3d convertFromXYZRPY(double tx, double ty, double tz, double rx, double ry, double rz,
1003  EulerConvention convention); // ZYX is ROS standard
1004  static Eigen::Isometry3d convertFromXYZRPY(const std::vector<double>& transform6,
1005  EulerConvention convention); // ZYX is ROS standard
1006 
1007  // TODO(davetcoleman): add opposite conversion that uses Eigen::Vector3d rpy = pose.rotation().eulerAngles(0, 1, 2);
1008 
1015  static void convertToXYZRPY(const Eigen::Isometry3d& pose, std::vector<double>& xyzrpy);
1016  static void convertToXYZRPY(const Eigen::Isometry3d& pose, double& x, double& y, double& z, double& roll,
1017  double& pitch, double& yaw);
1023  static void generateRandomPose(geometry_msgs::Pose& pose, RandomPoseBounds pose_bounds = RandomPoseBounds());
1024  static void generateRandomPose(Eigen::Isometry3d& pose, RandomPoseBounds pose_bounds = RandomPoseBounds());
1025 
1029  static void generateRandomCuboid(geometry_msgs::Pose& cuboid_pose, double& depth, double& width, double& height,
1030  RandomPoseBounds pose_bounds = RandomPoseBounds(),
1031  RandomCuboidBounds cuboid_bounds = RandomCuboidBounds());
1032 
1037  static geometry_msgs::Pose getIdentityPose();
1038 
1046  static bool posesEqual(const Eigen::Isometry3d& pose1, const Eigen::Isometry3d& pose2, double threshold = 0.000001);
1047 
1051  static double dRand(double min, double max);
1052  static float fRand(float min, float max);
1053  static int iRand(int min, int max);
1054 
1058  static void printTranslation(const Eigen::Vector3d& translation);
1059 
1063  static void printTransform(const Eigen::Isometry3d& transform);
1064 
1068  static void printTransformRPY(const Eigen::Isometry3d& transform);
1069 
1073  static void printTransformFull(const Eigen::Isometry3d& transform);
1074 
1076  bool getPsychedelicMode() const
1077  {
1078  return psychedelic_mode_;
1079  }
1080 
1082  void setPsychedelicMode(bool psychedelic_mode = true)
1083  {
1084  psychedelic_mode_ = psychedelic_mode;
1085  }
1086 
1088  void prompt(const std::string& msg);
1089 
1092 
1094  void loadRemoteControl();
1095 
1096 protected:
1097  // A shared node handle
1099 
1100  // Short name for this class
1101  static RVIZ_VISUAL_TOOLS_DECL const std::string NAME;
1102 
1103  // Optional remote control
1105 
1106  // ROS publishers
1107  ros::Publisher pub_rviz_markers_; // for rviz visualization markers
1110 
1111  // Strings
1112  std::string marker_topic_; // topic to publish to rviz
1113  std::string base_frame_; // name of base link
1114 
1115  // Duration to have Rviz markers persist, 0 for infinity
1117 
1118  // Settings
1121  double alpha_ = 1.0; // opacity of all markers
1122  double global_scale_ = 1.0; // allow all markers to be increased by a constanct factor
1123 
1124  // Cached Rviz Marker Array
1125  visualization_msgs::MarkerArray markers_;
1126 
1127  // Cached Rviz markers
1128  visualization_msgs::Marker arrow_marker_;
1129  visualization_msgs::Marker sphere_marker_;
1130  visualization_msgs::Marker block_marker_;
1131  visualization_msgs::Marker cylinder_marker_;
1132  visualization_msgs::Marker mesh_marker_;
1133  visualization_msgs::Marker text_marker_;
1134  visualization_msgs::Marker cuboid_marker_;
1135  visualization_msgs::Marker line_strip_marker_;
1136  visualization_msgs::Marker line_list_marker_;
1137  visualization_msgs::Marker spheres_marker_;
1138  visualization_msgs::Marker reset_marker_;
1139  visualization_msgs::Marker triangle_marker_;
1140 
1141  // Just for fun.
1142  bool psychedelic_mode_ = false;
1143 
1144  // Chose random colors from this list
1145  static const std::array<colors, 14> ALL_RAND_COLORS;
1146 
1147 public:
1148  EIGEN_MAKE_ALIGNED_OPERATOR_NEW // http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
1149 }; // class
1150 
1151 typedef std::shared_ptr<RvizVisualTools> RvizVisualToolsPtr;
1152 typedef std::shared_ptr<const RvizVisualTools> RvizVisualToolsConstPtr;
1153 
1154 } // namespace rviz_visual_tools
rviz_visual_tools::RvizVisualTools::convertPoseSafe
static void convertPoseSafe(const Eigen::Isometry3d &pose, geometry_msgs::Pose &pose_msg)
Convert an Eigen pose to a geometry_msg pose - thread safe.
Definition: rviz_visual_tools.cpp:2575
rviz_visual_tools::RvizVisualTools::dRand
static double dRand(double min, double max)
Get random between min and max.
Definition: rviz_visual_tools.cpp:2834
rviz_visual_tools::RvizVisualTools::global_scale_
double global_scale_
Definition: rviz_visual_tools.h:1122
rviz_visual_tools::BROWN
@ BROWN
Definition: rviz_visual_tools.h:94
rviz_visual_tools::DARK_GREY
@ DARK_GREY
Definition: rviz_visual_tools.h:98
rviz_visual_tools::RvizVisualTools::remote_control_
RemoteControlPtr remote_control_
Definition: rviz_visual_tools.h:1104
EigenSTL::vector_Isometry3d
std::vector< Eigen::Isometry3d, Eigen::aligned_allocator< Eigen::Isometry3d > > vector_Isometry3d
ros::Publisher
rviz_visual_tools::RvizVisualTools::getColor
std_msgs::ColorRGBA getColor(colors color) const
Get the RGB value of standard colors.
Definition: rviz_visual_tools.cpp:408
rviz_visual_tools::RvizVisualTools::getRandColor
static colors getRandColor()
Get a random color from the list of hardcoded enum color types.
Definition: rviz_visual_tools.cpp:402
rviz_visual_tools::RvizVisualTools::convertPoseToPoint
static geometry_msgs::Point convertPoseToPoint(const Eigen::Isometry3d &pose)
Convert an Eigen pose to a geometry_msg point Note: Not thread safe but very convenient.
Definition: rviz_visual_tools.cpp:2621
rviz_visual_tools::RvizVisualTools::setAlpha
void setAlpha(double alpha)
Change the transparency of all markers published.
Definition: rviz_visual_tools.h:257
rviz_visual_tools::RandomPoseBounds::angle_max_
double angle_max_
Definition: rviz_visual_tools.h:148
rviz_visual_tools::RvizVisualTools::getPsychedelicMode
bool getPsychedelicMode() const
Getter for PsychedelicMode.
Definition: rviz_visual_tools.h:1076
rviz_visual_tools::MAGENTA
@ MAGENTA
Definition: rviz_visual_tools.h:101
rviz_visual_tools::RvizVisualTools::marker_topic_
std::string marker_topic_
Definition: rviz_visual_tools.h:1112
rviz_visual_tools::RvizVisualTools::convertPoint
static Eigen::Vector3d convertPoint(const geometry_msgs::Point &point)
Convert a geometry_msg point to an Eigen point Note: Not thread safe but very convenient.
Definition: rviz_visual_tools.cpp:2628
rviz_visual_tools::RvizVisualTools::sphere_marker_
visualization_msgs::Marker sphere_marker_
Definition: rviz_visual_tools.h:1129
rviz_visual_tools::RvizVisualTools::publishPath
bool publishPath(const std::vector< geometry_msgs::Pose > &path, colors color=RED, scales scale=MEDIUM, const std::string &ns="Path")
Display a marker of a series of connected cylinders.
Definition: rviz_visual_tools.cpp:2019
rviz_visual_tools::RvizVisualTools::prompt
void prompt(const std::string &msg)
Wait for user feedback i.e. through a button or joystick.
Definition: rviz_visual_tools.cpp:2886
rviz_visual_tools::RvizVisualTools::getCenterPoint
Eigen::Vector3d getCenterPoint(const Eigen::Vector3d &a, const Eigen::Vector3d &b) const
Find the center between to points.
Definition: rviz_visual_tools.cpp:749
deprecation.h
rviz_visual_tools::RvizVisualTools::printTransformFull
static void printTransformFull(const Eigen::Isometry3d &transform)
Display in the console a transform with full 3x3 rotation matrix.
Definition: rviz_visual_tools.cpp:2879
ros.h
rviz_visual_tools::RvizVisualTools::setBaseFrame
void setBaseFrame(const std::string &base_frame)
Change the global base frame Note: this might reset all your current markers.
Definition: rviz_visual_tools.h:344
rviz_visual_tools::RvizVisualTools::getVectorBetweenPoints
Eigen::Isometry3d getVectorBetweenPoints(const Eigen::Vector3d &a, const Eigen::Vector3d &b) const
Create a vector that points from point a to point b.
Definition: rviz_visual_tools.cpp:758
rviz_visual_tools::CLEAR
@ CLEAR
Definition: rviz_visual_tools.h:112
rviz_visual_tools::RvizVisualTools::publishXArrow
bool publishXArrow(const Eigen::Isometry3d &pose, colors color=RED, scales scale=MEDIUM, double length=0.0)
Display an arrow along the x-axis of a pose.
Definition: rviz_visual_tools.cpp:1285
rviz_visual_tools::XXXSMALL
@ XXXSMALL
Definition: rviz_visual_tools.h:119
rviz_visual_tools::RvizVisualToolsConstPtr
std::shared_ptr< const RvizVisualTools > RvizVisualToolsConstPtr
Definition: rviz_visual_tools.h:1152
rviz_visual_tools::RvizVisualTools::publishWireframeRectangle
bool publishWireframeRectangle(const Eigen::Isometry3d &pose, double height, double width, colors color=BLUE, scales scale=MEDIUM, std::size_t id=0)
Publish outline of a rectangle.
Definition: rviz_visual_tools.cpp:2295
rviz_visual_tools::RvizVisualTools::~RvizVisualTools
~RvizVisualTools()
Deconstructor.
Definition: rviz_visual_tools.h:204
rviz_visual_tools::RvizVisualTools::deleteAllMarkers
bool deleteAllMarkers()
Tell Rviz to clear all markers on a particular display.
Definition: rviz_visual_tools.cpp:110
rviz_visual_tools::RemoteControlPtr
std::shared_ptr< RemoteControl > RemoteControlPtr
Definition: remote_control.h:167
rviz_visual_tools::RvizVisualTools::scaleToString
static std::string scaleToString(scales scale)
Convert an enum to its string name equivalent.
Definition: rviz_visual_tools.cpp:594
rviz_visual_tools::RvizVisualTools::publishCone
bool publishCone(const Eigen::Isometry3d &pose, double angle, colors color=TRANSLUCENT, double scale=1.0)
Display a cone of a given angle along the x-axis.
Definition: rviz_visual_tools.cpp:959
rviz_visual_tools::RvizVisualTools::getColorScale
std_msgs::ColorRGBA getColorScale(double value) const
Convert a value from [0,1] to a color Green->Red.
Definition: rviz_visual_tools.cpp:650
rviz_visual_tools::XXLARGE
@ XXLARGE
Definition: rviz_visual_tools.h:126
rviz_visual_tools::RvizVisualTools::psychedelic_mode_
bool psychedelic_mode_
Definition: rviz_visual_tools.h:1142
rviz_visual_tools::PINK
@ PINK
Definition: rviz_visual_tools.h:105
rviz_visual_tools::RvizVisualTools::enableBatchPublishing
void enableBatchPublishing(bool enable=true)
Enable batch publishing - useful for when many markers need to be published at once and the ROS topic...
Definition: rviz_visual_tools.cpp:854
rviz_visual_tools::RvizVisualTools::posesEqual
static bool posesEqual(const Eigen::Isometry3d &pose1, const Eigen::Isometry3d &pose2, double threshold=0.000001)
Test if two Eigen poses are close enough.
Definition: rviz_visual_tools.cpp:2819
rviz_visual_tools::RvizVisualTools::publishYZPlane
bool publishYZPlane(const Eigen::Isometry3d &pose, colors color=TRANSLUCENT, double scale=1.0)
Display the XY plane of a given pose.
Definition: rviz_visual_tools.cpp:1121
rviz_visual_tools
Definition: imarker_simple.h:55
rviz_visual_tools::RvizVisualTools::convertPose
static geometry_msgs::Pose convertPose(const Eigen::Isometry3d &pose)
Convert an Eigen pose to a geometry_msg pose.
Definition: rviz_visual_tools.cpp:2568
rviz_visual_tools::XXXLARGE
@ XXXLARGE
Definition: rviz_visual_tools.h:127
rviz_visual_tools::RvizVisualTools
Definition: rviz_visual_tools.h:184
rviz_visual_tools::RvizVisualTools::getBaseFrame
const std::string getBaseFrame() const
Get the base frame.
Definition: rviz_visual_tools.h:335
rviz_visual_tools::RvizVisualTools::publishAxisInternal
bool publishAxisInternal(const Eigen::Isometry3d &pose, double length=0.1, double radius=0.01, const std::string &ns="Axis")
Display a red/green/blue coordinate axis - the 'internal' version does not do a batch publish.
Definition: rviz_visual_tools.cpp:1505
rviz_visual_tools::RvizVisualTools::publishCylinder
bool publishCylinder(const Eigen::Vector3d &point1, const Eigen::Vector3d &point2, colors color=BLUE, scales scale=MEDIUM, const std::string &ns="Cylinder")
Display a marker of a cylinder.
Definition: rviz_visual_tools.cpp:1552
rviz_visual_tools::PURPLE
@ PURPLE
Definition: rviz_visual_tools.h:103
rviz_visual_tools::RvizVisualToolsPtr
std::shared_ptr< RvizVisualTools > RvizVisualToolsPtr
Definition: rviz_visual_tools.h:1151
rviz_visual_tools::RvizVisualTools::line_strip_marker_
visualization_msgs::Marker line_strip_marker_
Definition: rviz_visual_tools.h:1135
rviz_visual_tools::XXXXSMALL
@ XXXXSMALL
Definition: rviz_visual_tools.h:118
rviz_visual_tools::RvizVisualTools::frame_locking_enabled_
bool frame_locking_enabled_
Definition: rviz_visual_tools.h:1120
rviz_visual_tools::RvizVisualTools::waitForSubscriber
bool waitForSubscriber(const ros::Publisher &pub, double wait_time=0.5, bool blocking=false)
Wait until at least one subscriber connects to a publisher.
Definition: rviz_visual_tools.cpp:336
rviz_visual_tools::ZXZ
@ ZXZ
Definition: rviz_visual_tools.h:135
RVIZ_VISUAL_TOOLS_DECL
#define RVIZ_VISUAL_TOOLS_DECL
Definition: rviz_visual_tools.h:80
rviz_visual_tools::SMALL_SCALE
static const double SMALL_SCALE
Definition: rviz_visual_tools.h:87
rviz_visual_tools::RandomPoseBounds::x_max_
double x_max_
Definition: rviz_visual_tools.h:143
rviz_visual_tools::RvizVisualTools::printTransformRPY
static void printTransformRPY(const Eigen::Isometry3d &transform)
Display in the console a transform in roll pitch yaw.
Definition: rviz_visual_tools.cpp:2871
rviz_visual_tools::RvizVisualTools::cuboid_marker_
visualization_msgs::Marker cuboid_marker_
Definition: rviz_visual_tools.h:1134
rviz_visual_tools::XXXXLARGE
@ XXXXLARGE
Definition: rviz_visual_tools.h:128
rviz_visual_tools::RvizVisualTools::intToRvizScale
static rviz_visual_tools::scales intToRvizScale(std::size_t scale)
Used by interfaces that do not directly depend on Rviz Visual Tools, such as OMPL.
Definition: rviz_visual_tools.cpp:572
rviz_visual_tools::RvizVisualTools::setGlobalScale
void setGlobalScale(double global_scale)
Setter for the global scale used for changing size of all markers.
Definition: rviz_visual_tools.h:360
rviz_visual_tools::RvizVisualTools::fRand
static float fRand(float min, float max)
Definition: rviz_visual_tools.cpp:2840
rviz_visual_tools::RvizVisualTools::convertPointToPose
static geometry_msgs::Pose convertPointToPose(const geometry_msgs::Point &point)
Add an identity rotation matrix to make a point have a full pose.
Definition: rviz_visual_tools.cpp:2602
rviz_visual_tools::CYAN
@ CYAN
Definition: rviz_visual_tools.h:96
rviz_visual_tools::RvizVisualTools::pub_rviz_markers_connected_
bool pub_rviz_markers_connected_
Definition: rviz_visual_tools.h:1108
A
rviz_visual_tools::XSMALL
@ XSMALL
Definition: rviz_visual_tools.h:121
rviz_visual_tools::RvizVisualTools::triggerEvery
bool triggerEvery(std::size_t queueSize)
Trigger the publish function to send out all collected markers IF there are at least queueSize number...
Definition: rviz_visual_tools.cpp:864
rviz_visual_tools::WHITE
@ WHITE
Definition: rviz_visual_tools.h:106
rviz_visual_tools::TRANSLUCENT_LIGHT
@ TRANSLUCENT_LIGHT
Definition: rviz_visual_tools.h:109
rviz_visual_tools::RvizVisualTools::publishLineStrip
bool publishLineStrip(const std::vector< geometry_msgs::Point > &path, colors color=RED, scales scale=MEDIUM, const std::string &ns="Path")
Display a series of connected lines using the LINE_STRIP method - deprecated because visual bugs.
Definition: rviz_visual_tools.cpp:1983
rviz_visual_tools::RvizVisualTools::pub_rviz_markers_waited_
bool pub_rviz_markers_waited_
Definition: rviz_visual_tools.h:1109
rviz_visual_tools::RvizVisualTools::marker_lifetime_
ros::Duration marker_lifetime_
Definition: rviz_visual_tools.h:1116
rviz_visual_tools::RvizVisualTools::convertToXYZRPY
static void convertToXYZRPY(const Eigen::Isometry3d &pose, std::vector< double > &xyzrpy)
Convert an affine3d to xyz rpy components R-P-Y / X-Y-Z / 0-1-2 Euler Angle Standard.
Definition: rviz_visual_tools.cpp:2715
rviz_visual_tools::RandomPoseBounds::elevation_max_
double elevation_max_
Definition: rviz_visual_tools.h:146
EigenSTL::vector_Vector3d
std::vector< Eigen::Vector3d, Eigen::aligned_allocator< Eigen::Vector3d > > vector_Vector3d
rviz_visual_tools::RvizVisualTools::mesh_marker_
visualization_msgs::Marker mesh_marker_
Definition: rviz_visual_tools.h:1132
rviz_visual_tools::RvizVisualTools::enableFrameLocking
void enableFrameLocking(bool enable=true)
Enable frame locking - useful for when the markers is attached to a moving TF, the marker will be re-...
Definition: rviz_visual_tools.cpp:859
rviz_visual_tools::RvizVisualTools::publishZArrow
bool publishZArrow(const Eigen::Isometry3d &pose, colors color=BLUE, scales scale=MEDIUM, double length=0.0, std::size_t id=0)
Display an arrow along the z-axis of a pose.
Definition: rviz_visual_tools.cpp:1320
rviz_visual_tools::RvizVisualTools::convertFromXYZRPY
static Eigen::Isometry3d convertFromXYZRPY(double tx, double ty, double tz, double rx, double ry, double rz, EulerConvention convention)
Converts scalar translations and rotations to an Eigen Frame. This is achieved by chaining a translat...
Definition: rviz_visual_tools.cpp:2673
rviz_visual_tools::RandomPoseBounds::azimuth_max_
double azimuth_max_
Definition: rviz_visual_tools.h:147
rviz_visual_tools::RvizVisualTools::alpha_
double alpha_
Definition: rviz_visual_tools.h:1121
rviz_visual_tools::RvizVisualTools::printTransform
static void printTransform(const Eigen::Isometry3d &transform)
Display in the console a transform in quaternions.
Definition: rviz_visual_tools.cpp:2863
rviz_visual_tools::RvizVisualTools::loadMarkerPub
void loadMarkerPub(bool wait_for_subscriber=false, bool latched=false)
Load publishers as needed.
Definition: rviz_visual_tools.cpp:307
rviz_visual_tools::RandomPoseBounds::y_max_
double y_max_
Definition: rviz_visual_tools.h:144
rviz_visual_tools::TRANSLUCENT
@ TRANSLUCENT
Definition: rviz_visual_tools.h:108
rviz_visual_tools::RvizVisualTools::ALL_RAND_COLORS
static const std::array< colors, 14 > ALL_RAND_COLORS
Definition: rviz_visual_tools.h:1145
rviz_visual_tools::ZYX
@ ZYX
Definition: rviz_visual_tools.h:134
rviz_visual_tools::RandomCuboidBounds::RandomCuboidBounds
RandomCuboidBounds(double cuboid_size_min=0.02, double cuboid_size_max=0.15)
Definition: rviz_visual_tools.h:177
rviz_visual_tools::RvizVisualTools::text_marker_
visualization_msgs::Marker text_marker_
Definition: rviz_visual_tools.h:1133
rviz_visual_tools::RvizVisualTools::publishArrow
bool publishArrow(const Eigen::Isometry3d &pose, colors color=BLUE, scales scale=MEDIUM, double length=0.0, std::size_t id=0)
Display an arrow along the x-axis of a pose.
Definition: rviz_visual_tools.cpp:1350
rviz_visual_tools::LARGE_SCALE
static const double LARGE_SCALE
Definition: rviz_visual_tools.h:88
rviz_visual_tools::RvizVisualTools::convertPoint32ToPose
static Eigen::Isometry3d convertPoint32ToPose(const geometry_msgs::Point32 &point)
Convert a geometry_msg point (32bit) to an Eigen pose Note: Not thread safe but very convenient.
Definition: rviz_visual_tools.cpp:2592
rviz_visual_tools::RvizVisualTools::slerp
static double slerp(double start, double end, double range, double value)
Interpolate from [start, end] with value of size steps with current value count.
Definition: rviz_visual_tools.cpp:645
rviz_visual_tools::RvizVisualTools::loadRemoteControl
void loadRemoteControl()
Pre-load remote control.
Definition: rviz_visual_tools.cpp:2900
rviz_visual_tools::RvizVisualTools::publishSphere
bool publishSphere(const Eigen::Isometry3d &pose, colors color=BLUE, scales scale=MEDIUM, const std::string &ns="Sphere", std::size_t id=0)
Display a marker of a sphere.
Definition: rviz_visual_tools.cpp:1167
rviz_visual_tools::RandomCuboidBounds::cuboid_size_min_
double cuboid_size_min_
Definition: rviz_visual_tools.h:175
rviz_visual_tools::RvizVisualTools::publishAxis
bool publishAxis(const geometry_msgs::Pose &pose, scales scale=MEDIUM, const std::string &ns="Axis")
Display a red/green/blue coordinate frame axis.
Definition: rviz_visual_tools.cpp:1479
rviz_visual_tools::RvizVisualTools::setLifetime
void setLifetime(double lifetime)
Set the lifetime of markers published to rviz.
Definition: rviz_visual_tools.cpp:387
rviz_visual_tools::RvizVisualTools::generateRandomCuboid
static void generateRandomCuboid(geometry_msgs::Pose &cuboid_pose, double &depth, double &width, double &height, RandomPoseBounds pose_bounds=RandomPoseBounds(), RandomCuboidBounds cuboid_bounds=RandomCuboidBounds())
Create a random rectangular cuboid of some shape.
Definition: rviz_visual_tools.cpp:2742
rviz_visual_tools::RvizVisualTools::setMarkerTopic
void setMarkerTopic(const std::string &topic)
Set marker array topic.
Definition: rviz_visual_tools.h:226
rviz_visual_tools::RvizVisualTools::getIdentityPose
static geometry_msgs::Pose getIdentityPose()
Create a pose of position (0,0,0) and quaternion (0,0,0,1)
Definition: rviz_visual_tools.cpp:2803
rviz_visual_tools::RvizVisualTools::nh_
ros::NodeHandle nh_
Definition: rviz_visual_tools.h:1098
rviz_visual_tools::RandomPoseBounds::elevation_min_
double elevation_min_
Definition: rviz_visual_tools.h:146
rviz_visual_tools::YELLOW
@ YELLOW
Definition: rviz_visual_tools.h:107
rviz_visual_tools::RED
@ RED
Definition: rviz_visual_tools.h:104
rviz_visual_tools::RvizVisualTools::publishLine
bool publishLine(const Eigen::Isometry3d &point1, const Eigen::Isometry3d &point2, colors color=BLUE, scales scale=MEDIUM)
Display a marker of line.
Definition: rviz_visual_tools.cpp:1853
rviz_visual_tools::RvizVisualTools::arrow_marker_
visualization_msgs::Marker arrow_marker_
Definition: rviz_visual_tools.h:1128
rviz_visual_tools::colors
colors
Definition: rviz_visual_tools.h:91
rviz_visual_tools::RvizVisualTools::NAME
static const RVIZ_VISUAL_TOOLS_DECL std::string NAME
Definition: rviz_visual_tools.h:1101
rviz_visual_tools::RvizVisualTools::publishXZPlane
bool publishXZPlane(const Eigen::Isometry3d &pose, colors color=TRANSLUCENT, double scale=1.0)
Display the XY plane of a given pose.
Definition: rviz_visual_tools.cpp:1075
rviz_visual_tools::RvizVisualTools::publishPolygon
bool publishPolygon(const geometry_msgs::Polygon &polygon, colors color=RED, scales scale=MEDIUM, const std::string &ns="Polygon")
Display a marker of a polygon.
Definition: rviz_visual_tools.cpp:2153
rviz_visual_tools::RvizVisualTools::loadRvizMarkers
bool loadRvizMarkers()
Pre-load rviz markers for better efficiency.
Definition: rviz_visual_tools.cpp:131
rviz_visual_tools::GREEN
@ GREEN
Definition: rviz_visual_tools.h:99
rviz_visual_tools::RvizVisualTools::waitForMarkerPub
void waitForMarkerPub()
Optional blocking function to call after calling loadMarkerPub(). Allows you to do some intermediate ...
Definition: rviz_visual_tools.cpp:324
rviz_visual_tools::RvizVisualTools::publishYArrow
bool publishYArrow(const Eigen::Isometry3d &pose, colors color=GREEN, scales scale=MEDIUM, double length=0.0)
Display an arrow along the y-axis of a pose.
Definition: rviz_visual_tools.cpp:1300
rviz_visual_tools::RvizVisualTools::getGlobalScale
double getGlobalScale() const
Getter for the global scale used for changing size of all markers.
Definition: rviz_visual_tools.h:353
rviz_visual_tools::RvizVisualTools::markers_
visualization_msgs::MarkerArray markers_
Definition: rviz_visual_tools.h:1125
rviz_visual_tools::RvizVisualTools::publishText
bool publishText(const Eigen::Isometry3d &pose, const std::string &text, colors color=WHITE, scales scale=MEDIUM, bool static_id=true)
Display a marker of a text.
Definition: rviz_visual_tools.cpp:2516
rviz_visual_tools::RvizVisualTools::RvizVisualTools
RvizVisualTools(std::string base_frame, std::string marker_topic=RVIZ_MARKER_TOPIC, ros::NodeHandle nh=ros::NodeHandle("~"))
Constructor.
Definition: rviz_visual_tools.cpp:96
rviz_visual_tools::LARGE
@ LARGE
Definition: rviz_visual_tools.h:124
rviz_visual_tools::RandomPoseBounds::z_max_
double z_max_
Definition: rviz_visual_tools.h:145
rviz_visual_tools::RvizVisualTools::publishMarkers
bool publishMarkers(visualization_msgs::MarkerArray &markers)
Display an array of markers, allows reuse of the ROS publisher.
Definition: rviz_visual_tools.cpp:891
rviz_visual_tools::RvizVisualTools::iRand
static int iRand(int min, int max)
Definition: rviz_visual_tools.cpp:2846
rviz_visual_tools::RvizVisualTools::initialize
void initialize()
Shared function for initilization by constructors.
Definition: rviz_visual_tools.cpp:102
rviz_visual_tools::RvizVisualTools::setPsychedelicMode
void setPsychedelicMode(bool psychedelic_mode=true)
Setter for PsychedelicMode.
Definition: rviz_visual_tools.h:1082
rviz_visual_tools::RandomCuboidBounds
Bounds for generateRandomCuboid()
Definition: rviz_visual_tools.h:173
rviz_visual_tools::RvizVisualTools::triangle_marker_
visualization_msgs::Marker triangle_marker_
Definition: rviz_visual_tools.h:1139
rviz_visual_tools::RvizVisualTools::convertPoint32
static Eigen::Vector3d convertPoint32(const geometry_msgs::Point32 &point)
Convert a geometry_msg point to an Eigen point Note: Not thread safe but very convenient.
Definition: rviz_visual_tools.cpp:2637
rviz_visual_tools::MEDIUM
@ MEDIUM
Definition: rviz_visual_tools.h:123
rviz_visual_tools::RandomCuboidBounds::cuboid_size_max_
double cuboid_size_max_
Definition: rviz_visual_tools.h:175
rviz_visual_tools::RvizVisualTools::publishXYPlane
bool publishXYPlane(const Eigen::Isometry3d &pose, colors color=TRANSLUCENT, double scale=1.0)
Display the XY plane of a given pose.
Definition: rviz_visual_tools.cpp:1029
rviz_visual_tools::XLARGE
@ XLARGE
Definition: rviz_visual_tools.h:125
rviz_visual_tools::RvizVisualTools::publishSpheres
bool publishSpheres(const EigenSTL::vector_Vector3d &points, colors color=BLUE, scales scale=MEDIUM, const std::string &ns="Spheres")
Display a marker of a series of spheres.
Definition: rviz_visual_tools.cpp:2411
rviz_visual_tools::RvizVisualTools::publishAxisPath
bool publishAxisPath(const EigenSTL::vector_Isometry3d &path, scales scale=MEDIUM, const std::string &ns="Axis Path")
Display a series of red/green/blue coordinate axis along a path.
Definition: rviz_visual_tools.cpp:1528
rviz_visual_tools::RvizVisualTools::base_frame_
std::string base_frame_
Definition: rviz_visual_tools.h:1113
rviz_visual_tools::RVIZ_MARKER_TOPIC
static const std::string RVIZ_MARKER_TOPIC
Definition: rviz_visual_tools.h:86
rviz_visual_tools::RvizVisualTools::getRemoteControl
RemoteControlPtr & getRemoteControl()
Ability to load remote control on the fly.
Definition: rviz_visual_tools.cpp:2891
rviz_visual_tools::RvizVisualTools::intToRvizColor
static colors intToRvizColor(std::size_t color)
Used by interfaces that do not directly depend on Rviz Visual Tools, such as OMPL.
Definition: rviz_visual_tools.cpp:541
rviz_visual_tools::RvizVisualTools::resetMarkerCounts
void resetMarkerCounts()
Reset the id's of all published markers so that they overwrite themselves in the future NOTE you may ...
Definition: rviz_visual_tools.cpp:116
rviz_visual_tools::RvizVisualTools::block_marker_
visualization_msgs::Marker block_marker_
Definition: rviz_visual_tools.h:1130
rviz_visual_tools::RvizVisualTools::cylinder_marker_
visualization_msgs::Marker cylinder_marker_
Definition: rviz_visual_tools.h:1131
rviz_visual_tools::RvizVisualTools::publishMesh
bool publishMesh(const Eigen::Isometry3d &pose, const std::string &file_name, colors color=CLEAR, double scale=1, const std::string &ns="mesh", std::size_t id=0)
Display a mesh from file.
Definition: rviz_visual_tools.cpp:1622
rviz_visual_tools::RvizVisualTools::publishCuboid
bool publishCuboid(const Eigen::Vector3d &point1, const Eigen::Vector3d &point2, colors color=BLUE)
Display a rectangular cuboid.
Definition: rviz_visual_tools.cpp:1743
rviz_visual_tools::RvizVisualTools::createRandColor
std_msgs::ColorRGBA createRandColor() const
Create a random color that is not too light.
Definition: rviz_visual_tools.cpp:616
rviz_visual_tools::TRANSLUCENT_DARK
@ TRANSLUCENT_DARK
Definition: rviz_visual_tools.h:110
rviz_visual_tools::RAND
@ RAND
Definition: rviz_visual_tools.h:111
rviz_visual_tools::BLUE
@ BLUE
Definition: rviz_visual_tools.h:95
rviz_visual_tools::ORANGE
@ ORANGE
Definition: rviz_visual_tools.h:102
rviz_visual_tools::RvizVisualTools::generateRandomPose
static void generateRandomPose(geometry_msgs::Pose &pose, RandomPoseBounds pose_bounds=RandomPoseBounds())
Create a random pose within bounds of random_pose_bounds_.
Definition: rviz_visual_tools.cpp:2735
rviz_visual_tools::RandomPoseBounds::RandomPoseBounds
RandomPoseBounds(double x_min=0.0, double x_max=1.0, double y_min=0.0, double y_max=1.0, double z_min=0.0, double z_max=1.0, double elevation_min=0.0, double elevation_max=M_PI, double azimuth_min=0.0, double azimuth_max=2 *M_PI, double angle_min=0.0, double angle_max=2 *M_PI)
Definition: rviz_visual_tools.h:150
rviz_visual_tools::RvizVisualTools::publishABCDPlane
bool publishABCDPlane(const double A, const double B, const double C, const double D, colors color=TRANSLUCENT, double x_width=1.0, double y_width=1.0)
Display a plane. Vector (A, B, C) gives the normal to the plane. |D|/|(A,B,C)| gives the distance to ...
Definition: rviz_visual_tools.cpp:1005
rviz_visual_tools::BLACK
@ BLACK
Definition: rviz_visual_tools.h:93
rviz_visual_tools::SMALL
@ SMALL
Definition: rviz_visual_tools.h:122
remote_control.h
eigen_stl_vector_container.h
rviz_visual_tools::RandomPoseBounds::azimuth_min_
double azimuth_min_
Definition: rviz_visual_tools.h:147
rviz_visual_tools::RvizVisualTools::getScale
geometry_msgs::Vector3 getScale(scales scale, double marker_scale=1.0) const
Get the rviz marker scale of standard sizes.
Definition: rviz_visual_tools.cpp:697
rviz_visual_tools::RvizVisualTools::printTranslation
static void printTranslation(const Eigen::Vector3d &translation)
Display in the console the x,y,z values of a point.
Definition: rviz_visual_tools.cpp:2858
rviz_visual_tools::RvizVisualTools::publishGraph
bool publishGraph(const graph_msgs::GeometryGraph &graph, colors color, double radius)
Display a graph.
Definition: rviz_visual_tools.cpp:1711
rviz_visual_tools::RvizVisualTools::batch_publishing_enabled_
bool batch_publishing_enabled_
Definition: rviz_visual_tools.h:1119
ros::Duration
rviz_visual_tools::RandomPoseBounds
Bounds for generateRandomPose()
Definition: rviz_visual_tools.h:141
rviz_visual_tools::XXSMALL
@ XXSMALL
Definition: rviz_visual_tools.h:120
rviz_visual_tools::RvizVisualTools::publishWireframeCuboid
bool publishWireframeCuboid(const Eigen::Isometry3d &pose, double depth, double width, double height, colors color=BLUE, const std::string &ns="Wireframe Cuboid", std::size_t id=0)
Publish transformed wireframe cuboid. Useful eg to show an oriented bounding box.
Definition: rviz_visual_tools.cpp:2177
rviz_visual_tools::scales
scales
Definition: rviz_visual_tools.h:116
rviz_visual_tools::GREY
@ GREY
Definition: rviz_visual_tools.h:97
rviz_visual_tools::RandomPoseBounds::z_min_
double z_min_
Definition: rviz_visual_tools.h:145
rviz_visual_tools::DEFAULT
@ DEFAULT
Definition: rviz_visual_tools.h:113
rviz_visual_tools::RvizVisualTools::publishMarker
bool publishMarker(visualization_msgs::Marker &marker)
Display a visualization_msgs Marker of a custom type. Allows reuse of the ros publisher.
Definition: rviz_visual_tools.cpp:839
rviz_visual_tools::RandomPoseBounds::y_min_
double y_min_
Definition: rviz_visual_tools.h:144
rviz_visual_tools::RvizVisualTools::trigger
bool trigger()
Trigger the publish function to send out all collected markers.
Definition: rviz_visual_tools.cpp:873
rviz_visual_tools::LIME_GREEN
@ LIME_GREEN
Definition: rviz_visual_tools.h:100
rviz_visual_tools::RvizVisualTools::publishAxisLabeled
bool publishAxisLabeled(const Eigen::Isometry3d &pose, const std::string &label, scales scale=MEDIUM, colors color=WHITE)
Display a marker of a coordinate frame axis with a text label describing it.
Definition: rviz_visual_tools.cpp:1459
rviz_visual_tools::EulerConvention
EulerConvention
Definition: rviz_visual_tools.h:131
ros::NodeHandle
rviz_visual_tools::RvizVisualTools::reset_marker_
visualization_msgs::Marker reset_marker_
Definition: rviz_visual_tools.h:1138
rviz_visual_tools::RvizVisualTools::spheres_marker_
visualization_msgs::Marker spheres_marker_
Definition: rviz_visual_tools.h:1137
rviz_visual_tools::RvizVisualTools::line_list_marker_
visualization_msgs::Marker line_list_marker_
Definition: rviz_visual_tools.h:1136
rviz_visual_tools::XYZ
@ XYZ
Definition: rviz_visual_tools.h:133
rviz_visual_tools::RvizVisualTools::pub_rviz_markers_
ros::Publisher pub_rviz_markers_
Definition: rviz_visual_tools.h:1107
rviz_visual_tools::RandomPoseBounds::angle_min_
double angle_min_
Definition: rviz_visual_tools.h:148
rviz_visual_tools::RvizVisualTools::publishLines
bool publishLines(const EigenSTL::vector_Vector3d &aPoints, const EigenSTL::vector_Vector3d &bPoints, const std::vector< colors > &colors, scales scale=MEDIUM)
Display a marker of lines.
Definition: rviz_visual_tools.cpp:1922
rviz_visual_tools::RandomPoseBounds::x_min_
double x_min_
Definition: rviz_visual_tools.h:143


rviz_visual_tools
Author(s): Dave Coleman
autogenerated on Wed Mar 2 2022 01:03:26