How to display laser scan data from Kinect

asked 2016-07-12 11:06:53 -0500

Vinh K gravatar image

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++){


edit retag flag offensive close merge delete


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

Arwen gravatar imageArwen ( 2016-07-13 01:02:23 -0500 )edit

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.

Vinh K gravatar imageVinh K ( 2016-07-13 08:13:42 -0500 )edit

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.

Arwen gravatar imageArwen ( 2016-07-13 08:53:47 -0500 )edit

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

Vinh K gravatar imageVinh K ( 2016-07-13 09:00:26 -0500 )edit

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?

Arwen gravatar imageArwen ( 2016-07-13 09:34:12 -0500 )edit

okay, i will do that

Vinh K gravatar imageVinh K ( 2016-07-13 09:51:21 -0500 )edit