[ WHITE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a23885a26fe14a38b7ec48819c423fd9a)
, [ ORANGE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a60f76eb6f93a22228056600742f90bd3)
, [ YELLOW
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3af826bd3f48da5cd6a14c4f8c4f42e697)
, [ BROWN
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a5ee5891a112827a51704db6c5a848f0d)
, [ PINK
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a351ea0a0eea9fa3afd387be179b9234b)
,


  text_marker_.header.stamp = ros::Time::now();
  text_marker_.header.frame_id = base_frame_;
  text_marker_.text = text;
  text_marker_.pose = pose;
  text_marker_.color = getColor(color);
  text_marker_.scale = scale;
  text_marker_.scale.x = 0;
  text_marker_.scale.y = 0;
  // Helper for publishing rviz markers
  publishMarker(text_marker_);


Parameters


  // Restore the ID count if needed
  if (static_id)
  {
    text_marker_.id = temp_id;
  }


##  ◆  global_scale_


bool rviz_visual_tools::RvizVisualTools::publishAxis  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  double  |  _length_ ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Axis" `
|  )  |  |

Definition at line [ 1433 ](rviz__visual__tools_8cpp_source.html#l01433) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Apply rotation to the geometry coordinates and normals.


bool RvizVisualTools::publishPolygon(const geometry_msgs::Polygon& polygon, colors color, scales scale,
                                     const std::string& ns)
{
  std::vector<geometry_msgs::Point> points;
  geometry_msgs::Point temp;
  geometry_msgs::Point first;  // remember first point because we will connect
                               // first and last points
                               // for last line
  for (std::size_t i = 0; i < polygon.points.size(); ++i)
  {
    temp.x = polygon.points[i].x;
    temp.y = polygon.points[i].y;
    temp.z = polygon.points[i].z;
    if (i == 0)
    {
      first = temp;
    }
    points.push_back(temp);
  }
  points.push_back(first);  // connect first and last points for last line


geometry_msgs::Point RvizVisualTools::convertPoint(const Eigen::Vector3d& point)
{
  geometry_msgs::Point point_msg;
  point_msg.x = point.x();
  point_msg.y = point.y();
  point_msg.z = point.z();
  return point_msg;
}


##  ◆  publishSpheres()  [6/7]


  // Create the cylinders
  for (std::size_t i = 1; i < path.size(); ++i)
  {
    publishCylinder(path[i - 1], path[i], colors[i], radius, ns);
  }


Returns


Asked: ** 2014-06-16 15:13:34 -0500  **


  line_list_marker_.points.push_back(convertPoint(p2));
  line_list_marker_.points.push_back(convertPoint(p3));
  line_list_marker_.colors.push_back(this_color);
  line_list_marker_.colors.push_back(this_color);


##  ◆  publishCylinder()  [3/6]


](../../../api/rosconsole_bridge/html/cleanup_8cpp.html#a0786995eefc76ce4716f6ed5f19c9786)
, const Eigen::Vector3d &b) const
|  Create a vector that points from point a to point b.  More...

void  |  [ loadMarkerPub
](classrviz__visual__tools_1_1RvizVisualTools.html#a40922a05c41f8ef17ceb017979d51462)
(bool wait_for_subscriber=false, bool latched=false)
|  Load publishers as needed.  More...

void  |  [ loadRemoteControl
](classrviz__visual__tools_1_1RvizVisualTools.html#accd339056b87c04d7ff61dac0da1e7ec)
()
|  Pre-load remote control.  More...

bool  |  [ loadRvizMarkers
](classrviz__visual__tools_1_1RvizVisualTools.html#ac648bcc42963d6ca9ee22fc06f498984)
()
|  Pre-load rviz markers for better efficiency.  More...

void  |  [ prompt
](classrviz__visual__tools_1_1RvizVisualTools.html#ae64f5929da4bac33407bed7d20709cbf)
(const std::string &msg)
|  Wait for user feedback i.e. through a button or joystick.  More...

bool  |  [ publishArrow
](classrviz__visual__tools_1_1RvizVisualTools.html#a34faa616e828ef3a03d68e9b7d5fe573)
(const Eigen::Isometry3d &pose, [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) color=
[ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
, [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) scale=
[ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
, double [ length
](../../../api/tf2/html/namespacetf2.html#ab20034dc53b40043a702876ff38c78a1)
=0.0, std::size_t id=0)
|  Display an arrow along the x-axis of a pose.  More...

bool  |  [ publishArrow


bool RvizVisualTools::publishPath(const EigenSTL::vector_Vector3d& path, const std::vector<std_msgs::ColorRGBA>& colors,
                                  double radius, const std::string& ns)
{
  if (path.size() < 2)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "Skipping path because " << path.size() << " points passed in.");
    return false;
  }


Definition at line [ 352 ](rviz__visual__tools_8h_source.html#l00352) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


##  ◆  getRandColor()


  if (pose_bounds.azimuth_min_ < 0)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "min azimuth bound < 0, setting equal to 0");
    pose_bounds.azimuth_min_ = 0;
  }


|  rviz_visual_tools::RvizVisualTools::RvizVisualTools  |  (  |  std::string
|  _base_frame_ ,
---|---|---|---
|  |  std::string  |  _marker_topic_ = ` [ RVIZ_MARKER_TOPIC
](namespacerviz__visual__tools.html#ae7916e71b4856fc29f96b07902e6910b) ` ,
|  |  [ ros::NodeHandle
](../../../api/roscpp/html/classros_1_1NodeHandle.html) |  _nh_ = ` [
ros::NodeHandle ](../../../api/roscpp/html/classros_1_1NodeHandle.html) ("~")
`
|  )  |  |
explicit

Constructor.


Definition at line [ 2172 ](rviz__visual__tools_8cpp_source.html#l02172) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Parameters


##  ◆  publishText()  [3/4]


  // Set alpha value
  result.a = alpha_;


bool rviz_visual_tools::RvizVisualTools::publishPath  |  (  |  const
std::vector< [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
> & |  _path_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ RED
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a269d2451e2a4b2d6744d2d958a8a8467)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  const std::string & |  _ns_ = ` "Path" `
|  )  |  |

Display a marker of a series of connected cylinders.


  // Set the mesh
  triangle_marker_.points.clear();
  for (const shape_msgs::MeshTriangle& triangle : mesh.triangles)
    for (const uint32_t& index : triangle.vertex_indices)
      triangle_marker_.points.push_back(mesh.vertices[index]);


Definition at line [ 365 ](rviz__visual__tools_8cpp_source.html#l00365) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  ◆  getColorScale()


bool rviz_visual_tools::RvizVisualTools::publishWireframeCuboid  |  (  |
const Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  double  |  _depth_ ,
|  |  double  |  _width_ ,
|  |  double  |  _height_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  const std::string & |  _ns_ = ` "Wireframe Cuboid" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Publish transformed wireframe cuboid. Useful eg to show an oriented bounding
box.


bool RvizVisualTools::publishYZPlane(const Eigen::Isometry3d& pose, colors color, double scale)
{
  return publishYZPlane(convertPose(pose), color, scale);
}


|  void rviz_visual_tools::RvizVisualTools::setMarkerTopic  |  (  |  const
std::string & |  _topic_ |  )  |
---|---|---|---|---|---
inline

Set marker array topic.


  return publishSpheres(points_msg, color, scale, ns);
}


##  ◆  publishArrow()  [3/4]


|  Eigen::Vector3d rviz_visual_tools::RvizVisualTools::convertPoint32  |  (  |
const geometry_msgs::Point32 & |  _point_ |  )  |
---|---|---|---|---|---
static

Convert a geometry_msg point to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) point Note: Not thread safe
but very convenient.


Last updated: **Jun 16 '14**


  p[1].x = 0;
  p[1].y = -1.0 * scale;
  p[1].z = 1.0 * scale;


     Pose  |  to fill in
---|---

Definition at line [ 2674 ](rviz__visual__tools_8cpp_source.html#l02674) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Default constructor


Returns


Definition at line [ 2613 ](rviz__visual__tools_8cpp_source.html#l02613) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


    // Sleep
    poll_rate.sleep();


#include <rviz_visual_tools/rviz_visual_tools.h>


  // override previous y & z scale specified
  // scale.x is the shaft diameter
  // scale.y is the head diameter
  // scale.z it specifies the head length.
  arrow_marker_.scale.y *= 2.0;
  arrow_marker_.scale.z *= 3.0;


[ tags ](/tags/) [ users ](/users/) [ badges ](/badges/)


    // Check again
    num_existing_subscribers = pub.getNumSubscribers();


bool RvizVisualTools::publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color,
                                  scales scale)
{
  return publishLine(convertPoint(point1), convertPoint(point2), color, scale);
}
bool RvizVisualTools::publishLine(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color,
                                  double radius)
{
  geometry_msgs::Vector3 scale;
  scale.x = radius * global_scale_;
  scale.y = radius * global_scale_;
  scale.z = radius * global_scale_;
  return publishLine(convertPoint(point1), convertPoint(point2), getColor(color), scale);
}


bool rviz_visual_tools::RvizVisualTools::publishAxisPath  |  (  |  const [
EigenSTL::vector_Isometry3d
](../../../api/eigen_stl_containers/html/namespaceEigenSTL.html#ac192baa0b919d541fcc5e78cfd3e4769)
& |  _path_ ,
---|---|---|---
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  const std::string & |  _ns_ = ` "Axis Path" `
|  )  |  |

Display a series of red/green/blue coordinate axis along a path.


|  int rviz_visual_tools::RvizVisualTools::iRand  |  (  |  int  |  _min_ ,
---|---|---|---
|  |  int  |  _max_
|  )  |  |
static

Definition at line [ 2731 ](rviz__visual__tools_8cpp_source.html#l02731) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Definition at line [ 2517 ](rviz__visual__tools_8cpp_source.html#l02517) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  ◆  publishSphere()  [8/11]


void RvizVisualTools::resetMarkerCounts()
{
  arrow_marker_.id++;
  sphere_marker_.id++;
  block_marker_.id++;
  cylinder_marker_.id++;
  mesh_marker_.id++;
  text_marker_.id++;
  cuboid_marker_.id++;
  line_strip_marker_.id++;
  line_list_marker_.id++;
  spheres_marker_.id++;
  triangle_marker_.id++;
}


[ Next  ](open3d.geometry.PointCloud.html "open3d.geometry.PointCloud") [
Previous ](open3d.geometry.OctreeNodeInfo.html
"open3d.geometry.OctreeNodeInfo")


bool rviz_visual_tools::RvizVisualTools::publishYArrow  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ GREEN
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a54300acbac130f358566327dd13a1fd2)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 `
|  )  |  |

Definition at line [ 1248 ](rviz__visual__tools_8cpp_source.html#l01248) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Definition at line [ 99 ](rviz__visual__tools_8cpp_source.html#l00099) of file
[ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  line_list_marker_.points.push_back(convertPoint(p5));
  line_list_marker_.points.push_back(convertPoint(p6));
  line_list_marker_.colors.push_back(this_color);
  line_list_marker_.colors.push_back(this_color);


bool rviz_visual_tools::RvizVisualTools::publishText  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  const std::string & |  _text_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  const geometry_msgs::Vector3  |  _scale_ ,
|  |  bool  |  _static_id_ = ` true `
|  )  |  |

Definition at line [ 2394 ](rviz__visual__tools_8cpp_source.html#l02394) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Returns


|  [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
rviz_visual_tools::RvizVisualTools::convertPoint  |  (  |  const
Eigen::Vector3d & |  _point_ |  )  |
---|---|---|---|---|---
static

Convert a [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) point to a
geometry_msg Point Note: Not thread safe but very convenient.


  p[3].x = 1.0 * scale;
  p[3].y = 0;
  p[3].z = -1.0 * scale;


` scale ` (  _self_ , _scale_ , _center=True_ )  Â¶


bool RvizVisualTools::publishCuboid(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2,
                                    colors color, const std::string& ns, std::size_t id)
{
  // Set the timestamp
  cuboid_marker_.header.stamp = ros::Time::now();
  cuboid_marker_.ns = ns;


Parameters


true if equal


|  bool rviz_visual_tools::RvizVisualTools::getPsychedelicMode  |  (  |  |  )
|  const
---|---|---|---|---
inline

Getter for PsychedelicMode.


  if (wait_for_subscriber)
  {
    waitForSubscriber(pub_rviz_markers_);
  }
}


  p1 = pose * p1;
  p2 = pose * p2;
  p3 = pose * p3;
  p4 = pose * p4;
  p5 = pose * p5;
  p6 = pose * p6;
  p7 = pose * p7;
  p8 = pose * p8;


  std_msgs::ColorRGBA result;
  result.r = slerp(start.r, end.r, 0.5, value);
  result.g = slerp(start.g, end.g, 0.5, value);
  result.b = slerp(start.b, end.b, 0.5, value);
  result.a = alpha_;


_class_ ` open3d.geometry. ` ` OrientedBoundingBox ` Â¶


geometry_msgs::Point RvizVisualTools::convertPoseToPoint(const Eigen::Isometry3d& pose)
{
  geometry_msgs::Pose pose_msg;
  tf2::convert(pose, pose_msg);
  return pose_msg.position;
}


geometry_msgs::Vector3 rviz_visual_tools::RvizVisualTools::getScale  |  (  |
[ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ ,
---|---|---|---
|  |  double  |  _marker_scale_ = ` 1.0 `
|  )  |  |  const

Get the rviz marker scale of standard sizes.


|  void rviz_visual_tools::RvizVisualTools::setGlobalScale  |  (  |  double  |
_global_scale_ |  )  |
---|---|---|---|---|---
inline

Setter for the global scale used for changing size of all markers.


bool rviz_visual_tools::RvizVisualTools::publishZArrow  |  (  |  const
geometry_msgs::PoseStamped & |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1283 ](rviz__visual__tools_8cpp_source.html#l01283) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  // Helper for publishing rviz markers
  return publishMarker(line_strip_marker_);
}


    case ZXZ:
      result = Eigen::Translation3d(tx, ty, tz) * Eigen::AngleAxisd(rz, Eigen::Vector3d::UnitZ()) *
               Eigen::AngleAxisd(rx, Eigen::Vector3d::UnitX()) * Eigen::AngleAxisd(rz, Eigen::Vector3d::UnitZ());
      break;


geometry_msgs::Pose RvizVisualTools::convertPose(const Eigen::Isometry3d& pose)
{
  geometry_msgs::Pose pose_msg;
  tf2::convert(pose, pose_msg);
  return pose_msg;
}


true on success


##  ◆  publishCylinder()  [4/6]


|  visualization_msgs::Marker rviz_visual_tools::RvizVisualTools::mesh_marker_
---
protected

Definition at line [ 1093 ](rviz__visual__tools_8h_source.html#l01093) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


  triangle_marker_.color = getColor(color);
  triangle_marker_.pose = pose;


     path  |  \- a series of points to connect with cylinders
---|---
colors  |  \- a series of colors
radius  |  \- the radius of the cylinders
ns  |  \- namespace of marker

Returns


Parameters


` #include < [ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) > `


##  ◆  publishSphere()  [4/11]


bool rviz_visual_tools::RvizVisualTools::publishPath  |  (  |  const [
EigenSTL::vector_Vector3d
](../../../api/eigen_stl_containers/html/namespaceEigenSTL.html#a79212253ac3459b428e7d37d1601a7d2)
& |  _path_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ ,
|  |  const std::string & |  _ns_ = ` "Path" `
|  )  |  |

Definition at line [ 1922 ](rviz__visual__tools_8cpp_source.html#l01922) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Definition at line [ 712 ](rviz__visual__tools_8cpp_source.html#l00712) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


](https://camo.githubusercontent.com/62176a685c40980602f2dfd8f0156f913b525c3564d8e11ef415621eadd9e8d4/68747470733a2f2f7069636b6e696b2e61692f6173736574732f696d616765732f6c6f676f2e6a7067)
This open source project was developed at [ PickNik Robotics
](https://picknik.ai/) . Need professional ROS development and consulting?
Contact us at [ projects@picknik.ai ](mailto:projects@picknik.ai) for a free
consultation.
##  Status:
###  ROS:
  * [ ![Build Status](https://camo.githubusercontent.com/bc304cc69835b78b8af242c7f7d7c119e1fb370237fa15d3c0f64d542c8ddeac/68747470733a2f2f7472617669732d63692e6f72672f726f732d706c616e6e696e672f6d6f766569745f76697375616c5f746f6f6c732e737667) ](https://travis-ci.org/ros-planning/moveit_visual_tools) Travis CI
  * [ ![Build Status](https://camo.githubusercontent.com/35d8333602451b10469054c27566bd6f80af3f0323da67913664f693965386bb/687474703a2f2f6275696c642e726f732e6f72672f6275696c645374617475732f69636f6e3f6a6f623d4b62696e5f755836345f5f6d6f766569745f76697375616c5f746f6f6c735f5f7562756e74755f78656e69616c5f616d6436345f5f62696e617279) ](http://build.ros.org/view/Kbin_uX64/job/Kbin_uX64__moveit_visual_tools__ubuntu_xenial_amd64__binary/) ROS Buildfarm - AMD64 Xenial Debian Build - Ubuntu 16.04 LTS
  * [ ![Build Status](https://camo.githubusercontent.com/d30e2f8af858399456cf73402d416e25feb3332a280b18a104269addb3b5a1c1/687474703a2f2f6275696c642e726f732e6f72672f6275696c645374617475732f69636f6e3f6a6f623d4b6465765f5f6d6f766569745f76697375616c5f746f6f6c735f5f7562756e74755f78656e69616c5f616d643634) ](http://build.ros.org/view/Kdev/job/Kdev__moveit_visual_tools__ubuntu_xenial_amd64/) ROS Buildfarm - AMD64 Xenial Devel Build - Ubuntu 16.04 LTS
  * [ ![Build Status](https://camo.githubusercontent.com/d00fc154c9dbb94352f92094d50178ee03eaf1a0c8f560f989ea849a8b10c39f/687474703a2f2f6275696c642e726f732e6f72672f6275696c645374617475732f69636f6e3f6a6f623d4d7372635f75425f5f6d6f766569745f76697375616c5f746f6f6c735f5f7562756e74755f62696f6e69635f5f736f75726365) ](http://build.ros.org/job/Msrc_uB__moveit_visual_tools__ubuntu_bionic__source/) ROS Buildfarm - AMD64 Bionic Source Build - Ubuntu 18.04 LTS
  * [ ![Build Status](https://camo.githubusercontent.com/b0ef2d852ae018b803f803a8bc61f3940c1896f86bca48a44df15002aa72d6e2/687474703a2f2f6275696c642e726f732e6f72672f6275696c645374617475732f69636f6e3f6a6f623d4d6465765f5f6d6f766569745f76697375616c5f746f6f6c735f5f7562756e74755f62696f6e69635f616d643634) ](http://build.ros.org/job/Mdev__moveit_visual_tools__ubuntu_bionic_amd64/) ROS Buildfarm - AMD64 Bionic Devel Build - Ubuntu 18.04 LTS
###  ROS2:
  * [ ![Build and Test](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/build_and_test.yaml/badge.svg?branch=ros2) ](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/build_and_test.yaml?query=branch%3Aros2) Github Actions - AMD64 Focal Source Build - Ubuntu 20.04 LTS
  * [ ![Formatting\(pre-commit\)](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/format.yaml/badge.svg?branch=ros2) ](https://github.com/ros-planning/moveit_visual_tools/actions/workflows/format.yaml?query=branch%3Aros2) Formatting(pre-commit)
[ ![](/ros-planning/moveit_visual_tools/raw/ros2/resources/screenshot.png)
](/ros-planning/moveit_visual_tools/blob/ros2/resources/screenshot.png)
[ ![](/ros-planning/moveit_visual_tools/raw/ros2/resources/demo.png) ](/ros-
planning/moveit_visual_tools/blob/ros2/resources/demo.png)
##  ROS2 Install
###  Install From Source
Install moveit2 following the instructions [ here
](https://moveit.ros.org/install-moveit2/source/) . After sourcing the moveit
workspace clone this repository into a colcon workspace, import and install
dependencies and build:

    source ~/ws_moveit/install/setup.bash
    cd $COLCON_WS/src
    git clone -b ros2 https://github.com/ros-planning/moveit_visual_tools
    vcs import < moveit_visual_tools/moveit_visual_tools.repos
    rosdep install -r --from-paths . --ignore-src --rosdistro foxy -y
    cd $COLCON_WS
    colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release

##  Quick Start Demo
To run some demos displaying robot states and collision objects:

    ros2 launch moveit_visual_tools demo_rviz.launch.py


  // Convert path coordinates
  for (std::size_t i = 0; i < points.size(); ++i)
  {
    spheres_marker_.colors.push_back(this_color);
  }


Definition at line [ 1106 ](rviz__visual__tools_8h_source.html#l01106) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


float RvizVisualTools::fRand(float min, float max)
{
  return std::uniform_real_distribution<float>(min, max)(mt_random_engine_);
}


* [ collision_map_out ](/questions/scope:all/sort:activity-desc/tags:collision_map_out/page:1/)


bool rviz_visual_tools::RvizVisualTools::publishAxis  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  double  |  _length_ ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Axis" `
|  )  |  |

Definition at line [ 1438 ](rviz__visual__tools_8cpp_source.html#l01438) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  Stats


void RvizVisualTools::printTransformRPY(const Eigen::Isometry3d& transform)
{
  // R-P-Y / X-Y-Z / 0-1-2 Euler Angle Standard
  Eigen::Vector3d vec = transform.rotation().eulerAngles(0, 1, 2);
  std::cout << "transform: [" << transform.translation().x() << ", " << transform.translation().y() << ", "
            << transform.translation().z() << ", " << vec[0] << ", " << vec[1] << ", " << vec[2] << "]\n";
}


##  ◆  publishLine()  [2/8]


##  ◆  publishSpheres()  [7/7]


  triangle_marker_.points.push_back(p[2]);
  triangle_marker_.points.push_back(p[3]);
  triangle_marker_.points.push_back(p[0]);


  // TODO(davetcoleman): handle the error case when a & b are the same point.
  // currently it returns nan for the quaternion


  // Convert pose to be normal to cylindar axis
  Eigen::Isometry3d rotation;
  rotation = Eigen::AngleAxisd(0.5 * M_PI, Eigen::Vector3d::UnitY());
  pose = pose * rotation;


Parameters


bool RvizVisualTools::publishLine(const geometry_msgs::Point& point1, const geometry_msgs::Point& point2,
                                  const std_msgs::ColorRGBA& color, scales scale)
{
  return publishLine(point1, point2, color, getScale(scale));
}


bool RvizVisualTools::publishMesh(const geometry_msgs::Pose& pose, const shape_msgs::Mesh& mesh, colors color,
                                  double scale, const std::string& ns, std::size_t id)
{
  triangle_marker_.header.stamp = ros::Time::now();


Definition at line [ 2351 ](rviz__visual__tools_8cpp_source.html#l02351) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishXArrow  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ RED
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a269d2451e2a4b2d6744d2d958a8a8467)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 `
|  )  |  |

Display an arrow along the x-axis of a pose.


// Load sphers ----------------------------------------------------


     pose  |  \- the position of the plane
---|---
color  |  \- the color of the plane
scale  |  \- the size of the vizualized plane

Returns


Versions


true on success


##  ◆  getScale()


     path  |  \- a series of points to connect with cylinders
---|---
color  |  \- an enum pre-defined name of a color
scale  |  \- an enum pre-defined name of a size
ns  |  \- namespace of marker

Returns


  // Helper for publishing rviz markers
  return publishMarker(triangle_marker_);
}


##  ◆  setBaseFrame()


##  ◆  iRand()


bool RvizVisualTools::publishSphere(const geometry_msgs::Pose& pose, const std_msgs::ColorRGBA& color,
                                    const geometry_msgs::Vector3 scale, const std::string& ns, std::size_t id)
{
  // Set the frame ID and timestamp
  sphere_marker_.header.stamp = ros::Time::now();


` PointCloud ` _= Type.PointCloud_ Â¶


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::arrow_marker_
---
protected

Definition at line [ 1089 ](rviz__visual__tools_8h_source.html#l01089) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


Definition at line [ 1227 ](rviz__visual__tools_8cpp_source.html#l01227) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


void rviz_visual_tools::RvizVisualTools::waitForMarkerPub  |  (  |  double  |
_wait_time_ |  )  |
---|---|---|---|---|---

Definition at line [ 294 ](rviz__visual__tools_8cpp_source.html#l00294) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  triangle_marker_.scale.x = 1.0;
  triangle_marker_.scale.y = 1.0;
  triangle_marker_.scale.z = 1.0;


##  ◆  sphere_marker_


  switch (color)
  {
    case RED:
      result.r = 0.8;
      result.g = 0.1;
      result.b = 0.1;
      result.a = alpha_;
      break;
    case GREEN:
      result.r = 0.1;
      result.g = 0.8;
      result.b = 0.1;
      result.a = alpha_;
      break;
    case GREY:
      result.r = 0.9;
      result.g = 0.9;
      result.b = 0.9;
      result.a = alpha_;
      break;
    case DARK_GREY:
      result.r = 0.6;
      result.g = 0.6;
      result.b = 0.6;
      result.a = alpha_;
      break;
    case WHITE:
      result.r = 1.0;
      result.g = 1.0;
      result.b = 1.0;
      result.a = alpha_;
      break;
    case ORANGE:
      result.r = 1.0;
      result.g = 0.5;
      result.b = 0.0;
      result.a = alpha_;
      break;
    case TRANSLUCENT_LIGHT:
      result.r = 0.1;


Eigen::Vector3d rviz_visual_tools::RvizVisualTools::getCenterPoint  |  (  |
const Eigen::Vector3d & |  _a_ ,
---|---|---|---
|  |  const Eigen::Vector3d & |  _b_
|  )  |  |  const

Find the center between to points.


bool rviz_visual_tools::RvizVisualTools::publishXArrow  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ RED
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a269d2451e2a4b2d6744d2d958a8a8467)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 `
|  )  |  |

Definition at line [ 1232 ](rviz__visual__tools_8cpp_source.html#l01232) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


void RvizVisualTools::initialize()
{
  marker_lifetime_ = ros::Duration(0.0);  // 0 - unlimited


##  ◆  publishXArrow()  [3/3]


  arrow_marker_.pose = pose.pose;
  arrow_marker_.color = getColor(color);
  arrow_marker_.scale = getScale(scale);


add a comment


bool RvizVisualTools::deleteAllMarkers()
{
  // Helper for publishing rviz markers
  return publishMarker(reset_marker_);
}


bool RvizVisualTools::publishSpheres(const std::vector<geometry_msgs::Point>& points, colors color, double scale,
                                     const std::string& ns)
{
  geometry_msgs::Vector3 scale_vector;
  scale_vector.x = scale * global_scale_;
  scale_vector.y = scale * global_scale_;
  scale_vector.z = scale * global_scale_;
  return publishSpheres(points, color, scale_vector, ns);
}


  for (auto& marker : markers.markers)
  {
    double norm = 0;
    norm += marker.pose.orientation.w * marker.pose.orientation.w;
    norm += marker.pose.orientation.x * marker.pose.orientation.x;
    norm += marker.pose.orientation.y * marker.pose.orientation.y;
    norm += marker.pose.orientation.z * marker.pose.orientation.z;
    norm = std::sqrt(norm);
    if (norm < std::numeric_limits<double>::epsilon())
    {
      marker.pose.orientation.w = 1;
      marker.pose.orientation.x = 0;
      marker.pose.orientation.y = 0;
      marker.pose.orientation.z = 0;
    }
    else
    {
      marker.pose.orientation.w = marker.pose.orientation.w / norm;
      marker.pose.orientation.x = marker.pose.orientation.x / norm;
      marker.pose.orientation.y = marker.pose.orientation.y / norm;
      marker.pose.orientation.z = marker.pose.orientation.z / norm;
    }
  }
  // Publish
  pub_rviz_markers_.publish(markers);
  return true;
}


[ problem publishing octomap msg from an octomap file
](/question/249551/problem-publishing-octomap-msg-from-an-octomap-file/)


true on success


##  ◆  triggerEvery()


  for (const auto& point : points)
  {
    points_msg.push_back(convertPoint(point));
  }


  line_list_marker_.points.push_back(convertPoint(p4));
  line_list_marker_.points.push_back(convertPoint(p1));
  line_list_marker_.colors.push_back(this_color);
  line_list_marker_.colors.push_back(this_color);


|  [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
rviz_visual_tools::RvizVisualTools::convertPose  |  (  |  const
Eigen::Isometry3d & |  _pose_ |  )  |
---|---|---|---|---|---
static

Convert an [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) pose to a
geometry_msg pose.


Clear all elements in the geometry.


  line_strip_marker_.header.stamp = ros::Time();
  line_strip_marker_.ns = ns;


  // Transform to pose
  p1 = pose * p1_in;
  p2 = pose * p2_in;
  p3 = pose * p3_in;
  p4 = pose * p4_in;


Note


Definition at line [ 2032 ](rviz__visual__tools_8cpp_source.html#l02032) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Eigen::Vector3d RvizVisualTools::convertPoint32(const geometry_msgs::Point32& point)
{
  Eigen::Vector3d point_eigen;
  point_eigen[0] = point.x;
  point_eigen[1] = point.y;
  point_eigen[2] = point.z;
  return point_eigen;
}


  * [ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html)
  * [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html)


bool RvizVisualTools::publishXArrow(const geometry_msgs::PoseStamped& pose, colors color, scales scale, double length)
{
  return publishArrow(pose, color, scale, length);
}


Parameters


void rviz_visual_tools::RvizVisualTools::loadMarkerPub  |  (  |  bool  |
_wait_for_subscriber_ = ` false ` ,
---|---|---|---
|  |  bool  |  _latched_ = ` false `
|  )  |  |

Load publishers as needed.


* **relative** ( _bool_ _,_ _optional_ _,_ _default=True_ ) â If true, the translation vector is directly added to the geometry coordinates. Otherwise, the center is moved to the translation vector.


     base_frame  |  \- common base for all visualization markers, usually "/world" or "/odom"
---|---
marker_topic  |  \- rostopic to publish markers to - your Rviz display should
match
nh  |  \- optional ros node handle - defaults to "~"

Definition at line [ 64 ](rviz__visual__tools_8cpp_source.html#l00064) of file
[ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


     input  |  [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) pose
---|---
output  |  vector of size 6 in order xyz rpy

Definition at line [ 2586 ](rviz__visual__tools_8cpp_source.html#l02586) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


namespace rviz_visual_tools
{
const std::string LOGNAME = "visual_tools";


geometry_msgs::Point RvizVisualTools::convertPoint(const geometry_msgs::Vector3& point)
{
  geometry_msgs::Point point_msg;
  point_msg.x = point.x;
  point_msg.y = point.y;
  point_msg.z = point.z;
  return point_msg;
}


  // Solution pose
  Eigen::Isometry3d result_pose = Eigen::Isometry3d::Identity();


##  ◆  enableBatchPublishing()


    {
      CBoxes, CPoints, CCount,
    };
    }
    typedef collision_render_ops::CollisionRenderOp CollisionRenderOp;

    /**
     * \class CollisionMapDisplay
     * \brief Displays a collision_map::CollisionMap message
     */
    class CollisionMapDisplay : public rviz::Display
    {
      //Q_OBJECT
    public:
      CollisionMapDisplay();

      virtual ~CollisionMapDisplay();

      virtual void onInitialize();

      void changedTopic();

      void changedColor();
      void changedOverrideColor();

      void changedRenderOperation();
      void changedPointSize();
      void changedAlpha();

      virtual void update(float wall_dt, float ros_dt);
      virtual void reset();

    protected:
      void subscribe();
      void unsubscribe();
      void clear();
      void incomingMessage(const arm_navigation_msgs::CollisionMap::ConstPtr& message);
      void processMessage(const arm_navigation_msgs::CollisionMap::ConstPtr& message);


|  void rviz_visual_tools::RvizVisualTools::setPsychedelicMode  |  (  |  bool
|  _psychedelic_mode_ = ` true ` |  )  |
---|---|---|---|---|---
inline

Setter for PsychedelicMode.


  // Add each point pair to the line message
  line_list_marker_.points.clear();
  line_list_marker_.colors.clear();
  for (std::size_t i = 0; i < aPoints.size(); ++i)
  {
    line_list_marker_.points.push_back(aPoints[i]);
    line_list_marker_.points.push_back(bPoints[i]);
    line_list_marker_.colors.push_back(colors[i]);
    line_list_marker_.colors.push_back(colors[i]);
  }


##  ◆  pub_rviz_markers_connected_


##  ◆  waitForMarkerPub()  [2/2]


cuboid_marker_.color = getColor(color);


bool RvizVisualTools::publishCylinder(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color,
                                      scales scale, const std::string& ns)
{
  double radius = getScale(scale).x;
  return publishCylinder(point1, point2, getColor(color), radius, ns);
}


##  ◆  publishLine()  [7/8]


  // Setup marker
  line_list_marker_.header.stamp = ros::Time();
  line_list_marker_.ns = "Wireframe Rectangle";


Parameters


  line_list_marker_.points.push_back(convertPoint(p1));
  line_list_marker_.points.push_back(convertPoint(p4));
  line_list_marker_.colors.push_back(this_color);
  line_list_marker_.colors.push_back(this_color);


  * publishAnimatedGrasps
  * publishIKSolutions
##  Show parts of a robot
These functions are a little more complicated
  * publishEEMarkers
##  Parent Class
This class is built on top of [ rviz_visual_tools
](https://github.com/PickNikRobotics/rviz_visual_tools) so all features and
documentation for that package apply here as well.
##  Developers Notes
Useful notes for anyone wanting to dig in deeper:
  * All poses are published with respect to the world frame e.g. /world, /odom, or maybe /base
  * All publish() ROS topics should be followed by a ` rclcpp::spin_some(node); ` but no sleep
  * Do not want to load any features/publishers until they are actually needed since this library contains so many components
##  Linting (pre-commit)
pre-commit is a tool that is used in moveit2_tutorials to check and apply
style guidelines automatically. To install pre-commit into your system:

    pip3 install pre-commit

Then under moveit2_tutorials directory install the git hooks like this:

    cd $COLCON_WS/src/moveit2_tutorials && pre-commit install

With this pre-commit will automatically run and check a list of styling
including clang-format, end of files and trailing whitespaces whenever you run
` git commit ` . To run pre-commit any time other than ` git commit ` :

    cd $COLCON_WS/src/moveit2_tutorials && pre-commit run -a

##  Contribute
Please send PRs for new helper functions, fixes, etc!
##  About
Helper functions for displaying and debugging MoveIt! data in Rviz via
published markers
###  Resources
Readme


` rotate ` (  _self_ , _rotation_ , _center=True_ , _type=RotationType.XYZ_ )
Â¶


  // Helper for publishing rviz markers
  publishMarker(arrow_marker_);


##  ◆  marker_lifetime_


##  ◆  publishYZPlane()  [2/2]


##  ◆  publishYArrow()  [2/3]


However, when I add the Display CollisionMap to RViz, I get the following
error msg:


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::cuboid_marker_
---
protected

Definition at line [ 1095 ](rviz__visual__tools_8h_source.html#l01095) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


  line_list_marker_.header.frame_id = base_frame_;
  // Set the namespace and id for this marker.  This serves to create a unique
  // ID
  line_list_marker_.ns = "Line_List";
  // Set the marker type.
  line_list_marker_.type = visualization_msgs::Marker::LINE_LIST;
  // Set the marker action.  Options are ADD and DELETE
  line_list_marker_.action = visualization_msgs::Marker::ADD;
  // Lifetime
  line_list_marker_.lifetime = marker_lifetime_;
  // Constants
  line_list_marker_.pose = getIdentityPose();


true on success


Definition at line [ 1109 ](rviz__visual__tools_8cpp_source.html#l01109) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  ◆  markers_


|  [ ros::Publisher ](../../../api/roscpp/html/classros_1_1Publisher.html)
rviz_visual_tools::RvizVisualTools::pub_rviz_markers_
---
protected

Definition at line [ 1068 ](rviz__visual__tools_8h_source.html#l01068) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


  p[3].x = 0;
  p[3].y = 1.0 * scale;
  p[3].z = -1.0 * scale;


` RGBDImage ` _= Type.RGBDImage_ Â¶


bool rviz_visual_tools::RvizVisualTools::publishCone  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  double  |  _angle_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ TRANSLUCENT
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3ada8357de2c7d31bdc0a27e7814e0ac85)
` ,
|  |  double  |  _scale_ = ` 1.0 `
|  )  |  |

Definition at line [ 930 ](rviz__visual__tools_8cpp_source.html#l00930) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


|  Eigen::Isometry3d rviz_visual_tools::RvizVisualTools::convertFromXYZRPY  |
(  |  double  |  _tx_ ,
---|---|---|---
|  |  double  |  _ty_ ,
|  |  double  |  _tz_ ,
|  |  double  |  _rx_ ,
|  |  double  |  _ry_ ,
|  |  double  |  _rz_ ,
|  |  [ EulerConvention
](namespacerviz__visual__tools.html#a25a0ae702485241183604425b99eb8c6) |
_convention_
|  )  |  |
static

Converts scalar translations and rotations to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) Frame. This is achieved by
chaining a translation with individual euler rotations in ZYX order (this is
equivalent to fixed rotatins XYZ) [
http://en.wikipedia.org/wiki/Euler_angles#Conversion_between_intrinsic_and_extrinsic_rotations
](http://en.wikipedia.org/wiki/Euler_angles#Conversion_between_intrinsic_and_extrinsic_rotations)
Euler conversion code sourced from Descartes, Copyright (c) 2014, Southwest
Research Institute.


  // Calculate scale
  cuboid_marker_.scale.x = fabs(point1.x - point2.x);
  cuboid_marker_.scale.y = fabs(point1.y - point2.y);
  cuboid_marker_.scale.z = fabs(point1.z - point2.z);


|  bool rviz_visual_tools::RvizVisualTools::pub_rviz_markers_waited_ = false
---
protected

Definition at line [ 1070 ](rviz__visual__tools_8h_source.html#l01070) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


     pose  |  \- pose of the box
---|---
depth  |  \- depth of the box
width  |  \- width of the box
height  |  \- height of the box
color  |  \- an enum pre-defined name of a color

Returns


  line_list_marker_.points.push_back(convertPoint(p2));
  line_list_marker_.points.push_back(convertPoint(p3));
  line_list_marker_.colors.push_back(this_color);
  line_list_marker_.colors.push_back(this_color);


##  ◆  publishSpheres()  [2/7]


bool RvizVisualTools::publishCylinder(const geometry_msgs::Pose& pose, const std_msgs::ColorRGBA& color, double height,
                                      double radius, const std::string& ns)
{
  // Set the timestamp
  cylinder_marker_.header.stamp = ros::Time::now();
  cylinder_marker_.ns = ns;
  cylinder_marker_.id++;


Returns


  // How often to check for subscribers
  ros::Rate poll_rate(200);


  return true;
}


##  ◆  convertPoseToPoint()


Parameters


##  ◆  publishWireframeCuboid()  [1/2]


Seen: **265 times**


##  ◆  setAlpha()


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::line_list_marker_
---
protected

Definition at line [ 1097 ](rviz__visual__tools_8h_source.html#l01097) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishWireframeRectangle  |  (  |
const Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  const Eigen::Vector3d & |  _p1_in_ ,
|  |  const Eigen::Vector3d & |  _p2_in_ ,
|  |  const Eigen::Vector3d & |  _p3_in_ ,
|  |  const Eigen::Vector3d & |  _p4_in_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_
|  )  |  |

Definition at line [ 2230 ](rviz__visual__tools_8cpp_source.html#l02230) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishYZPlane  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ TRANSLUCENT
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3ada8357de2c7d31bdc0a27e7814e0ac85)
` ,
|  |  double  |  _scale_ = ` 1.0 `
|  )  |  |

Definition at line [ 1068 ](rviz__visual__tools_8cpp_source.html#l01068) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


|  const std::string rviz_visual_tools::RvizVisualTools::name_ =
"visual_tools"
---
static  protected

Definition at line [ 1062 ](rviz__visual__tools_8h_source.html#l01062) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


true on success


##  ◆  publishSphere()  [1/11]


  spheres_marker_.scale = scale;
  spheres_marker_.points = points;  // straight copy
  spheres_marker_.colors = colors;  // straight copy


|  std::string rviz_visual_tools::RvizVisualTools::marker_topic_
---
protected

Definition at line [ 1073 ](rviz__visual__tools_8h_source.html#l01073) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


bool RvizVisualTools::publishPath(const std::vector<geometry_msgs::Point>& path, colors color, double radius,
                                  const std::string& ns)
{
  if (path.size() < 2)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "Skipping path because " << path.size() << " points passed in.");
    return false;
  }


` TriangleMesh ` _= Type.TriangleMesh_ Â¶


void RvizVisualTools::loadRemoteControl()
{
  // Load remote
  if (!remote_control_)
  {
    remote_control_ = std::make_shared<RemoteControl>(nh_);
    ros::spinOnce();
  }
}


bool rviz_visual_tools::RvizVisualTools::publishAxisLabeled  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  const std::string & |  _label_ ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ WHITE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a23885a26fe14a38b7ec48819c423fd9a)
`
|  )  |  |

Display a marker of a coordinate frame axis with a text label describing it.


bool RvizVisualTools::publishZArrow(const geometry_msgs::PoseStamped& pose, colors color, scales scale, double length,
                                    std::size_t id)
{
  Eigen::Isometry3d arrow_pose = convertPose(pose.pose) * Eigen::AngleAxisd(-M_PI / 2, Eigen::Vector3d::UnitY());
  geometry_msgs::PoseStamped new_pose = pose;
  new_pose.pose = convertPose(arrow_pose);
  return publishArrow(new_pose, color, scale, length, id);
}


Definition at line [ 971 ](rviz__visual__tools_8cpp_source.html#l00971) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


     pose  |  \- the location to publish the marker with respect to the base frame
---|---
file  |  name of mesh, starting with "file://" e.g.
"file:///home/user/mesh.stl"
color  |  \- an enum pre-defined name of a color
scale  |  \- an enum pre-defined name of a size
ns  |  \- namespace of marker
id  |  \- unique counter of mesh that allows you to overwrite a previous mesh.
if 0, defaults to incremental counter

Returns


` is_empty ` (  _self_ )  Â¶


bool RvizVisualTools::publishPath(const EigenSTL::vector_Isometry3d& path, colors color, double radius,
                                  const std::string& ns)
{
  if (path.size() < 2)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "Skipping path because " << path.size() << " points passed in.");
    return false;
  }


     pose  |  \- the location to publish the marker with respect to the base frame
---|---
text  |  \- what message to display
color  |  \- an enum pre-defined name of a color
scale  |  \- an enum pre-defined name of a size
static_id  |  \- if true, only one text can be published at a time

Returns


Python API


* [ mapping_rviz_plugin ](/questions/scope:all/sort:activity-desc/tags:mapping_rviz_plugin/page:1/)


Follow


##  ◆  publishAxisLabeled()  [1/2]


|  bool rviz_visual_tools::RvizVisualTools::batch_publishing_enabled_ = true
---
protected

Definition at line [ 1080 ](rviz__visual__tools_8h_source.html#l01080) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishSphere  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  double  |  _scale_ ,
|  |  const std::string & |  _ns_ = ` "Sphere" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1145 ](rviz__visual__tools_8cpp_source.html#l01145) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


|  Eigen::Isometry3d rviz_visual_tools::RvizVisualTools::convertPoint32ToPose
|  (  |  const geometry_msgs::Point32 & |  _point_ |  )  |
---|---|---|---|---|---
static

Convert a geometry_msg point (32bit) to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) pose Note: Not thread safe
but very convenient.


##  Detailed Description


  // Rotate so that vector points along line
  result_pose = q * Eigen::AngleAxisd(-0.5 * M_PI, Eigen::Vector3d::UnitY());
  result_pose.translation() = a;


        publishCylinder(a, b, color, radius);
      }
    }
  }


##  ◆  publishLine()  [3/8]


_class_ ` Type ` Â¶


// Load cuboid ----------------------------------------------------


` volume ` (  _self_ )  Â¶


##  ◆  publishCone()  [1/2]


Returns


##  ◆  prompt()


  return true;
}


  // Change all markers to be inverted in color
  if (psychedelic_mode_)
  {
    for (auto& marker : markers.markers)
    {
      marker.color.r = 1.0 - marker.color.r;
      marker.color.g = 1.0 - marker.color.g;
      marker.color.b = 1.0 - marker.color.b;
      for (auto& color : marker.colors)
      {
        color.r = 1.0 - color.r;
        color.g = 1.0 - color.g;
        color.b = 1.0 - color.b;
      }
    }
  }


bool rviz_visual_tools::RvizVisualTools::publishText  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  const std::string & |  _text_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ WHITE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a23885a26fe14a38b7ec48819c423fd9a)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  bool  |  _static_id_ = ` true `
|  )  |  |

Definition at line [ 2400 ](rviz__visual__tools_8cpp_source.html#l02400) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool RvizVisualTools::posesEqual(const Eigen::Isometry3d& pose1, const Eigen::Isometry3d& pose2, double threshold)
{
  static const std::size_t NUM_VARS = 16;  // size of eigen matrix


bool RvizVisualTools::publishXYPlane(const Eigen::Isometry3d& pose, colors color, double scale)
{
  return publishXYPlane(convertPose(pose), color, scale);
}


bool rviz_visual_tools::RvizVisualTools::publishSphere  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  const std_msgs::ColorRGBA & |  _color_ ,
|  |  const geometry_msgs::Vector3  |  _scale_ ,
|  |  const std::string & |  _ns_ = ` "Sphere" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1175 ](rviz__visual__tools_8cpp_source.html#l01175) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Parameters


bool rviz_visual_tools::RvizVisualTools::publishSpheres  |  (  |  const
std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _points_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  double  |  _scale_ = ` 0.1 ` ,
|  |  const std::string & |  _ns_ = ` "Spheres" `
|  )  |  |

Definition at line [ 2309 ](rviz__visual__tools_8cpp_source.html#l02309) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  // Helper for publishing rviz markers
  return publishMarker(spheres_marker_);
}


I am trying to display /collision_map_out topic. In RViz, I do have
mapping_rviz_plugin installed and working. I have taken a look at the source
code, as well as updated ` init.cpp ` to contain ` PLUGINLIB_EXPORT_CLASS `
instead of ` PLUGINLIB_DEPEND_CLASS ` .


true on success


##  ◆  convertPointToPose()  [1/2]


[ octomap_server performance issues? ](/question/52127/octomap_server-
performance-issues/)


bool rviz_visual_tools::RvizVisualTools::publishCuboid  |  (  |  const
Eigen::Vector3d & |  _point1_ ,
---|---|---|---
|  |  const Eigen::Vector3d & |  _point2_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
`
|  )  |  |

Display a rectangular cuboid.


Please note: ROS Answers requires javascript to work properly, please enable
javascript in your browser, [ here is how
](https://www.google.com/support/bin/answer.py?answer=23852)


bool RvizVisualTools::publishZArrow(const Eigen::Isometry3d& pose, colors color, scales scale, double length,
                                    std::size_t id)
{
  Eigen::Isometry3d arrow_pose = pose * Eigen::AngleAxisd(-M_PI / 2, Eigen::Vector3d::UnitY());
  return publishArrow(convertPose(arrow_pose), color, scale, length, id);
}


Definition at line [ 2056 ](rviz__visual__tools_8cpp_source.html#l02056) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool RvizVisualTools::publishText(const Eigen::Isometry3d& pose, const std::string& text, colors color, scales scale,
                                  bool static_id)
{
  return publishText(convertPose(pose), text, color, getScale(scale), static_id);
}


void rviz_visual_tools::RvizVisualTools::prompt  |  (  |  const std::string &
|  _msg_ |  )  |
---|---|---|---|---|---

Wait for user feedback i.e. through a button or joystick.


Definition at line [ 2704 ](rviz__visual__tools_8cpp_source.html#l02704) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Definition at line [ 225 ](rviz__visual__tools_8h_source.html#l00225) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


##  ◆  publishLineStrip()


  *[
              2014-06-16 15:13:34 -0500
             ]: 2014-06-16 15:13:34 -0500
  *[
             2014-06-17 14:20:41 -0500
            ]: 2014-06-17 14:20:41 -0500
  *[
        2014-06-16 15:13:34 -0500
       ]: 2014-06-16 15:13:34 -0500
  *[
        2024-04-15 17:07:10 -0500
       ]: 2024-04-15 17:07:10 -0500


##  ◆  mesh_marker_


     path  |  \- the location to publish each marker with respect to the base frame
---|---
length  |  \- geometry of cylinder
radius  |  \- geometry of cylinder
ns  |  \- namespace

Returns


##  ◆  publishCylinder()  [1/6]


(const geometry_msgs::Vector3 &point)
|  Convert a [ Vector3 ](../../../api/tf/html/c++/classVector3.html) to a
geometry_msg Point Note: Not thread safe but very convenient.  More...

static [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
|  [ convertPoint
](classrviz__visual__tools_1_1RvizVisualTools.html#aa3948b17a3dce8a0a95772d3dbcdeeae)
(const Eigen::Vector3d &point)
|  Convert a [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) point
to a geometry_msg Point Note: Not thread safe but very convenient.  More...

static Eigen::Vector3d  |  [ convertPoint32
](classrviz__visual__tools_1_1RvizVisualTools.html#a5344020f78d5ee3af0cb81d298940f90)
(const geometry_msgs::Point32 &point)
|  Convert a geometry_msg point to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) point Note: Not thread safe
but very convenient.  More...

static geometry_msgs::Point32  |  [ convertPoint32
](classrviz__visual__tools_1_1RvizVisualTools.html#aa731c4b4f37ff7e1de53bf55f6ea2d37)
(const Eigen::Vector3d &point)
|  Convert an [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) point
to a 32 bit geometry_msg point Note: Not thread safe but very convenient.
More...

static Eigen::Isometry3d  |  [ convertPoint32ToPose
](classrviz__visual__tools_1_1RvizVisualTools.html#af40929f483f566b846b771c08ccfff08)
(const geometry_msgs::Point32 &point)
|  Convert a geometry_msg point (32bit) to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) pose Note: Not thread safe
but very convenient.  More...

static [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
|  [ convertPointToPose
](classrviz__visual__tools_1_1RvizVisualTools.html#aad8ea570acbec63e496b8f08ac8ecc87)
(const [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
&point)


Returns one of registered geometry types.


  // Wait for subscriber
  while (num_existing_subscribers == 0)
  {
    if (!blocking && ros::Time::now() > max_time)  // Check if timed out
    {
      ROS_WARN_STREAM_NAMED(LOGNAME, "Topic '" << pub.getTopic() << "' unable to connect to any subscribers within "
                                               << wait_time
                                               << " sec. It is possible initially published visual messages "
                                                  "will be lost.");
      return false;
    }
    vis_marker_queue_.callAvailable(ros::WallDuration());


void RvizVisualTools::waitForMarkerPub()
{
  bool blocking = true;
  waitForSubscriber(pub_rviz_markers_, 0, blocking);
}


Parameters


Returns an axis-aligned bounding box of the geometry.


  // Helper for publishing rviz markers
  return publishMarker(line_list_marker_);
}


##  ◆  publishYArrow()  [1/3]


|  void rviz_visual_tools::RvizVisualTools::generateRandomPose  |  (  |  [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ RandomPoseBounds ](structrviz__visual__tools_1_1RandomPoseBounds.html)
|  _pose_bounds_ = ` [ RandomPoseBounds
](structrviz__visual__tools_1_1RandomPoseBounds.html) () `
|  )  |  |
static

Create a random pose within bounds of random_pose_bounds_.


bool rviz_visual_tools::RvizVisualTools::publishXZPlane  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ TRANSLUCENT
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3ada8357de2c7d31bdc0a27e7814e0ac85)
` ,
|  |  double  |  _scale_ = ` 1.0 `
|  )  |  |

Display the XY plane of a given pose.


bool rviz_visual_tools::RvizVisualTools::publishCylinder  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  double  |  _height_ = ` 0.1 ` ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Cylinder" `
|  )  |  |

Definition at line [ 1535 ](rviz__visual__tools_8cpp_source.html#l01535) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool RvizVisualTools::publishCuboid(const Eigen::Isometry3d& pose, double depth, double width, double height,
                                    colors color)
{
  return publishCuboid(convertPose(pose), depth, width, height, color);
}


[ about ](/about/) |  [ faq ](/faq/) |  [ help ](/help/ "help") |  [ privacy
policy ](/privacy/) |  [ terms of service ](/terms/)


|  visualization_msgs::Marker rviz_visual_tools::RvizVisualTools::text_marker_
---
protected

Definition at line [ 1094 ](rviz__visual__tools_8h_source.html#l01094) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


bool RvizVisualTools::publishAxisInternal(const Eigen::Isometry3d& pose, double length, double radius,
                                          const std::string& ns)
{
  // Publish x axis
  Eigen::Isometry3d x_pose =
      Eigen::Translation3d(length / 2.0, 0, 0) * Eigen::AngleAxisd(M_PI / 2.0, Eigen::Vector3d::UnitY());
  x_pose = pose * x_pose;
  publishCylinder(x_pose, RED, length, radius, ns);


` LineSet ` _= Type.LineSet_ Â¶


  for (std::size_t i = 1; i < path.size(); ++i)
  {
    // Add the point pair to the line message
    line_strip_marker_.points.push_back(path[i - 1]);
    line_strip_marker_.points.push_back(path[i]);
    line_strip_marker_.colors.push_back(this_color);
    line_strip_marker_.colors.push_back(this_color);
  }


##  ◆  spheres_marker_


  return true;
}


  // Position
  pose.translation().x() = dRand(pose_bounds.x_min_, pose_bounds.x_max_);
  pose.translation().y() = dRand(pose_bounds.y_min_, pose_bounds.y_max_);
  pose.translation().z() = dRand(pose_bounds.z_min_, pose_bounds.z_max_);


##  ◆  publishSphere()  [9/11]


Parameters


true on success


bool RvizVisualTools::publishSphere(const geometry_msgs::PoseStamped& pose, colors color,
                                    const geometry_msgs::Vector3 scale, const std::string& ns, std::size_t id)
{
  // Set the frame ID and timestamp
  sphere_marker_.header = pose.header;


bool rviz_visual_tools::RvizVisualTools::publishCylinder  |  (  |  const
Eigen::Vector3d & |  _point1_ ,
---|---|---|---
|  |  const Eigen::Vector3d & |  _point2_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Cylinder" `
|  )  |  |

Definition at line [ 1501 ](rviz__visual__tools_8cpp_source.html#l01501) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  ◆  dRand()


std_msgs::ColorRGBA rviz_visual_tools::RvizVisualTools::getColor  |  (  |  [
colors ](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3)
|  _color_ |  )  |  const
---|---|---|---|---|---

Get the RGB value of standard colors.


bool rviz_visual_tools::RvizVisualTools::publishPath  |  (  |  const
std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _path_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ RED
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a269d2451e2a4b2d6744d2d958a8a8467)
` ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Path" `
|  )  |  |

Definition at line [ 1928 ](rviz__visual__tools_8cpp_source.html#l01928) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  // Setup marker
  line_list_marker_.header.stamp = ros::Time();
  line_list_marker_.ns = ns;


bool RvizVisualTools::publishCone(const Eigen::Isometry3d& pose, double angle, colors color, double scale)
{
  return publishCone(convertPose(pose), angle, color, scale);
}


##  ◆  publishXZPlane()  [1/2]


bool rviz_visual_tools::RvizVisualTools::publishXYPlane  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ TRANSLUCENT
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3ada8357de2c7d31bdc0a27e7814e0ac85)
` ,
|  |  double  |  _scale_ = ` 1.0 `
|  )  |  |

Definition at line [ 976 ](rviz__visual__tools_8cpp_source.html#l00976) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


     point  |
---|---

Returns


  if (verbose)
  {
    std::cout << "rotation matrix after normalize: " << std::endl;
    std::cout << q.toRotationMatrix() << std::endl;
  }


  // Provide a new id every call to this function
  spheres_marker_.id++;


  return true;
}


##  ◆  publishXArrow()  [2/3]


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::line_strip_marker_
---
protected

Definition at line [ 1096 ](rviz__visual__tools_8h_source.html#l01096) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


  if (pose_bounds.azimuth_max_ > 2 * M_PI)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "max azimuth bound > 2 pi, setting equal to 2 pi ");
    pose_bounds.azimuth_max_ = 2 * M_PI;
  }


Returns ` True  ` iff the geometry is empty.


converted pose


Returns an oriented bounding box of the geometry.


  // For second half of color range move towards RED
  if (value == 0.0)
  {
    return getColor(RED);
  }
  else if (value == 1.0)
  {
    return getColor(GREEN);
  }
  else if (value <= 0.5)
  {
    start = getColor(RED);
    end = getColor(YELLOW);
  }
  else
  {
    start = getColor(YELLOW);
    end = getColor(GREEN);
    value = fmod(value, 0.5);
  }


Returns


  if (id == 0)
  {
    triangle_marker_.id++;
  }
  else
  {
    triangle_marker_.id = id;
  }


// Load path ----------------------------------------------------


     point  |  a - x,y,z in space of a point
---|---
point  |  b - x,y,z in space of a point

Returns


bool RvizVisualTools::publishAxis(const Eigen::Isometry3d& pose, scales scale, const std::string& ns)
{
  double radius = getScale(scale).x;
  return publishAxis(pose, radius * 10.0, radius, ns);
}


Definition at line [ 1982 ](rviz__visual__tools_8cpp_source.html#l01982) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishLineStrip  |  (  |  const
std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _path_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ RED
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a269d2451e2a4b2d6744d2d958a8a8467)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  const std::string & |  _ns_ = ` "Path" `
|  )  |  |

Display a series of connected lines using the LINE_STRIP method - deprecated
because visual bugs.


  line_strip_marker_.points.clear();
  line_strip_marker_.points.push_back(point1);
  line_strip_marker_.points.push_back(point2);


Parameters


##  ◆  convertPose()  [1/2]


  // Set marker size
  triangle_marker_.scale.x = scale;
  triangle_marker_.scale.y = scale;
  triangle_marker_.scale.z = scale;


##  ◆  publishWireframeRectangle()  [1/2]


[ xuningy ](/users/18591/xuningy/) ![flag of United States of
America](/m/default/media/images/flags/us.gif?v=28)
101  ●  8  ●  10  ●  15


bool RvizVisualTools::publishSphere(const geometry_msgs::Point& point, colors color, scales scale,
                                    const std::string& ns, std::size_t id)
{
  geometry_msgs::Pose pose_msg = getIdentityPose();
  pose_msg.position = point;
  return publishSphere(pose_msg, color, scale, ns, id);
}


[ Doubt regarding collision map ](/question/11812/doubt-regarding-collision-
map/)


##  ◆  convertPoint()  [2/3]


##  ◆  createRandColor()


vector of 3 scales


bool rviz_visual_tools::RvizVisualTools::publishLines  |  (  |  const
std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _aPoints_ ,
---|---|---|---
|  |  const std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _bPoints_ ,
|  |  const std::vector< std_msgs::ColorRGBA > & |  _colors_ ,
|  |  const geometry_msgs::Vector3 & |  _scale_
|  )  |  |

Definition at line [ 1831 ](rviz__visual__tools_8cpp_source.html#l01831) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  p[1].x = -1.0 * scale;
  p[1].y = 1.0 * scale;
  p[1].z = 0.0;


  return true;
}


bool rviz_visual_tools::RvizVisualTools::publishLine  |  (  |  const [
geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _point1_ ,
---|---|---|---
|  |  const [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _point2_ ,
|  |  const std_msgs::ColorRGBA & |  _color_ ,
|  |  const geometry_msgs::Vector3 & |  _scale_
|  )  |  |

Definition at line [ 1789 ](rviz__visual__tools_8cpp_source.html#l01789) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


[ edit ](/questions/173756/edit/) [ retag ](/s/questions/173756/retag/) flag
offensive  [ close ](/questions/173756/close/) merge  delete


` VoxelGrid ` _= Type.VoxelGrid_ Â¶


bool RvizVisualTools::publishSpheres(const EigenSTL::vector_Vector3d& points, colors color, double scale,
                                     const std::string& ns)
{
  std::vector<geometry_msgs::Point> points_msg;


bool rviz_visual_tools::RvizVisualTools::publishLine  |  (  |  const [
geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _point1_ ,
---|---|---|---
|  |  const [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _point2_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
`
|  )  |  |

Definition at line [ 1777 ](rviz__visual__tools_8cpp_source.html#l01777) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


` float64  ` array of shape ` (3,  )  `


Parameters


Definition at line [ 2439 ](rviz__visual__tools_8cpp_source.html#l02439) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


center point


##  ◆  batch_publishing_enabled_


Definition at line [ 660 ](rviz__visual__tools_8cpp_source.html#l00660) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


##  ◆  printTransform()


     pose  |  \- cuboid vertices are transformed according to it
---|---
height  |
width  |
color  |  \- an enum pre-defined name of a color
id  |  \- unique counter that allows you to overwrite a previous marker. if 0,
defaults to incremental counter

Returns


##  ◆  posesEqual()


Definition at line [ 2526 ](rviz__visual__tools_8cpp_source.html#l02526) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


|  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3)
rviz_visual_tools::RvizVisualTools::intToRvizColor  |  (  |  std::size_t  |
_color_ |  )  |
---|---|---|---|---|---
static

Used by interfaces that do not directly depend on Rviz Visual Tools, such as
OMPL.


  std_msgs::ColorRGBA this_color = getColor(color);
  spheres_marker_.scale = scale;
  spheres_marker_.color = this_color;
  spheres_marker_.colors.clear();


bool RvizVisualTools::publishMesh(const Eigen::Isometry3d& pose, const shape_msgs::Mesh& mesh, colors color,
                                  double scale, const std::string& ns, std::size_t id)
{
  return publishMesh(convertPose(pose), mesh, color, scale, ns, id);
}


  // Create the cylinders
  for (std::size_t i = 1; i < path.size(); ++i)
  {
    publishCylinder(path[i - 1].translation(), path[i].translation(), color, radius, ns);
  }


|  double rviz_visual_tools::RvizVisualTools::slerp  |  (  |  double  |
_start_ ,
---|---|---|---
|  |  double  |  _end_ ,
|  |  double  |  _range_ ,
|  |  double  |  _value_
|  )  |  |
static

Interpolate from [start, end] with value of size steps with current value
count.


bool RvizVisualTools::publishCone(const geometry_msgs::Pose& pose, double angle, colors color, double scale)
{
  triangle_marker_.header.stamp = ros::Time::now();
  triangle_marker_.id++;


##  ◆  publishLine()  [1/8]


  return true;
}


// Load line ----------------------------------------------------


true on success


colors RvizVisualTools::intToRvizColor(std::size_t color)
{
  // clang-format off
  switch (color)
  {
    case 0: return BLACK; break;
    case 1: return BROWN; break;
    case 2: return BLUE; break;
    case 3: return CYAN; break;
    case 4: return GREY; break;
    case 5: return DARK_GREY; break;
    case 6: return GREEN; break;
    case 7: return LIME_GREEN; break;
    case 8: return MAGENTA; break;
    case 9: return ORANGE; break;
    case 10: return PURPLE; break;
    case 11: return RED; break;
    case 12: return PINK; break;
    case 13: return WHITE; break;
    case 14: return YELLOW; break;
    case 15: return TRANSLUCENT; break;
    case 16: return TRANSLUCENT_LIGHT; break;
    case 17: return TRANSLUCENT_DARK; break;
    case 18: return RAND; break;
    case 19: return CLEAR; break;
    case 20: return DEFAULT; break;
  }
  // clang-format on
  return DEFAULT;
}


  if (pose_bounds.elevation_max_ > M_PI)
  {
    ROS_WARN_STREAM_NAMED(LOGNAME, "max elevation bound > pi, setting equal to pi ");
    pose_bounds.elevation_max_ = M_PI;
  }


|  void rviz_visual_tools::RvizVisualTools::generateRandomCuboid  |  (  |  [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _cuboid_pose_ ,
---|---|---|---
|  |  double & |  _depth_ ,
|  |  double & |  _width_ ,
|  |  double & |  _height_ ,
|  |  [ RandomPoseBounds ](structrviz__visual__tools_1_1RandomPoseBounds.html)
|  _pose_bounds_ = ` [ RandomPoseBounds
](structrviz__visual__tools_1_1RandomPoseBounds.html) () ` ,
|  |  [ RandomCuboidBounds
](structrviz__visual__tools_1_1RandomCuboidBounds.html) |  _cuboid_bounds_ = `
[ RandomCuboidBounds ](structrviz__visual__tools_1_1RandomCuboidBounds.html)
() `
|  )  |  |
static

Create a random rectangular cuboid of some shape.


     point1  |  \- x,y,z of start of line
---|---
point2  |  \- x,y,z of end of line
color  |  \- an enum pre-defined name of a color
scale  |  \- an enum pre-defined name of a size

Returns


     point  |
---|---

Returns


rviz_visual_tools::RvizVisualTools Class Reference


` RGBDImage ` _= Type.RGBDImage_ Â¶


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::spheres_marker_
---
protected

Definition at line [ 1098 ](rviz__visual__tools_8h_source.html#l01098) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


bool rviz_visual_tools::RvizVisualTools::waitForSubscriber  |  (  |  const [
ros::Publisher ](../../../api/roscpp/html/classros_1_1Publisher.html) & |
_pub_ ,
---|---|---|---
|  |  double  |  _wait_time_ = ` 0.5 ` ,
|  |  bool  |  _blocking_ = ` false `
|  )  |  |

Wait until at least one subscriber connects to a publisher.


|  void rviz_visual_tools::RvizVisualTools::convertPoseSafe  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_msg_
|  )  |  |
static

Convert an [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) pose to a
geometry_msg pose - thread safe.


##  ◆  publishLine()  [6/8]


     [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) |  pose - input
---|---
ROS  |  msg pose - output

Definition at line [ 2446 ](rviz__visual__tools_8cpp_source.html#l02446) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool RvizVisualTools::publishMarker(visualization_msgs::Marker& marker)
{
  // Add single marker to array
  marker.frame_locked = frame_locking_enabled_;
  markers_.markers.push_back(marker);


` Unspecified ` _= Type.Unspecified_ Â¶


` translate ` (  _self_ , _translation_ , _relative=True_ )  Â¶


     markers  |
---|---

Returns


##  ◆  convertFromXYZRPY()  [2/2]


  // Random orientation (random rotation axis from unit sphere and random angle)
  double angle = dRand(pose_bounds.angle_min_, pose_bounds.angle_max_);
  double elevation = dRand(pose_bounds.elevation_min_, pose_bounds.elevation_max_);
  double azimuth = dRand(pose_bounds.azimuth_min_, pose_bounds.azimuth_max_);


#  open3d.geometry.OrientedBoundingBox  Â¶


  line_list_marker_.scale = scale;
  line_list_marker_.scale.z = 0;
  line_list_marker_.scale.y = 0;


##  ◆  convertPoint()  [3/3]


##  ◆  convertToXYZRPY()  [1/2]


##  ◆  convertPoint32()  [2/2]


bool rviz_visual_tools::RvizVisualTools::publishArrow  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1298 ](rviz__visual__tools_8cpp_source.html#l01298) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  * [ Basic ](../tutorial/Basic/index.html)
  * [ Advanced ](../tutorial/Advanced/index.html)
  * [ Reconstruction system ](../tutorial/ReconstructionSystem/index.html)
  * [ C++ interface ](../tutorial/C++/cplusplus_interface.html)
  * [ Docker ](../tutorial/docker/index.html)
  * [ Reference ](../tutorial/reference.html)


[ subscribe to rss feed ](/feeds/question/173756/ "subscribe to the rss feed")


bool rviz_visual_tools::RvizVisualTools::publishArrow  |  (  |  const
geometry_msgs::PoseStamped & |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  double  |  _length_ = ` 0.0 ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1332 ](rviz__visual__tools_8cpp_source.html#l01332) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


bool rviz_visual_tools::RvizVisualTools::publishSpheres  |  (  |  const [
EigenSTL::vector_Vector3d
](../../../api/eigen_stl_containers/html/namespaceEigenSTL.html#a79212253ac3459b428e7d37d1601a7d2)
& |  _points_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  double  |  _scale_ = ` 0.1 ` ,
|  |  const std::string & |  _ns_ = ` "Spheres" `
|  )  |  |

Definition at line [ 2296 ](rviz__visual__tools_8cpp_source.html#l02296) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


     pose1  |
---|---
pose2  |
threshold  |  \- how close in value they must be in order to be considered the
same

Returns


##  ◆  publishMesh()  [1/2]


##  ◆  publishPath()  [3/9]


Parameters


##  ◆  convertToXYZRPY()  [2/2]


  // Provide a new id every call to this function
  line_strip_marker_.id++;


##  ◆  convertPoseSafe()  [1/2]


bool rviz_visual_tools::RvizVisualTools::publishArrow  |  (  |  const [
geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _start_ ,
---|---|---|---
|  |  const [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _end_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1368 ](rviz__visual__tools_8cpp_source.html#l01368) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


converted point with default rotation matrix


##  ◆  publishSphere()  [5/11]


bool RvizVisualTools::publishCylinder(const Eigen::Vector3d& point1, const Eigen::Vector3d& point2, colors color,
                                      double radius, const std::string& ns)
{
  return publishCylinder(point1, point2, getColor(color), radius, ns);
}


  // Set marker size
  cylinder_marker_.scale.x = radius;
  cylinder_marker_.scale.y = radius;
  cylinder_marker_.scale.z = height;


     name  |  of frame
---|---

Definition at line [ 343 ](rviz__visual__tools_8h_source.html#l00343) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


     tx,ty,tz  |  \- translations in x, y, z respectively
---|---
rx,ry,rz  |  \- rotations about x, y, z, respectively
convention  |  \- default is [ rviz_visual_tools::XYZ
](namespacerviz__visual__tools.html#a25a0ae702485241183604425b99eb8c6a8c43a984f6a068e4c8a86743b25034b7)

Definition at line [ 2544 ](rviz__visual__tools_8cpp_source.html#l02544) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


  if (blocking && num_existing_subscribers == 0)
  {
    ROS_INFO_STREAM_NAMED(LOGNAME, "Topic '" << pub.getTopic() << "' waiting for subscriber...");
  }


##  ◆  publishAxis()  [4/4]


Returns


##  ◆  convertPoint32()  [1/2]


  switch (convention)
  {
    case XYZ:
      result = Eigen::Translation3d(tx, ty, tz) * Eigen::AngleAxisd(rx, Eigen::Vector3d::UnitX()) *
               Eigen::AngleAxisd(ry, Eigen::Vector3d::UnitY()) * Eigen::AngleAxisd(rz, Eigen::Vector3d::UnitZ());
      break;


void rviz_visual_tools::RvizVisualTools::waitForMarkerPub  |  (  |  |  )  |
---|---|---|---|---

Optional blocking function to call _after_ calling [ loadMarkerPub()
](classrviz__visual__tools_1_1RvizVisualTools.html#a40922a05c41f8ef17ceb017979d51462
"Load publishers as needed. ") . Allows you to do some intermediate processing
before wasting cycles waiting for the marker pub to find a subscriber.


double RvizVisualTools::slerp(double start, double end, double range, double value)
{
  return start + (((end - start) / range) * value);
}


|  visualization_msgs::Marker
rviz_visual_tools::RvizVisualTools::triangle_marker_
---
protected

Definition at line [ 1100 ](rviz__visual__tools_8h_source.html#l01100) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


Definition at line [ 1898 ](rviz__visual__tools_8cpp_source.html#l01898) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


true on success


bool RvizVisualTools::publishAxis(const Eigen::Isometry3d& pose, double length, double radius, const std::string& ns)
{
  // Use an internal function that will not actually publish anything, so that other makers can combine with an axis
  // without publishing
  publishAxisInternal(pose, length, radius, ns);


` get_min_bound ` (  _self_ )  Â¶


bool RvizVisualTools::publishSphere(const Eigen::Vector3d& point, colors color, double scale, const std::string& ns,
                                    std::size_t id)
{
  geometry_msgs::Pose pose_msg = getIdentityPose();
  tf2::convert(point, pose_msg.position);
  return publishSphere(pose_msg, color, scale, ns, id);
}


##  ◆  publishPath()  [7/9]


bool rviz_visual_tools::RvizVisualTools::publishLines  |  (  |  const [
EigenSTL::vector_Vector3d
](../../../api/eigen_stl_containers/html/namespaceEigenSTL.html#a79212253ac3459b428e7d37d1601a7d2)
& |  _aPoints_ ,
---|---|---|---
|  |  const [ EigenSTL::vector_Vector3d
](../../../api/eigen_stl_containers/html/namespaceEigenSTL.html#a79212253ac3459b428e7d37d1601a7d2)
& |  _bPoints_ ,
|  |  const std::vector< [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) > & |
_colors_ ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
`
|  )  |  |

Display a marker of lines.


bool rviz_visual_tools::RvizVisualTools::publishSphere  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ BLUE
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a6cd27d693df45662c3ecebdc4dc8b671)
` ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ = ` [ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
` ,
|  |  const std::string & |  _ns_ = ` "Sphere" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1139 ](rviz__visual__tools_8cpp_source.html#l01139) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Definition at line [ 2748 ](rviz__visual__tools_8cpp_source.html#l02748) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


[ ALL ](/questions/scope:all/sort:activity-desc/page:1/) [ UNANSWERED
](/questions/scope:unanswered/sort:answers-asc/page:1/)


  for (std::size_t i = 0; i < points.size(); ++i)
  {
    // Convert Eigen to ROS Msg
    points_msg.push_back(convertPoint(points[i]));
    // Convert color to ROS Msg
    colors_msg.push_back(getColor(colors[i]));
  }


// DEPRECATED, remove in Melodic after Dec 2018 release or so
const std::string RvizVisualTools::NAME = "visual_tools";


|  geometry_msgs::Point32 rviz_visual_tools::RvizVisualTools::convertPoint32
|  (  |  const Eigen::Vector3d & |  _point_ |  )  |
---|---|---|---|---|---
static

Convert an [ Eigen ](../../../api/rviz/html/c++/namespaceEigen.html) point to
a 32 bit geometry_msg point Note: Not thread safe but very convenient.


  // Helper for publishing rviz markers
  publishMarker(sphere_marker_);


bool RvizVisualTools::publishSpheres(const EigenSTL::vector_Vector3d& points, colors color, scales scale,
                                     const std::string& ns)
{
  std::vector<geometry_msgs::Point> points_msg;


bool rviz_visual_tools::RvizVisualTools::publishPath  |  (  |  const
std::vector< [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
> & |  _path_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) |
_scale_ ,
|  |  const std::string & |  _ns_ = ` "Path" `
|  )  |  |

Definition at line [ 1910 ](rviz__visual__tools_8cpp_source.html#l01910) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


* **type** ( [ _open3d.geometry.RotationType_ ](open3d.geometry.RotationType.html#open3d.geometry.RotationType "open3d.geometry.RotationType") _,_ _optional_ _,_ _default=RotationType.XYZ_ ) â Type of rotation, i.e., an Euler format, or axis-angle.


     point1  |  \- starting side of cylinder
---|---
point2  |  \- end side of cylinder
color  |  \- an enum pre-defined name of a color
radius  |  \- geometry of cylinder

Returns


geometry_msgs::Vector3 RvizVisualTools::getScale(scales scale, double marker_scale) const
{
  geometry_msgs::Vector3 result;
  double val(0.0);
  switch (scale)
  {
    case XXXXSMALL:
      val = 0.001;
      break;
    case XXXSMALL:
      val = 0.0025;
      break;
    case XXSMALL:
      val = 0.005;
      break;
    case XSMALL:
      val = 0.0065;
      break;
    case SMALL:
      val = 0.0075;
      break;
    case MEDIUM:
      val = 0.01;
      break;
    case LARGE:
      val = 0.025;
      break;
    case XLARGE:
      val = 0.05;
      break;
    case XXLARGE:
      val = 0.075;
      break;
    case XXXLARGE:
      val = 0.1;
      break;
    case XXXXLARGE:
      val = 0.5;
      break;
    default:


bool rviz_visual_tools::RvizVisualTools::publishCylinder  |  (  |  const [
geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
& |  _pose_ ,
---|---|---|---
|  |  const std_msgs::ColorRGBA & |  _color_ ,
|  |  double  |  _height_ = ` 0.1 ` ,
|  |  double  |  _radius_ = ` 0.01 ` ,
|  |  const std::string & |  _ns_ = ` "Cylinder" `
|  )  |  |

Definition at line [ 1541 ](rviz__visual__tools_8cpp_source.html#l01541) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


[ Compiler error: Expected constructor, destructor, or type conversion in
octomap_server_nodelet.cpp ](/question/338330/compiler-error-expected-
constructor-destructor-or-type-conversion-in-octomap_server_nodeletcpp/)


|  const std::string rviz_visual_tools::RvizVisualTools::getBaseFrame  |  (  |
|  )  |  const
---|---|---|---|---
inline

Get the base frame.


  line_strip_marker_.id++;
  line_strip_marker_.color = color;
  line_strip_marker_.scale = scale;
  line_strip_marker_.scale.y = 0;
  line_strip_marker_.scale.z = 0;


  // Helper for publishing rviz markers
  return publishMarker(sphere_marker_);
}


` float64  ` array of shape ` (3,  )  `


  if (path.size() != colors.size())
  {
    ROS_ERROR_STREAM_NAMED(LOGNAME,
                           "Skipping path because " << path.size() << " different from " << colors.size() << ".");
    return false;
  }


##  ◆  ~RvizVisualTools()


Definition at line [ 2743 ](rviz__visual__tools_8cpp_source.html#l02743) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


     pose  |  \- the position of the plane
---|---
color  |  \- the color of the plane
scale  |  \- the size of the vizualized plane

Returns


the RGB message of a random color


void RvizVisualTools::prompt(const std::string& msg)
{
  getRemoteControl()->waitForNextStep(msg);
}


bool RvizVisualTools::publishSpheres(const std::vector<geometry_msgs::Point>& points, colors color,
                                     const geometry_msgs::Vector3& scale, const std::string& ns)
{
  spheres_marker_.header.stamp = ros::Time();
  spheres_marker_.ns = ns;


  // Load Sphere -------------------------------------------------
  sphere_marker_.header.frame_id = base_frame_;
  // Set the namespace and id for this marker.  This serves to create a unique
  // ID
  sphere_marker_.ns = "Sphere";
  // Set the marker type.
  sphere_marker_.type = visualization_msgs::Marker::SPHERE;
  // Set the marker action.  Options are ADD and DELETE
  sphere_marker_.action = visualization_msgs::Marker::ADD;
  // Marker group position and orientation
  sphere_marker_.pose.position.x = 0;
  sphere_marker_.pose.position.y = 0;
  sphere_marker_.pose.position.z = 0;
  sphere_marker_.pose.orientation.x = 0.0;
  sphere_marker_.pose.orientation.y = 0.0;
  sphere_marker_.pose.orientation.z = 0.0;
  sphere_marker_.pose.orientation.w = 1.0;
  // Create a sphere point
  // Add the point pair to the line message
  sphere_marker_.points.resize(1);
  sphere_marker_.colors.resize(1);
  // Lifetime
  sphere_marker_.lifetime = marker_lifetime_;
  // Constants
  sphere_marker_.pose = getIdentityPose();


Definition at line [ 334 ](rviz__visual__tools_8h_source.html#l00334) of file
[ rviz_visual_tools.h ](rviz__visual__tools_8h_source.html) .


##  ◆  waitForMarkerPub()  [1/2]


bool rviz_visual_tools::RvizVisualTools::publishSphere  |  (  |  const
geometry_msgs::PoseStamped & |  _pose_ ,
---|---|---|---
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ ,
|  |  const geometry_msgs::Vector3  |  _scale_ ,
|  |  const std::string & |  _ns_ = ` "Sphere" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Definition at line [ 1200 ](rviz__visual__tools_8cpp_source.html#l01200) of
file [ rviz_visual_tools.cpp ](rviz__visual__tools_8cpp_source.html) .


Parameters


##  ◆  triangle_marker_


bool RvizVisualTools::publishPath(const EigenSTL::vector_Vector3d& path, colors color, scales scale,
                                  const std::string& ns)
{
  return publishPath(path, color, getScale(scale).x, ns);
}


converted point


    p[2].x = scale;
    p[2].y = scale * cos(theta + DELTA_THETA) / angle;
    p[2].z = scale * sin(theta + DELTA_THETA) / angle;


##  ◆  publishText()  [4/4]


##  ◆  getPsychedelicMode()


  const std::size_t max_attempts = 20;  // bound the performance
  std::size_t attempts = 0;


  // Set the pose
  cylinder_marker_.pose = pose;


bool RvizVisualTools::publishXZPlane(const geometry_msgs::Pose& pose, colors color, double scale)
{
  triangle_marker_.header.stamp = ros::Time::now();
  triangle_marker_.id++;


bool rviz_visual_tools::RvizVisualTools::loadRvizMarkers  |  (  |  |  )  |
---|---|---|---|---

Pre-load rviz markers for better efficiency.


##  ◆  pub_rviz_markers_waited_


##  ◆  convertPoint()  [1/3]


     spheres  |  \- where to publish them
---|---
color  |  \- an enum pre-defined name of a color
scale  |  \- an enum pre-defined name of a size
ns  |  \- namespace of marker

Returns


](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) scale=
[ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
, std::size_t id=0)
bool  |  [ publishAxis
](classrviz__visual__tools_1_1RvizVisualTools.html#a614ea485b01a18d388574e612dea09c4)
(const [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
&pose, [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) scale=
[ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
, const std::string &ns="Axis")
|  Display a red/green/blue coordinate frame axis.  More...

bool  |  [ publishAxis
](classrviz__visual__tools_1_1RvizVisualTools.html#a6dde31f91762e5c4bad584163007a927)
(const Eigen::Isometry3d &pose, [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) scale=
[ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)
, const std::string &ns="Axis")
bool  |  [ publishAxis
](classrviz__visual__tools_1_1RvizVisualTools.html#a559cb630573bfad9d11e38941956ea8c)
(const [ geometry_msgs::Pose
](../../../api/tf/html/c++/namespacetf.html#af31f272a1879787c24c3decb07cdb361)
&pose, double [ length
](../../../api/tf2/html/namespacetf2.html#ab20034dc53b40043a702876ff38c78a1) ,
double radius=0.01, const std::string &ns="Axis")
bool  |  [ publishAxis
](classrviz__visual__tools_1_1RvizVisualTools.html#ac19f344408ad96c68b22848c129b411a)
(const Eigen::Isometry3d &pose, double [ length
](../../../api/tf2/html/namespacetf2.html#ab20034dc53b40043a702876ff38c78a1) ,
double radius=0.01, const std::string &ns="Axis")
bool  |  [ publishAxisLabeled
](classrviz__visual__tools_1_1RvizVisualTools.html#a7e31553b2f4f0cb4e460067f6f914a3c)
(const Eigen::Isometry3d &pose, const std::string &label, [ scales
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835) scale=
[ MEDIUM
](namespacerviz__visual__tools.html#a5b544decae321663ea907bb26338d835a322895c45564210483089d04f6a07473)


bool rviz_visual_tools::RvizVisualTools::publishMesh  |  (  |  const
Eigen::Isometry3d & |  _pose_ ,
---|---|---|---
|  |  const std::string & |  _file_name_ ,
|  |  [ colors
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3) |
_color_ = ` [ CLEAR
](namespacerviz__visual__tools.html#abd3566ac96adb96a35044b029930e6e3a3a91cf12667283beafe6e3732e8bdd20)
` ,
|  |  double  |  _scale_ = ` 1 ` ,
|  |  const std::string & |  _ns_ = ` "mesh" ` ,
|  |  std::size_t  |  _id_ = ` 0 `
|  )  |  |

Display a mesh from file.


##  ◆  setGlobalScale()


  // Set the mesh
  mesh_marker_.mesh_resource = file_name;
  mesh_marker_.mesh_use_embedded_materials = 1u;


RemoteControlPtr& RvizVisualTools::getRemoteControl()
{
  if (!remote_control_)
  {
    loadRemoteControl();
  }
  return remote_control_;
}


    #ifndef RVIZ_COLLISION_MAP_DISPLAY_H_
    #define RVIZ_COLLISION_MAP_DISPLAY_H_

    #include <rviz/display.h>
    #include <rviz/helpers/color.h>

    #include <boost/thread/mutex.hpp>

    #include <boost/shared_ptr.hpp>

    #include <arm_navigation_msgs/OrientedBoundingBox.h>
    #include <arm_navigation_msgs/CollisionMap.h>

    #include <message_filters/subscriber.h>
    #include <tf/message_filter.h>

    namespace rviz
    {
    class PointCloud;
    class ColorProperty;
    class RosTopicProperty;
    class BoolProperty;
    class EnumProperty;
    class FloatProperty;
    }

    namespace Ogre
    {
    class SceneNode;
    class ManualObject;
    }

    namespace mapping_rviz_plugin
    {

    namespace collision_render_ops
    {
    enum CollisionRenderOp


  triangle_marker_.color = getColor(color);
  triangle_marker_.pose = pose;


  for (const auto& point : points)
  {
    points_msg.push_back(convertPoint(point));
  }


|  Eigen::Vector3d rviz_visual_tools::RvizVisualTools::convertPoint  |  (  |
const [ geometry_msgs::Point
](../../../api/tf/html/c++/namespacetf.html#a55ddfd1e43e4fc81a11d51e0e75e9e2c)
& |  _point_ |  )  |
---|---|---|---|---|---
static

Convert a geometry_msg point to an [ Eigen
](../../../api/rviz/html/c++/namespaceEigen.html) point Note: Not thread safe
but very convenient.