Coder Social home page Coder Social logo

rviz_visual_tools's Introduction

Rviz Visual Tools

C++ API wrapper for displaying shapes and meshes in Rviz via helper functions that publish markers. Useful for displaying and debugging data. For more advanced robot visualization features, see the moveit_visual_tools which builds on this class.

This package includes:

  • Rviz Panel GUI to step through your code for debugging and testing
  • Rviz-based keyboard control for stepping through application
  • Easy to use helper functions for visualizing in Rviz fast
  • Basic geometric markers for Rviz
  • More complex geometric shapes such as coordinate frames, framed boxes, planes, paths, graphs
  • Ability to quickly choose standard colors and sizes
  • Tools to ensure proper connection to Rviz before publishing visualizations
  • Shortcuts to convert between different types of points and poses - ROS msgs, Eigen, tf, etc
  • Batch publishing capabilities to reduce over throttling ROS messages
  • A tf publishing helper class
  • An interactive marker helper class

This open source project was developed at PickNik Robotics. Need professional ROS development and consulting? Contact us at [email protected] for a free consultation.

  • Build Status Travis CI
  • Build Status ROS Kinetic Buildfarm - AMD64 Xenial Debian Build for Ubuntu 16.04
  • Build Status ROS Kinetic Buildfarm - AMD64 Xenial Devel Build for Ubuntu 16.04
  • Build Status ROS Melodic Buildfarm - AMD64 Bionic Debian Build for Ubuntu 18.04
  • Build Status ROS Melodic Buildfarm - AMD64 Bionic Devel Build for Ubuntu 18.04

Install

Ubuntu Debian

sudo apt-get install ros-melodic-rviz-visual-tools

Build from Source

Clone this repository into a catkin workspace, then use the rosdep install tool to automatically download its dependencies. Depending on your current version of ROS, use:

rosdep install --from-paths src --ignore-src --rosdistro melodic

Quick Start Demo

To see random shapes generated in Rviz, first launch Rviz:

roslaunch rviz_visual_tools demo_rviz.launch

Then start demo:

roslaunch rviz_visual_tools demo.launch

Code API

See the Doxygen documentation

Usage

We'll assume you will be using these helper functions within a class. Almost all of the functions assume you are publishing transforms in the world frame (whatever you call that e.g. /odom).

Initialize

Add to your includes:

#include <rviz_visual_tools/rviz_visual_tools.h>

Add to your class's member variables:

// For visualizing things in rviz
rviz_visual_tools::RvizVisualToolsPtr visual_tools_;

In your class' constructor add:

visual_tools_.reset(new rviz_visual_tools::RvizVisualTools("base_frame","/rviz_visual_markers"));

Change the first parameter to the name of your robot's base frame, and the second parameter to whatever name you'd like to use for the corresponding Rviz marker ROS topic.

Tools

Now in your code you can easily debug your code using visual markers in Rviz

Start rviz and create a new marker using the 'Add' button at the bottom right. Choose the marker topic to be the same as the topic you specified in the constructor.

Example Code

In the following snippet we create a pose at xyz (0.1, 0.1, 0.1) and rotate the pose down 45 degrees along the Y axis. Then we publish the pose as a arrow for visualziation in Rviz. Make sure your Rviz fixed frame is the same as the one chosen in the code.

// Create pose
Eigen::Isometry3d pose;
pose = Eigen::AngleAxisd(M_PI/4, Eigen::Vector3d::UnitY()); // rotate along X axis by 45 degrees
pose.translation() = Eigen::Vector3d( 0.1, 0.1, 0.1 ); // translate x,y,z

// Publish arrow vector of pose
ROS_INFO_STREAM_NAMED("test","Publishing Arrow");
visual_tools_->publishArrow(pose, rviz_visual_tools::RED, rviz_visual_tools::LARGE);

// Don't forget to trigger the publisher!
visual_tools_->trigger();

For more example code see rviz_visual_tools_demo.cpp

Rviz GUI Usage

Publishes on the topic of /rviz_visual_tools_gui

The buttons in the Joy message correspond to the following:

1 - Next
2 - Continue
3 - Break
4 - Stop

Note: only Next is fully implemented

Mouse-Based Control

Use the Rviz panel called "RvizVisualToolsGui" to step through your program.

Keyboard-Based Control

Switch to the "KeyTool" in the top of the Rviz window and use the following keyboard commands:

  • n: next
  • c or a: continue
  • b: break
  • s: stop

API

Basic Publishing Functions

