ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Chris L's profile - activity

2015-08-07 08:06:27 -0500 answered a question Ros + openstreetmap (osm cartography package)

That package comes with a demo launch file (source) which starts the visualization, and you could start from there.

2015-07-24 01:26:50 -0500 received badge  Famous Question (source)
2014-08-01 04:25:47 -0500 received badge  Notable Question (source)
2014-06-10 11:07:12 -0500 received badge  Popular Question (source)
2014-06-07 09:49:43 -0500 asked a question Using selection in rviz plugin

My aim is to use the select plugin from RVIZ to interactively select and modify the characteristics of the point cloud (such as RGB values etc). The select tool in RVIZ shows all the selected points (in the selection panel) when a certain region is highlighted. I would like to access those points and change their properties.

I have used the following plugin already present on ROS board (comment of the last question): http://answers.ros.org/question/99796...

The problem is that I am unable to access the points which RVIZ selection panel shows once a specific region in a point cloud is highlighted. I have tried accessing the rviz::PropertyTreeModel in rviz::SelectionManager; however the rowcount is zero, hence the rviz::PropertyTreeModel does not seem to have any children which i find very weird.

Going through the source code of RVIZ selection manager (and selection panel) it seems that all the information is stored in the rviz::PropertyTreeModel.

Additionally I have tried to access the getSelection() method in the selection manager that returns rviz::M_Picked; however, when i try to iterate over the boost::unorderedmap I get a segmentation fault (which I am currently trying to debug).

I will be thankful if someone can point me in the right direction. Kindly inform me if I am doing something wrong or if I am overlooking any specific aspect.

I have mentioned the code below (it's the same as this code on github -- i would like to thank Philipp Bartels for posting this code). The SelectedPointsTopic class mentioned below inherits from the SelectionTool class which is derived from the Tool class:

int SelectedPointsTopic::processMouseEvent( rviz::ViewportMouseEvent& event )
{
 int flags = rviz::SelectionTool::processMouseEvent( event );


 // determine current selection mode
 if( event.alt() )
 {
   selecting_ = false;
 }
 else
 {
   if( event.leftDown() )
   {
     selecting_ = true;
   }
 }

 if( selecting_ )
 {
   if( event.leftUp() )
   {

     rviz::SelectionManager* sel_manager = context_->getSelectionManager();
     const rviz::M_Picked& selection = sel_manager->getSelection();
     rviz::PropertyTreeModel *model = sel_manager->getPropertyModel();

     int num_points = model->rowCount();

     std::cout << " Selection size: " << selection.size() <<std::endl;
     std::cout << " Point size: " << num_points <<std::endl;

     //BOOST_FOREACH(rviz::M_Picked::value_type i, selection){
     //   std::cout << i.second.pixel_count << " " <<std::endl;
     //}


     if( num_points <= 0 )
     {
       return flags;
     }

     sensor_msgs::PointCloud2 msg_pc;
     msg_pc.header.frame_id = context_->getFixedFrame().toStdString();
     msg_pc.height = 1;
     msg_pc.width = num_points;
     msg_pc.point_step = 3 * 4;
     msg_pc.row_step = num_points * msg_pc.point_step;
     msg_pc.is_dense = false;
     msg_pc.is_bigendian = false;

     msg_pc.data.resize( msg_pc.row_step );
     msg_pc.fields.resize( 3 );

     msg_pc.fields[0].name = "x";
     msg_pc.fields[0].offset = 0;
     msg_pc.fields[0].datatype = sensor_msgs::PointField::FLOAT32;
     msg_pc.fields[0].count = 1;

     msg_pc.fields[1].name = "y";
     msg_pc.fields[1].offset = 4;
     msg_pc.fields[1].datatype = sensor_msgs::PointField::FLOAT32;
     msg_pc.fields[1].count = 1;

     msg_pc.fields[2].name = "z";
     msg_pc.fields[2].offset = 8;
     msg_pc.fields[2].datatype = sensor_msgs::PointField::FLOAT32;
     msg_pc.fields[2].count = 1;

     for( int i = 0; i < num_points; i++ )
     {
       QModelIndex child_index = model->index( i, 0 );
       rviz::Property* child = model->getProp( child_index );
       rviz::VectorProperty* subchild = (rviz::VectorProperty*) child->childAt( 0 );
       Ogre::Vector3 vec = subchild->getVector();

       uint8_t* ptr = &msg_pc.data[0] + i ...
(more)
2012-07-30 15:43:40 -0500 received badge  Enlightened (source)
2012-07-30 15:43:40 -0500 received badge  Good Answer (source)
2012-03-03 04:25:08 -0500 received badge  Nice Answer (source)
2012-03-03 02:36:49 -0500 received badge  Teacher (source)
2012-03-03 00:38:08 -0500 answered a question Is rosdoc exist in electric?

I'm on diamondback, and there I usually run rosdoc with rosrun rosdoc rosdoc, since rosdoc itself is not in the path the way rosmake etc. is. I hope this applies for electric as well.

2012-02-29 19:59:33 -0500 received badge  Supporter (source)