FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Trigger Modes for Counter VIs

Solved!
Go to solution

My team is trying to use the AS5030 magnetic encoder from austiamicrosystems to measure the RPM of the wheel used in our ball launcher. The encoder outputs a sawtooth wave between 0 and 5V when running at low speeds. At higher speeds, the voltage range of the sawtooth wave is diminished due to the RC time constant decay (100 ms response time). We are interested in measuring RPMs up to 4000.

To handle the RC time constant decay, we configured an analog trigger, whose window is hit even at high speeds, and specified that analog trigger as the source for the counter. I'm looking for some clarification as to the analog trigger modes supported by the Counter Open VI that is part of the WPI Robotics Library.  I am able to get the counter to detect pulses when the analog trigger mode is set to "TriggerState".  However, I am not able to get the counter to detect pulses with the analog trigger mode is set to "Rising" or "Falling". What is the definition of "Rising" and "Falling" in this context?

I have also noticed that the Counter Get VI returns true for "Stopped" always but appears to also return valid output for the "Period". I realize that the counter will return stopped if pulses are not generated for a certain period of time, but does it continue to output stopped even after pulses are being generated?

Finally, is this application within the capabilities of the cRIO FPGA (I assume the WPI Robotics Library implements this functionality in the FPGA)?

I realize that using an optical encoder may be easier, but we've had mechanical issues with them in the past and we wanted to try an alternative solution.  I've attached an example VI to show how the trigger and counter are configured.

Thanks for any insights anyone can provide!

geoff

Geoff Schmit

FRC Team 3061

Huskie Robotics

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 1 of 5
(8,457 Views)
Solution
Accepted by topic author gcs

gcs wrote:

To handle the RC time constant decay, we configured an analog trigger, whose window is hit even at high speeds, and specified that analog trigger as the source for the counter. I'm looking for some clarification as to the analog trigger modes supported by the Counter Open VI that is part of the WPI Robotics Library.  I am able to get the counter to detect pulses when the analog trigger mode is set to "TriggerState".  However, I am not able to get the counter to detect pulses with the analog trigger mode is set to "Rising" or "Falling". What is the definition of "Rising" and "Falling" in this context?

The rising and falling triggers refer to very sharp transitions completely skipping the "center" of the analog trigger.  The RC filter on the 5030 is too slow for this to detect properly without slowing down the sampling rate on the analog input module.  However, slowing down the sampling rate means you risk missing the high speed signals you get at high RPM.  Using the Rising and Falling outputs is probably not the best approach for this particular sensor.  It's better for things like continuous turn pots where there is very limited capacitance and the edges are much sharper on roll-over.

gcs wrote:

I have also noticed that the Counter Get VI returns true for "Stopped" always but appears to also return valid output for the "Period". I realize that the counter will return stopped if pulses are not generated for a certain period of time, but does it continue to output stopped even after pulses are being generated?

That's a bit surprising.  The stopped output is based on the "Max Period" set by the "Configure Timer" VI.  Any period longer than this value will report stopped.  Perhaps it is stopped a lot of the time because you are periodically not generating any triggers (i.e. your analog trigger is not always catching the edges).

gcs wrote:

Finally, is this application within the capabilities of the cRIO FPGA (I assume the WPI Robotics Library implements this functionality in the FPGA)?

It is implemented in the FPGA.  It is certainly close to the intended use case.  However due to the RC filter on the board, it will be difficult to track high speeds with that output.  I recommend doing almost the same thing you are now, with the exception of using the SIN or COS output on the 5030 instead of the RC filtered output.  This signal will easily work with the analog trigger and drive the counter reliably.  Remember that there is a solder bridge you must make on the board to enable the SIN and COS outputs.  You can then simply use the Trigger State output as you are now.

Cheers!

-Joe

Message 2 of 5
(4,013 Views)

Thanks for the details! We will try your suggestions tomorrow.

I'll double check the Counter Get VI's behavior regarding the "Stopped" output. I expected it to return true as first since the wheels aren't turning. However, once the wheels started turning, I expected the "Stopped" output to be false instead of remaining true.

Thanks again!

geoff

Geoff Schmit

FRC Team 3061

Huskie Robotics

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 3 of 5
(4,013 Views)

We have modified the 5030 to enable the SIN output. It is working quite well and we have verified its accuracy with external instrumentation.

I asked the student again and he says that the "Stopped" output of the Counter Get VI is working as expected. I must have been mistaken or we didn't have something configured correctly previously.

Thanks for your help!

geoff

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 4 of 5
(4,013 Views)

Attached is the modfied example that we used to test the SIN output mode of the 5030. It shows how to configure the analog trigger and the counter. I don't believe that the PID is tuned in this version, but that woudl be unqiue to your particular situations anyway.

geoff

--
Geoff Schmit
Huskie Robotics, FIRST Team 3061 Lead Mentor
http://team3061.org/
@team3061
0 Kudos
Message 5 of 5
(4,013 Views)