See rviz_visual_tools.h for more details and documentation on the following functions:

  • publishSphere
  • publishSpheres
  • publishArrow/publishXArrow
  • publishYArrow
  • publishZArrow
  • publishCuboid
  • publishCone
  • publishXYPlane
  • publishXZPlane
  • publishYZPlane
  • publishLine
  • publishPath
  • publishPolygon
  • publishBlock
  • publishWireframeCuboid
  • publishWireframeRectangle
  • publishAxis
  • publishAxisLabeled
  • publishCylinder
  • publishMesh
  • publishText
  • publishTest

And more...

Helper Functions

Reset function

  • deleteAllMarkers() - tells Rviz to clear out all current markers from being displayed.

All markers must be triggered after being published, by calling the trigger() function. This allows batch publishing to be achieved by only calling after several markers have been created, greatly increasing the speed of your application. You can even explicitly tell rviz_visual_tools how often to publish via the triggerEvery(NUM_MARKERS) command:

  • trigger()
  • triggerEvery(20)

Conversion functions

  • convertPose
  • convertPoint32ToPose
  • convertPoseToPoint
  • convertPoint
  • convertPoint32
  • convertFromXYZRPY
  • convertToXYZRPY

Convenience functions

  • generateRandomPose
  • generateEmptyPose
  • dRand
  • fRand
  • iRand
  • getCenterPoint
  • getVectorBetweenPoints

Frame locking

This allows the markers to be automatically updated as the base frame moves without having to republish. You can enable it via enableFrameLocking() (this is not enabled by default).

Available Colors

This package helps you quickly choose colors - feel free to send PRs with more colors as needed

BLACK,
BLUE,
BROWN,
CYAN,
DARK_GREY,
GREEN,
GREY,
LIME_GREEN,
MAGENTA,
ORANGE,
PINK,
PURPLE,
RED,
WHITE,
YELLOW,
TRANSLUCENT_LIGHT,
TRANSLUCENT,
TRANSLUCENT_DARK,
RAND,
CLEAR,
DEFAULT // i.e. 'do not change default color'

Available Marker Sizes

XXXXSMALL,
XXXSMALL,
XXSMALL,
XSMALL,
SMALL,
MEDIUM,
LARGE,
XLARGE,
XXLARGE,
XXXLARGE,
XXXXLARGE,

Interactive Marker Helper Class

This class quickly gives you basic 6dof pose interactive marker funcitonality. A demo is available:

roslaunch rviz_visual_tools demo_rviz.launch
rosrun rviz_visual_tools imarker_simple_demo

TF Visual Tools

This tool lets you easily debug Eigen transforms in Rviz. Demo use:

rviz_visual_tools::TFVisualTools tf_visualizer;
Eigen::Isometry3d world_to_shelf_transform = Eigen::Isometry3d::Identity(); // or whatever value
tf_visualizer.publishTransform(world_to_shelf_transform, "world", "shelf");

Note: this is a work in progress

Testing and Linting

To run roslint, use the following command with catkin-tools:

catkin build --no-status --no-deps --this --make-args roslint

To run catkin lint, use the following command with catkin-tools:

catkin lint -W2

Use the following command with catkin-tools to run the small amount of available tests:

catkin run_tests --no-deps --this -i

Run with clang-tidy:

run-clang-tidy-4.0.py -clang-tidy-binary=/usr/lib/llvm-4.0/bin/clang-tidy -fix -p=/home/dave/ros/current/ws_moveit/build/rviz_visual_tools .

Docker Image

Dockerhub automatically creates a Docker for this repo. To run with GUI:

# This is not the safest way however, as you then compromise the access control to X server on your host
xhost +local:root # for the lazy and reckless
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" davetcoleman/rviz_visual_tools:melodic
export containerId=$(docker ps -l -q)
# Close security hole:
xhost -local:root

(Optional) To build the docker image locally for this repo, run in base of package:

docker build -t davetcoleman/rviz_visual_tools:melodic .

Contribute

Please send PRs for new helper functions, fixes, etc!

When a pull request is opened, a reviewer is randomly assigned from the reviewer list using the Auto Assign Github Bot

rviz_visual_tools's People

Contributors

andyze avatar d-walsh avatar davetcoleman avatar ffurrer avatar geoffreychiou avatar gleichdick avatar jafarabdi avatar jontromanab avatar jorge-c avatar jspricke avatar mcevoyandy avatar miguelprada avatar mlautman avatar mosfet80 avatar nandite avatar naveedhd avatar nbbrooks avatar roboticsyy avatar seanyen avatar simonschmeisser avatar tylerjw avatar v4hn avatar vatanaksoytezer avatar victorlamoine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rviz_visual_tools's Issues

multiple definition of rviz_visual_tools::KeyTool::qt_static_metacall

