Author
Topic: WebbotLib / Axon / Sharp GP2D12 (Read 1417 times)

I am having a problem with my Sharp GP2D12. I have it connected to my Axon and I'm using webbotlib with it. I built the base of the program using Project Designer and webbotlib 2.02. The problem is that my sensor is outputting the same value no matter what the range is.

I'm using the following code in my main loop. I'm working on a app for working with the robot so I removed all the locomotion code while I get the basics sensor readings set up.

return 20;//us delayWhen I watch the sensor values, I only see the sharp being listed as '65535 '. If I use %d instead of %u, then I see -1.

I know the rail is fine, I have a sonar sensor on it that is working fine. I believe the Sharp should be working fine as well, I have gotten proper data from it in the past. Additionally, I tried another sharp ir sensor in its place and the reported values were the same. According to the webbotlib documentation and the example.txt file that is generated by the project designer, I am using the variables correctly.

(65535 cm)-165535{'imu': {'gyro': {'x': -1,'y': 0,'z': 0},'accel': {'x': 62,'y': -3,'z': 1009},'yaw': 198,'pitch': 20,'roll': 353},'sharp': 65535,'sonar': 108,'gps': {}};I also did a test with out the sonar, but that didn't change the output of the ir sensor. Removing the large rprintf results in the same values for the ir sensor.