Robotics StackExchange | Archived questions

How to display laser scan data from Kinect

Hi everyone,

can someone help me with printing out laser scan data? for example scan->ranges[i]

void Process_Scan(const sensor_msgs::LaserScan::ConstPtr& scan){

    for(unsigned int i = 0; scan->ranges.size(); i++){

    }


}

Asked by Vinh K on 2016-07-12 11:06:53 UTC

Comments

Ok, I'm not sure why you are facing this problem... anyway haven't you tried this line?

ROS_INFO_STREAM(scan->ranges[i]);

Asked by Arwen on 2016-07-13 01:02:23 UTC

occasionally there is 0 and I was hoping it would detect obstacles in front of the kinect sensor. Correct me if I am wrong Arwen.

Asked by Vinh K on 2016-07-13 08:13:42 UTC

You can visualize your laser scan data using RVIZ but just by looking at the data you can't tell whether it contains the information you want.

Asked by Arwen on 2016-07-13 08:53:47 UTC

also Arwen, I was hoping that I can use this for measure distance to obstacle but the datas are strange for distance detection.

Asked by Vinh K on 2016-07-13 09:00:26 UTC

I don't fully understand your problem. The laser scan data are in the polar coordinate system, if you are not familiar with that you can look it up in the internet and the data stored in the ranges array are distance in meters. Can you add a screenshot of your RVIZ screen displaying laser data?

Asked by Arwen on 2016-07-13 09:34:12 UTC

okay, i will do that

Asked by Vinh K on 2016-07-13 09:51:21 UTC

Answers