0
$\begingroup$

Rosanswers logo

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.


Originally posted by nanaky on ROS Answers with karma: 23 on 2014-02-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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).


Originally posted by ahendrix with karma: 47576 on 2014-02-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by nanaky on 2014-02-15:
Ok, thank you very much, I missed that as I got the "template" from the LaserScan tutorial. That makes much more sense.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.