Pololu Distance Sensor

Any reviews of this sensor? I feel like I’ve heard nothing about it from teams. Pololu Distance Sensor with Pulse Width Output.

2 Likes

I’m assuming it would be coded as a counter in semi-period mode. Counters — FIRST Robotics Competition documentation

I hadn’t actually seen these before from Pololu, pulse output is great! It feeds all the info needed (the distance) and only needs three wires including power. Its hard to tell from the docs, but if the pulse period is the same, you could probably even wire it up to a SPARK MAX top port and read it over CAN.

And they have a set of pure digital ones too, neat!

Only down side is the pinout is cursed. Make sure nobody tries to solder a PWM cable directly to it.

For the roboRIO, assuming the period T is fixed, semi-period mode is right. Here is a Java example for a similar sensor, would just need a different conversion factor.

Actually, it looks like the digital ones are the same product! There are 4 solderable jumpers that allow you to configure the product between PWM and digital and for different detection distances.

Is there an advantage to using a Counter in semi-period over the DutyCycle class?

Hadn’t noticed the DutyCycle class before (not a programmer). I only found Counter by searching for ways to read a digital input. I would imagine that DutyCycle could be a better choice. Either way, you’re going to convert the time the signal is high into the corresponding distance.

I can’t think of any real advantage between the counter and duty cycle, and it looks like duty cycle would work just fine. There’s a int getHighTimeNanoseconds() method. Technically it allocates more resources on the RIO, since it also allocates an Analog trigger to handle roll overs, but practically that doesn’t matter.

There are some other feature differences between them like averaging, but I don’t know that its useful for this application. I believe they both have methods to detect if the sensor is present or not.

The DutyCycle class has a much easier to understand API, so that could be an advantage. Though if you look at the code I posted before, the counter is not hard to create a wrapper for.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.