Hello, I finished the rosdep install command, and when i tried to catkin_make the workspace, i get follow errors:
[ 97%] Linking CXX shared library /home/robot/catkin_ws/devel/lib/librviz_visual_tools_gui.so
CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::KeyTool::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)': rviz_visual_tools_gui_automoc.cpp:(.text+0x0): multiple definition of rviz_visual_tools::KeyTool::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)'
CMakeFiles/rviz_visual_tools_gui.dir/src/moc_key_tool.cpp.o:moc_key_tool.cpp:(.text+0x0): first defined here
CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o:(.data.rel.ro+0x20): multiple definition of rviz_visual_tools::KeyTool::staticMetaObject' CMakeFiles/rviz_visual_tools_gui.dir/src/moc_key_tool.cpp.o:(.data.rel.ro+0x20): first defined here CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::KeyTool::metaObject() const':
rviz_visual_tools_gui_automoc.cpp:(.text+0x16): multiple definition of rviz_visual_tools::KeyTool::metaObject() const' CMakeFiles/rviz_visual_tools_gui.dir/src/moc_key_tool.cpp.o:moc_key_tool.cpp:(.text+0x16): first defined here CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::KeyTool::qt_metacast(char const*)':
rviz_visual_tools_gui_automoc.cpp:(.text+0x5e): multiple definition of rviz_visual_tools::KeyTool::qt_metacast(char const*)' CMakeFiles/rviz_visual_tools_gui.dir/src/moc_key_tool.cpp.o:moc_key_tool.cpp:(.text+0x5e): first defined here CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::KeyTool::qt_metacall(QMetaObject::Call, int, void**)':
rviz_visual_tools_gui_automoc.cpp:(.text+0xae): multiple definition of rviz_visual_tools::KeyTool::qt_metacall(QMetaObject::Call, int, void**)' CMakeFiles/rviz_visual_tools_gui.dir/src/moc_key_tool.cpp.o:moc_key_tool.cpp:(.text+0xae): first defined here CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::RvizVisualToolsGui::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)':
rviz_visual_tools_gui_automoc.cpp:(.text+0xee): multiple definition of rviz_visual_tools::RvizVisualToolsGui::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)' CMakeFiles/rviz_visual_tools_gui.dir/src/moc_rviz_visual_tools_gui.cpp.o:moc_rviz_visual_tools_gui.cpp:(.text+0x0): first defined here CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o:(.data.rel.ro+0x60): multiple definition of rviz_visual_tools::RvizVisualToolsGui::staticMetaObject'
CMakeFiles/rviz_visual_tools_gui.dir/src/moc_rviz_visual_tools_gui.cpp.o:(.data.rel.ro+0x20): first defined here
CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::RvizVisualToolsGui::metaObject() const': rviz_visual_tools_gui_automoc.cpp:(.text+0x16c): multiple definition of rviz_visual_tools::RvizVisualToolsGui::metaObject() const'
CMakeFiles/rviz_visual_tools_gui.dir/src/moc_rviz_visual_tools_gui.cpp.o:moc_rviz_visual_tools_gui.cpp:(.text+0x7e): first defined here
CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::RvizVisualToolsGui::qt_metacast(char const*)': rviz_visual_tools_gui_automoc.cpp:(.text+0x1b4): multiple definition of rviz_visual_tools::RvizVisualToolsGui::qt_metacast(char const*)'
CMakeFiles/rviz_visual_tools_gui.dir/src/moc_rviz_visual_tools_gui.cpp.o:moc_rviz_visual_tools_gui.cpp:(.text+0xc6): first defined here
CMakeFiles/rviz_visual_tools_gui.dir/rviz_visual_tools_gui_automoc.cpp.o: In function rviz_visual_tools::RvizVisualToolsGui::qt_metacall(QMetaObject::Call, int, void**)': rviz_visual_tools_gui_automoc.cpp:(.text+0x204): multiple definition of rviz_visual_tools::RvizVisualToolsGui::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/rviz_visual_tools_gui.dir/src/moc_rviz_visual_tools_gui.cpp.o:moc_rviz_visual_tools_gui.cpp:(.text+0x116): first defined here
collect2: error: ld returned 1 exit status
rviz_visual_tools/CMakeFiles/rviz_visual_tools_gui.dir/build.make:288: recipe for target '/home/robot/catkin_ws/devel/lib/librviz_visual_tools_gui.so' failed
make[2]: *** [/home/robot/catkin_ws/devel/lib/librviz_visual_tools_gui.so] Error 1
CMakeFiles/Makefile2:10283: recipe for target 'rviz_visual_tools/CMakeFiles/rviz_visual_tools_gui.dir/all' failed
make[1]: *** [rviz_visual_tools/CMakeFiles/rviz_visual_tools_gui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 97%] Linking CXX shared library /home/robot/catkin_ws/devel/lib/librviz_visual_tools.so
[ 97%] Built target rviz_visual_tools
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

