![]() |
Parallax PING))) Java Coding
Our team bought the Ping))) sensor for distance sensing. As per this forum post, we could use a PWM Y-cable to connect it to the digital sidecar. How do we code this in Java? I believe that the WPILib Ultrasonic class is meant for those sensors with an input and output.
The Ping))) has a built-in SX microcontroller with the job of generating the pulse and patiently waiting for that pulse to make it's way back. It then sends back a pulse, with a width that translates into the distance, by the multiplication of a specific constant, 2260 for centimeters and 890 for inches. Note that the time units are in microseconds. How do I send 30 microsecond pulse to a digital output and read back the input pulse, probably from a different pin if I use the Y-cable method? |
Re: Parallax PING))) Java Coding
Code:
DigitalOutput.set(true); //Needs to be a properly constructed DigitalOutput object. |
Re: Parallax PING))) Java Coding
Quote:
Also, you'd need to run this loop really quickly to capture the pulse. If you're one inch away, your pulse is less than a millisecond away. It's possible to miss pulses entirely. You really should use interrupts for this, or you should just add an arduino board that communicates with the cRIO with serial. I bet somebody has written an arduino library for this sensor. Also, your timing method doesn't seem to compare the two FPGA timestamps to find the duration of the pulse. I don't think your two while loops will work the way you'd like them to. |
Re: Parallax PING))) Java Coding
Quote:
Quote:
|
Re: Parallax PING))) Java Coding
Quote:
Quote:
It is a good starting point and I am happy that you shared this. We are pressed for time in our team and we just got a bot ready to program using. That means that our programming team is heavily behind at this moment. I am considering telling my team not to waste time on sonar. I am already able to make vision systems that are able to mimmic this functionality, but without the main issues such as range, accuracy and constant calibration. This sensor is also quite slow, not fast enough for powering automated movement. The main use for this is obstacle detection while moving when video stabilization is not enough to remove the motion blur. |
| All times are GMT -5. The time now is 02:40. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi