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

Visualizing classified objects/clusters of laserscan in rviz

asked 2014-12-06 07:47:31 -0500

I have written a program to classify my each laser scan to find nearby objects/cluster(and all required information about those clusters) and in subsequent scans (while I am stationary, and world is moving) I am matching the new clusters with the old ones. I need help in visualizing what clusters I am getting. I am trying using MarkerArray to achieve this.

I have all the geometrical features of starting and ending point of different clusters. Now, how I create pose and position features using these physical features? Will giving slope of two points(in Cartesian coordinates) of one cluster as its pose work ?

edit retag flag offensive close merge delete


if geometry of your clusters is lines,yes you can use points or linelist. just publish them is the frame which you have their values.

bvbdort gravatar image bvbdort  ( 2014-12-06 08:33:11 -0500 )edit

I don't have any geometry right now. I just have two extreme points of all the clusters in polar form (lidar as origin) and I can find everything else using this. Can you please tell me how to create a line geometry with given two points. How should I use the published points to get a line?

Akash gravatar image Akash  ( 2014-12-06 08:42:04 -0500 )edit

And, yes, for now I am assuming my cluster to be a straight line connecting the two extreme ends.

Akash gravatar image Akash  ( 2014-12-06 08:44:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-06 09:26:54 -0500

bvbdort gravatar image

updated 2014-12-06 09:35:23 -0500

Line List is to draw lines for you case. Push start and end point of each line to line list variable in order.

It will draw a line between each pair of points, so 0-1, 2-3, 4-5, ...

This puslihing rviz marker lines tutorial is helpful.

    //some code with comments

    //publisher for line list marker
    ros::Publisher marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 10);

   //variable for line list marker    
    visualization_msgs::Marker line_list;

   // frame in which you have cluster coordinates
    line_list.header.frame_id = "/world_frame";  

   //marker type , scale,colour
    line_list.type = visualization_msgs::Marker::LINE_LIST;

   line_list.scale.x = 0.1;

    line_list.color.r = 1.0;
    line_list.color.a = 1.0;

    // assume you have 5 lines 
    for (int  i = 0; i < 5; ++i) 
          geometry_msgs::Point line_start,line_end;

         // fill start and end coordinates 
          line_start.x = sx[i];
          line_start.y = sy[i];
          line_start.z = sz[i];

          line_end.x = ex[i];
          line_end.y = ey[i];
          line_end.z = ez[i];

          // The line list needs two points for each line

        // publish marker
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-12-06 07:47:31 -0500

Seen: 1,231 times

Last updated: Dec 06 '14