And i have tried many times, but i did not make it. I use ubuntu 16.04 and ros kinetic.
Looking forward to your advice!

Default constructor is not nodelet friendly

The rviz_visual_tools constructor does not allow the node handle to be passed into the class, rather it initializes the node handle nh_("~") here. When using nodelets, this results in topics being published under an anonymous namespace (which changes every time the nodelet is launched).

I believe the appropriate fix is to allow the node handle to be passed in on construction. When using nodelets, the user should pass in getNodeHandle().

Prompt function does not return a value

RvizVisualTools.prompt calls RemoteControl.waitForNextStep, which calls RemoteControl.rvizDashboardCallback. The prompt function gives no return, so there's no indication that of what the input was from the remote control. rvizDashboardCallback can handle up to four inputs, but waitForNextStep only offers a boolean output, which is then lost in the prompt function.

waitForNextStep and prompt should be modified to propagate the user's desired response in order to correctly handle the interface. There is currently no way to stop an activity using the prompt function - any response simple continues the sequence.

topic can't connect to any subscriber

I was running move_group_interface_tutorial.launch but I got the warn that Topic '/rviz_visual_tools' unable to connect to any subscribers within 0.5 sec. It is possible initially published visual messages will be lost. It is wired since I was able to run this tutorial several days ago and I didn't change any code but just did something about debugging code by using eclipse. Is this because of eclipse?

Issues with axes display functions

@VictorLamoine ,When we use publishAxis() functions to display a large number of items (100 for example), only a few part of the axes will be display. It can randomely be one third or a half of the axes which are going to appear on RViz. For example i just reuse your rviz_visual_tools_demo.cpp code like that :

ROS_INFO_STREAM_NAMED(name_, "Displaying Coordinate Axis");
    pose1.translation().x() = 0;
    y += space_between_rows;
    pose1.translation().y() = y;
    step = 0.025;
    for (double i = 0; i <= 10.0; i += step)
    {
      visual_tools_->publishAxis(pose1);
      if (!i)
        publishLabelHelper(pose1, "Coordinate Axis");

      pose1.translation().x() += step;
      pose1 = pose1 * Eigen::AngleAxisd(step * 2 * M_PI, Eigen::Vector3d::UnitX()) *
              Eigen::AngleAxisd(step * 2 * M_PI, Eigen::Vector3d::UnitY()) *
              Eigen::AngleAxisd(step * 2 * M_PI, Eigen::Vector3d::UnitZ());
    }
    visual_tools_->triggerBatchPublish();

By putting i <= 10.0 i should normally have 400 axes displayed on the screen, but we only have few of them randomly drawn on the screen on the x axis.

Delete marker by Id

@VictorLamoine ,Currently when we call the function deleteAllMarkers(), it remove every markers added in RViz. It would be great to have a function deleteMarkerById(), since we do not want to remove marker drawn on the screen at one time.

Sincerely

No member named trigger in INDIGO?

Hey there,

I have kinetic code that i need to be able to run on indigo.

My code runs completely fine on kinetic but on indigo I got this error:

error: ‘class rviz_visual_tools::RvizVisualTools’ has no member named ‘trigger’
visual_tools_->trigger();

Code Snipped:
rviz_visual_tools::RvizVisualToolsPtr visual_tools_;

Compilation fails on Debian buster, "wrong" use of -Isystem

Compiling on Debian/buster with gcc-8 fails :
[...]
[ 14%] Building CXX object CMakeFiles/rviz_visual_tools_remote_control.dir/src/remote_control.cpp.o
In file included from /usr/include/c++/8/ext/string_conversions.h:41,
from /usr/include/c++/8/bits/basic_string.h:6400,
from /usr/include/c++/8/string:52,
from /home/jkur/dev/ros/ros-testbed/src/rviz_visual_tools/src/remote_control.cpp:40:
/usr/include/c++/8/cstdlib:75:15: fatal error: stdlib.h: Datei oder Verzeichnis nicht gefunden
#include_next <stdlib.h>

A vague search suggest a wrong use of the -Isystem flag with gcc-8 (and gcc-7).

Removing "SYSTEM" from CMakeLists.txt :78

include_directories(include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${OGRE_OV_INCLUDE_DIRS})

fixes this issue for me. I'm unsure if this is a general fix or breaks something elsewhere...

publishLine causes warning "Uninitialized quaternion, assuming identity"

Hi,

