Reading the IR Sensor Data
jacobh2299 opened this issue · 4 comments
Hello! I am working with a research lab that has manufactured 5 of your Hero 2.6 robots. We seem to have run into a few issues when it comes to running the example code that you have provided in your github. While trying to run the random.launch python script, our robot only rotates clock-wise. I have a few screenshots of the rostopic laser that was provided of our IRs while uncovered and while covered. Our understanding is that the IRs should be defaulted to 0.5, but it appears that they are not defaulting to that very well. The first image is of the IRs uncovered, while the second image is of the IRs covered.
If you could help us understand what we are looking at in the laser rostopic or help explain the random.launch script that you had written I think it would help our debugging process run a bit quicker:
Note that we changed the python script for random.launch to use python3 as we were getting errors regarding Yaml while only using Python 2.x. Changing to python3 resolved the crash issue, but the bot still only rotates clock-wise while running the script.
Thanks!
University of Utah Research Team
Hey @jacobh2299,
Sorry again for the late reply.
It seems to me that the laser is not working properly. In the second figure, the ranges field should be a value close to range_min. The ranges field contains the distance (in meters) for 16 IR sensors. We interpolate these 16 IR sensors (blue) from the 8 real IR sensors (red) on the robot. The field intensities are the light intensity (0-1023) received by the photodiode minus the ambient light intensity. That is, it would be the intensity of light returned after reflecting on an object. The correspondence IR sensor and the position in the robot are given in the following.
This is a video of expected behavior.
out.mp4
In your case, it may be a problem due to a lack of calibration or hardware failure. Please, test the two procedures below and let me know if they worked for you.
Calibration
To calibrate the 8 IR sensors, use the launch file hero_confmode.launch
, and the ros service /hero_*/ir_calibration
.
The calibration process is done as follows:
- place an object (preferably white color) at a known distance (d) from one of the IR sensors you want to calibrate;
- Use the laser topic
rostopic echo \hero_*\laser
to see the intensity for that sensor; - The calibration parameter is obtained by the equation (intensity) * d^2.
- Repeat this procedure for all sensors and save these 8 values;
- With the 8 calibration values in hand, run the calibration service:
rosservice call /hero_*/ir_calibration "{IR0: 0.39, IR1: 0.28, IR2: 0.45, IR3: 0.29, IR4: 0.52, IR5: 0.22, IR6: 0.23, IR7: 0.28}"
I am still improving this process and the following is an alternative.
You must place 8 objects at the same distance from the 8 IR sensors.
I created a 3d printer part to help with this setup.
After placing the objects, run the script:
rosrun hero_examples hero_ir_calib.py hero_*
This is a video showing how to execute this script.
out2.mp4
IR Sensor Test
If you still don't have any luck, proceed with this process to see if everything is ok with the hardware. Try burning the RangeSensor firmware, and check the output for consistency. Maybe it has an IR sensor soldered upside down.
This is a video showing how to proceed with this test.
out3.mp4
Please let me know if everything works out.
I'm still trying to refine and automate this sensor and actuator calibration step.
As soon as I finish this, I will update the tutorial.
Edit 1.0
I just committed some files in the noetic-devel repository. If you find some scripts missing, try to sync with this current commit.
Best,
Rezeck
Thank you for such a detailed reply! I found your commits in the noetic-devel branch and downloaded the new hero_ir_calib.py file. It seems to be running properly on our end, but our values displayed from rostopic laser still appear to not be calibrated (likely because we do not have well measured distances when calibrating). I am currently 3D printing the part you made to assist in calibration and will update this post when completed.
Thanks again
Jacob, University of Utah Drew Research Lab (DRL) Swarm Robotics
Edit: 1.0
A quick question about the IR sensors direction between the version 2.5 and 2.6 boards. It appears that between board versions you have chosen to flip the IR directions, is this true? We are trying to calibrate using the ir_calibration service but our values are not changing after completing the command. We are receiving the message: "IR Calibration parameters has been successfully recorded!" but the values displayed in topic laser remain negative.
It might be important to note that at one point, the IRs were facing left as the 2.5 board, but we had assumed this was an error in transition so we flipped them to match the board schematic. It could be possible that all of our IRs were damaged while running the bots when they were flipped in the wrong direction (That is assuming they are currently in the wrong direction). Below are images of your 2.5 board and our 2.6 board, as well as an image of our hero_3 bot IR intensities values while not near any walls or surfaces.
Hey @jacobh2299 ,
Yes, the IR positions between version 2.5 and >= 2.6 are different. This is because there is a design error in board version 2.5. To (temporally) fix it, I have to flip the TCRT5000 and also the IR and phototransistor inside the plastic case. Anyway, I definitely suggest NOT using version 2.5. I will put this warning in the tutorial.
Since you are using board version 2.6, this problem has been fixed. So I think the way you placed the TCRT5000 (as shown in your figure) is correct.
When soldering the TCRT flipped in version 2.6, it may probably burn the IR. You can check the IR using the cellphone camera (with no IR filter) or a webcam. It should blink a purple light. To test the phototransistor, try putting the multimeter (DC voltage 0-5V) as in the figure.
Cover and uncover the phototransistor. If the voltage consistently changes, it should work fine. Anyway, if you have another TCRT5000, try to replace one of them and test it.
Let me know if you find something or if you have more questions.
Best,
Rezeck