Ask Your Question

Using IR Sensors in Navigation

asked 2014-02-15 13:04:11 -0500

nanaky gravatar image

updated 2016-10-24 09:00:14 -0500

ngrennan gravatar image

Hi everyone

I am using a Khepera III robot which happens to use TCRT5000 IR sensors.

I am trying to use ROS navigation package, but I don't know how to make the LaserScan message from the IR (which as far as I understand is possible).

The IR lectures are more or less 3900 when an object is close to the sensor and more or less 100 when it is at 10 cm (4 inches). I have a function that, given the IR lecture, returns how far in meters is the object.

I am going to use 6 IR sensors (the ones in the front and the ones in the side).

How does this look to you?

sensor_msgs::LaserScan scan;
scan.header.stamp = ros::Time::now();
scan.header.frame_id = "laser_frame";

scan.angle_min = -1.57;
scan.angle_max = 1.57;
scan.angle_increment = 3.14 / 5;//six is the number of sensors

scan.time_increment = (1 / 10) / (5); //assuming that we have 6 IR sensors and we want to make ten scans with the six sensors, would this be correct? (The time between the sensors measures is 3ms, but I only want to make a full scan ten times per second).

scan.range_min = 0.0;
scan.range_max = 0.1;

scan.ranges.resize(6);//six is the number of sensors.

//Now, the IR measures:

scan.ranges[0]= infrared_left; //left sensor info (in meters)
scan.ranges[1]= infrared_front_side_left; //front side left sensor info (in meters)
scan.ranges[2]= infrared_front_left; //front left sensor info (in meters)
scan.ranges[3]= infrared_front_right;
scan.ranges[4]= infrared_front_side_right; 
scan.ranges[5]= infrared_right;

I really don't know what to do with the scan.time_increment, or if I have to do something with the intensities array ( I suppose that nothing, but I have to ask).

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-15 15:34:26 -0500

ahendrix gravatar image

Looking at the documentation for the LaserScan message, it looks like the time_increment value should be used for the time between measurements within a scan (in you case 3ms), and the scan_time should be set to the time between scans (in your case 100ms for a 10Hz scan rate).

edit flag offensive delete link more


Ok, thank you very much, I missed that as I got the "template" from the LaserScan tutorial. That makes much more sense.

nanaky gravatar image nanaky  ( 2014-02-15 15:52:10 -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: 2014-02-15 13:04:11 -0500

Seen: 446 times

Last updated: Feb 15 '14