when I am doing:

    rviz_visual_tools::RvizVisualToolsPtr visual_tools;
    visual_tools.reset(new rviz_visual_tools::RvizVisualTools(frame_id, rviz_topic_name));
    visual_tools->loadMarkerPub(false, true);
    visual_tools->deleteAllMarkers();
    visual_tools->enableBatchPublishing();

    Eigen::Isometry3d pose1 = Eigen::Isometry3d::Identity();
    Eigen::Isometry3d pose2 = Eigen::Isometry3d::Identity();
    pose1.translation().x() = 1.0;
    pose1.translation().y() = 1.0;
    pose2.translation().x() = 5.0;
    pose2.translation().y() = 5.0;
    visual_tools->publishLine(pose1, pose2, rviz_visual_tools::RAND, rviz_visual_tools::LARGE);
    visual_tools->trigger();

Rviz shows:

Line/1
Uninitialized quaternion, assuming identity. scale.y and scale.z of LINE_LIST or LINE_STRIP are ignored.

However, the line is shown correctly. This also happens using the geometry_msgs::Point variant of publishLine().

Can't change the namespace of path markers

When I use the publishPath() functions, I can't change the namespace of markers and all the path markers shows the default marker namespace cylinder even I explicitly assign another name.
I found here and here caused the problem.
Is this an expected behavior?

Merging rviz_visual_tools and moveit_visual_tools into one unified repo

moveit_visual_tools uses the same parent class RvizVisualTools so would be a good candidate to merge together. I'm trying to reduce the time I spend maintaining and releasing lots of separate repos. The downside to this merge is that by default you will have to bring in lots of moveit dependencies when you do a git clone. The workaround for this group of users will be either to:

  • simply add CATKIN_IGNORE to moveit_visual_tools
  • delete the folder
  • use catkin-tools' blacklist feature

Thoughts?

Note: one of my main motivations for doing this is for practice for a much bigger moveit merge that I've been working on. I've already made the script that will merge the git histories together.

qt5_use_modules missing

I'm getting linker errors with Qt 5.10. adding qt5_use_modules(imarker_simple_demo Widgets) in the CMakeLists.txt fixes the issue.

# Demo executable
add_executable(${PROJECT_NAME}_demo src/${PROJECT_NAME}_demo.cpp)
target_link_libraries(${PROJECT_NAME}_demo
  ${catkin_LIBRARIES} ${PROJECT_NAME}
  )
qt5_use_modules(${PROJECT_NAME}_demo Widgets)

# Demo executable
add_executable(imarker_simple_demo src/imarker_simple_demo.cpp)
target_link_libraries(imarker_simple_demo
  ${catkin_LIBRARIES} ${PROJECT_NAME} ${PROJECT_NAME}_imarker_simple
)
qt5_use_modules(imarker_simple_demo Widgets)

Warnings in test compilation

Lots of them:

/home/victor/code/catkin_workspace/src/rviz_visual_tools/tests/rvt_test.cpp: In member function ‘virtual void RVTTest_test_rpy_conversions_Test::TestBody()’:
/home/victor/code/catkin_workspace/src/rviz_visual_tools/tests/rvt_test.cpp:128:82: warning: ‘static Eigen::Affine3d rviz_visual_tools::RvizVisualTools::convertFromXYZRPY(std::vector<double>)’ is deprecated [-Wdeprecated-declarations]
   Eigen::Affine3d expected_affine2 = base.visual_tools_->convertFromXYZRPY(xyzrpy);
                                                                                  ^

Angular indication on the method publishCone

Hello,

I wanted to ask a question about the angle value of the publishCone(...) method. Does this value have to be specified in radians or angles? I used several values like PI, PI/4 and the angle of the cone always looked wrong.

How do I specify the angle so that my cone has an opening angle of 30° degrees as an example.

Many thanks for the great library :=)

JacobiSVD error

We are writing a new version of our Bezier project that includes a rviz_visual_tools object to publish many useful things.

I get this strange error when running our code:

