Ask Your Question

interactively access to laser point in rviz

asked 2012-01-29 10:42:06 -0500

Eddit gravatar image

Dear all,

I have a question regarding the rviz and accessing to the laser scan points information in it. I want to select points interactively in the laser scans in rviz and automatically select those points location in to the file?! is there a way to do it ?

Bests, Eddi

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2012-02-15 23:05:02 -0500

TomTUM gravatar image

I once did a dirty hack in rviz to republish the selected points, this was done in a hurry and not well. So what I did was : I hooked into the updateProperties method of the SelectionHandle rviz/src/selection/selection_handler.cpp. I felt this should be called everytime the selection changes. You can then iterate over the bounding boxes and will get the center coordinates of the selected points in the currently set fixed_frame. As I said, it's dirty, doesn't get you RGB but only XYZ, but maybe it's of help for you.

A cleaner way would be to create Interactive Markers to select and area and then in an external node that gets the coordinates of the markes and the scan in, cut out the points yourself and republish/save them. Of course this will be hard if you want to add/remove from the selection with modifier keys, therefor i also hope we will one day get a feature like this built into rviz.

int publish_counter = 0;

void SelectionHandler::updateProperties()
  V_Property::iterator it = properties_.begin();
  V_Property::iterator end = properties_.end();

  for (; it != end; ++it)

  ROS_INFO("boxes LENGTH %i", boxes_.size());
  M_HandleToBox::iterator iit = boxes_.begin();
  M_HandleToBox::iterator iend = boxes_.end();


  // you dont want to take each update since updateProperties seems to be called at each frame 
  if (publish_counter % 20 == 0)
     std::vector<Ogre::Vector3> pts;
     for (; iit != iend; ++iit)
       Ogre::WireBoundingBox *box = (*iit).second.second;
       Ogre::AxisAlignedBox aabb = box->getBoundingBox();
       Ogre::Vector3 center = aabb.getCenter();
       // here we get the Points, the coordinate system differs between ogre and ros:
       //ROS_INFO("CENTER: %f %f %f", -center.z, -center.x, center.y); 
     //I made a little class SelectionPublisher that would convert to a
     // PointCloud2 MSG and publish it, took it out here
edit flag offensive delete link more


I appreciate your answer. I believe your solution is the best at the current rviz setup. Thank you

Eddit gravatar image Eddit  ( 2012-02-16 10:17:42 -0500 )edit

answered 2012-01-31 02:55:01 -0500

Mac gravatar image

It might be possible to use interactive markers to draw the scan endpoints yourself, and then record which ones you interacted with.

This will be quite painful.

edit flag offensive delete link more

answered 2012-01-31 02:33:26 -0500

joq gravatar image

I doubt it.

edit flag offensive delete link more


It seems like a reasonable request. You could open an enhancement ticket for rviz. For quicker results, you might want to attach a patch to the ticket, if possible.

joq gravatar image joq  ( 2012-02-15 12:56:45 -0500 )edit

answered 2012-02-15 10:45:33 -0500

Eddit gravatar image

Thank you for your answer. Yes the problem is when you are using the select option in rviz you only can select the points and they are shown on the right bottom window however there is no option to save them to file?!

I appreciate your help if you have any idea to do it.

edit flag offensive delete link more


Hello, we wrote a plugin, as there is no such feature in RVIZ. It provides a new tool that inherits all features of the default 'select' tool and additionally publishes all selected points on the ros topic '/selected_points'. It can be found at: Best, phil

pBartels gravatar image pBartels  ( 2013-11-25 00:39:01 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-01-29 10:42:06 -0500

Seen: 1,175 times

Last updated: Feb 15 '12