bezier_application: /usr/include/eigen3/Eigen/src/SVD/JacobiSVD.h:632: const MatrixVType& Eigen::JacobiSVD<MatrixType, QRPreconditioner>::matrixV() const [with _MatrixType = Eigen::Matrix<double, 3, 3>; int QRPreconditioner = 2; Eigen::JacobiSVD<MatrixType, QRPreconditioner>::MatrixVType = Eigen::Matrix<double, 3, 3>; typename _MatrixType::Scalar = double]: Assertion `computeV() && "This JacobiSVD decomposition didn't compute V. Did you ask for it?"' failed.

Pointers / ideas are welcome, I'm not sure if the problem lays in rviz_visual_tools or our package.
I'll try to reduce this to a minimal example.

waitingForSubscribers

Hi,

I want to use waitForSubscribers() in my own source but the publisher (pub_rviz_markers_) is a protected member which should be passed to the function.

Failing Noetic Debian buster build - failed to find stdlib.h

It looks like this package is failing to build on Debian Buster

The error output is a failure to find the C include <stdlib.h>

make[4]: Entering directory '/tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/obj-aarch64-linux-gnu'
[  7%] Building CXX object CMakeFiles/rviz_visual_tools_remote_control.dir/src/remote_control.cpp.o
/usr/lib/ccache/c++  -DQT_NO_KEYWORDS -DROSCONSOLE_BACKEND_LOG4CXX -DROS_BUILD_SHARED_LIBS=1 -DROS_PACKAGE_NAME=\"rviz_visual_tools\" -Drviz_visual_tools_remote_control_EXPORTS -I/tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/obj-aarch64-linux-gnu -I/tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0 -I/tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/obj-aarch64-linux-gnu/rviz_visual_tools_remote_control_autogen/include -isystem /tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/include -isystem /opt/ros/noetic/include -isystem /opt/ros/noetic/share/xmlrpcpp/cmake/../../../include/xmlrpcpp -isystem /usr/include/eigen3 -isystem /usr/include/OGRE/Overlay -isystem /usr/include/OGRE -isystem /usr/share/orocos_kdl/cmake/../../../include  -g -O2 -fdebug-prefix-map=/tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0=. -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC   -W -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Winit-self -Wredundant-decls -Wno-unused-parameter -Wno-unused-function -std=c++11 -o CMakeFiles/rviz_visual_tools_remote_control.dir/src/remote_control.cpp.o -c /tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/src/remote_control.cpp
In file included from /usr/include/c++/8/ext/string_conversions.h:41,
                 from /usr/include/c++/8/bits/basic_string.h:6400,
                 from /usr/include/c++/8/string:52,
                 from /tmp/binarydeb/ros-noetic-rviz-visual-tools-3.9.0/src/remote_control.cpp:40:
/usr/include/c++/8/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.

This might be due to the use of isystem: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129

include_directories(SYSTEM include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${OGRE_OV_INCLUDE_DIRS})

Removing the use of SYSTEM will probably fix the build. Alternatively there might be a way to work around it by setting a couple cmake variables. Lastly, maybe the error would go away if the include is changed to <cstdlib> instead?

change thickness of lines?

I would like to be able to adjust the thickness of the lines drawn for the wireframe cuboid shapes. Is this currently possible? If not how could it be added?

Thanks,
Eric

`generateEmptyPose` suddenly removed

static void generateEmptyPose(geometry_msgs::Pose& pose); was removed in the latest master without deprecating it. This caused a few problems (it was used, for example, in moveit grasps). However, any active projects using the master branch have likely already updated, or are not using the function to begin with, so I am not sure it is worth putting back in.

That said, the sudden removal causes some complications with backwards compatibility, because the replacement static geometry_msgs::Pose getIdentityPose(); did not exist in the preivous release. Therefore, repositories using master will not compile with melodic-devel and vice versa. Perhaps we could add in static geometry_msgs::Pose getIdentityPose(); to melodic-devel, and add a deprecated attribute to generateEmptyPose?

Add ccache support

Just need to turn off the CMAKE_AUTOMOC_COMPILER_PREDEFINES.
Ref : ros-visualization/rviz#1261

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4bb906b..e6cd5b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,7 @@ endif()
 ## etc because they can conflict with boost signals, so define QT_NO_KEYWORDS here.
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF)
 add_definitions(-DQT_NO_KEYWORDS)
 
 catkin_package(

How can I use the lib in a ros project?

Hello, masters. I am a new guy in ros. When I use rviz_visual_tools in my project. There are some errors. I don't know whether my usage is in a right way. PLS guide me. Thanks so much.
screen shot 2018-08-06 at 17 10 22

Save cached markers for later re-publish

Hi, first of thanks for the great tool !

While doing some debugging I was troubled by the fact that after disabling/re-enabling a marker (marker namespace) in Rviz, the marker would not show up again.

It seems that by design the trigger clears the cached markers. Thus calling trigger in a while loop is pointless unless the markers are fed again. I circumvent this the following manner :

bool RvizVisualTools::trigger(const bool keep_cache) // keep_cache is false by default
{
...
if (!keep_cache)
    markers_.markers.clear();  // remove all cached markers
  return result;
}

/* in main */
while (ros::ok())
{
    // Don't forget to trigger the publisher! And save the cache!
    visual_tools_->trigger(true);

    ros::spinOnce();
    rate.sleep();
}

I'd be happy to open a PR, just wanted to check first with you if that was an appropriate design.
Maybe you'd prefer more explicit functions calls like :

visual_tools_->keepCache(true);

// Don't forget to trigger the publisher!
visual_tools_->trigger();

// with helpers
bool cache_keeped = visual_tools_->isKeepingCache();
visual_tools_->clearCache();

Cheers.

demo dosen't have any text

Hello there, I'm on ROS Kinetics and build your file successfully, but when I run below command
roslaunch rviz_visual_tools demo_rviz.launch
roslaunch rviz_visual_tools demo.launch
there is a warning :[ WARN] [1537511480.627642188]: Marker 'Text/27' contains unnormalized quaternions. This warning will only be output once but may be true for others; enable DEBUG messages for ros.rviz.quaternions to see more details.

and RVIZ have the elements in it but text display is not shown.
qq 20180921143810

error: ‘function’ in namespace ‘std’ does not name a template type

Hello guys, I build your code from source successfully, but when I use it in my cpp file
~/catkin_ws/src/rviz_visual_tools/include/rviz_visual_tools/remote_control.h:54:14: error: ‘function’ in namespace ‘std’ does not name a template type
typedef std::function<void(bool)> DisplayWaitingState;
even when I add #include <functional> the error is the same.

RViz: latched topics behaves badly

rviz_visual_tools should (probably) use timestamp 0 for latched topics.
ros-visualization/rviz#494

I currently have a problem where if I start RViz some time after starting my node that publishes a MarkerArray through rviz_visual_tools, the MarkerArray won't show up in RViz because it won't accept the old timestamp.

Compiling Errors

On my first trial to use the library, for ROS Kinetic on Ubuntu 16.04.

Installed using apt - ok
sudo apt-get install ros-kinetic-rviz-visual-tools

Ran Rviz and the demo - ok

roslaunch rviz_visual_tools demo_rviz.launch
roslaunch rviz_visual_tools demo.launch

Then I tried the cpp code, and got error...

Included headers
#include <rviz_visual_tools/rviz_visual_tools.h>

Added code to main():

rviz_visual_tools::RvizVisualToolsPtr visual_tools_;
visual_tools_.reset(new rviz_visual_tools::RvizVisualTools("base_frame","/rviz_visual_markers"));

Got many compile errors:

erro1
erro2

3 ambiguous methods

The 3 publishPath methods, starting at:
https://github.com/PickNikRobotics/rviz_visual_tools/blob/kinetic-devel/include/rviz_visual_tools/rviz_visual_tools.h#L662
have only one mandatory parameter, just like the ones before.

publishPath(const std::vector<geometry_msgs::Point>& path)
publishPath(const EigenSTL::vector_Vector3d& path)
publishPath(const EigenSTL::vector_Affine3d& path)

So if I call any of them with only the first parameter I get an error while compiling:

error: call of overloaded ‘publishPath(std::vector<geometry_msgs::Point_<std::allocator > >&)’ is ambiguous

Could you make the optional parameters mandatory for one set of methods to resolve this ambiguity?

@v4hn

Using Wireframe like Cuboid

Hi!

In my use case I'd like to publish a bounding box of some detected object. The easiest way for me to do this is to specify two corners, which I am able to achieve through this function. However I dont's see alike function for Wireframe, either Cuboid or Rectangle. I know I can use this function, but it seems to work quite differently, because passing (0.0, 0.0, 0.0) as first parameter doesn't do the job... Could you give me a hint as to how to use it?

Thanks in advance!

specifying arrow direction

Eigen::Isometry3d pose1 = Eigen::Isometry3d::Identity();
                            pose1.translation() = p0;
                            visual_tools_->publishArrow(pose1, rvt::GREEN);
                            visual_tools_->trigger();

How do i specify the direction of arrow in this code?

trigger() blocks forever - bug?

Hi,

I am facing the problem that

    ROS_ERROR("FOO");
    visual_tools->trigger();
    ROS_ERROR("BAR");

does not return. Even when Rviz connects, nothing will happen. I don't know if this is related to my issue but note that neither visual_tools->loadMarkerPub(false, true); nor visual_tools->loadMarkerPub(true, true); is working. (I am requiring latched topics.)

Once I comment this block:

  // Check if connected to a subscriber
  if (!pub_rviz_markers_waited_ && !pub_rviz_markers_connected_)
  {
    ROS_DEBUG_STREAM_NAMED(LOGNAME, "Waiting for subscribers before publishing markers...");
    waitForSubscriber(pub_rviz_markers_);

    // Only wait for the publisher once, after that just ignore the lack of connection
    pub_rviz_markers_waited_ = true;
  }

in the implementation of RvizVisualTools::publishMarkers() (invoked by trigger()), it is working fine.

Is this a bug? IMHO, there should be the possibility to skip the waitForSubscriber().

Enhancements in enums

Let's say I have a service to publish a marker with a given color and size.

My service would look like:

Pose where_to_draw
uint32 color
uint32 size
---

The service implementation needs to convert the unsigned int color to a rviz visual tool color; this can be done with

static_cast<rviz_visual_tools::colors>(req.color)

But this results in undefined behavior if req.color is not represented in the enum.
A work-around would be to define something like KEEP_ME_AT_THE_END_ENUM_SIZE to be able to determine if color is in the allowed range. This only works for contingous enums starting from 0.

We would like to avoid a big switch case for each color.

Did you face this issue? How did you solve it? What do you think?

no point type?

Similary like in rviz markers, isn't their any type in rviz_visual_tools which can be used for that points and point lists?
I tried to uyse cube instead of points but after this i can't do anything in rviz i.e it freezes.
But when i use the points of visualization_msgs/marker type and publsih from publishMarker it is not showing the color.

Missing vtable on OSX Build

Hi @davetcoleman ,

I'm trying to compile MoveIt on my OSX machine and running across an error while building rviz_visual_tools, which was required by moveit. It seems like the issue has to do with Qt but I cant put my finger on it. Does this have to do with comment in the package.xml

<!-- Something changed in ROS Lunar / Ubuntu Zesty that requires extra QT5 dependency-->
  <!-- I suspect this depend is more than needed, but was the only dependency available -->
  <!-- from the rosdep list that worked: https://github.com/ros/rosdistro/blob/master/rosdep/base.yaml -->
  <depend>libqt5x11extras5-dev</depend>

My settings:
OSX Sierra 10.12.1
Homebrew 1.5.4
cmake version 3.10.2
Python 3.6.4
Ros Kinetic

I have rosdep'ed my source and all other moveit ros packages build fine. Other qt dependent packages, e.g. ROS-Desktop-Full were successfully built.

Scanning dependencies of target rviz_visual_tools
[100%] Building CXX object rviz_visual_tools/CMakeFiles/rviz_visual_tools.dir/src/rviz_visual_tools.cpp.o
[100%] Building CXX object rviz_visual_tools/CMakeFiles/rviz_visual_tools.dir/src/tf_visual_tools.cpp.o
[100%] Building CXX object rviz_visual_tools/CMakeFiles/rviz_visual_tools.dir/rviz_visual_tools_autogen/mocs_compilation.cpp.o
[100%] Linking CXX shared library /Users/kchintamani/sandbox/moveit_ws/devel/lib/librviz_visual_tools_gui.dylib
Undefined symbols for architecture x86_64:
  "vtable for rviz_visual_tools::RvizVisualToolsGui", referenced from:
      rviz_visual_tools::RvizVisualToolsGui::RvizVisualToolsGui(QWidget*) in rviz_visual_tools_gui.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for rviz_visual_tools::KeyTool", referenced from:
      rviz_visual_tools::KeyTool::KeyTool() in key_tool.cpp.o
      rviz_visual_tools::KeyTool::~KeyTool() in key_tool.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/kchintamani/sandbox/moveit_ws/devel/lib/librviz_visual_tools_gui.dylib] Error 1
make[1]: *** [rviz_visual_tools/CMakeFiles/rviz_visual_tools_gui.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/Users/kchintamani/sandbox/moveit_ws/src/rviz_visual_tools/src/rviz_visual_tools.cpp:56:68: warning:
      suggest braces around initialization of subobject [-Wmissing-braces]
  ...= { RED,        GREEN,  BLUE,   GREY,   DARK_GREY,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
[100%] Linking CXX shared library devel/lib/librviz_visual_tools.dylib
[100%] Built target rviz_visual_tools
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

Any suggestions are welcome

noetic release

Hey,

First of all, thanks for the package, great work!

Can you release the package for noetic?

Thanks in advance,
Tobias

xxx.so: undefined symbol: _ZN17rviz_visual_toolsxxx

Errors during runtime.
code:

xxx.h
#include "rviz_visual_tools/rviz_visual_tools.h"
...
...
rviz_visual_tools::RvizVisualTools* visual_tools_;

xxx.cpp constructor:
visual_tools_ = new rviz_visual_tools::RvizVisualTools(costmap_ros->getBaseFrameID(),"/rviz_visual_markers");
...
...
call visual_tools_:
visual_tools_->publishLine(aPoint,bPoint);

err:
xxx.so: undefined symbol: _ZN17rviz_visual_tools15RvizVisualTools11publishLineERKN13geometry_msgs6Point_ISaIvEEES6_NS_6colorsENS_6scalesE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.