Hello folks,
Helping my programmer do a bit of research. How would we go about pulling the period of time between rotations of a flywheel using a photosensor and tape to use with a bang bang in Labview.
Hello folks,
Helping my programmer do a bit of research. How would we go about pulling the period of time between rotations of a flywheel using a photosensor and tape to use with a bang bang in Labview.
what is and where do i find the ‘Dig Scr’ thingy between the DIO open and the COUNTER open
It’s in
WPI Robotics Library -> I/O -> DigitalInput
Mark,
Is the Counter/ConfigTimer (blue arrow) where the FGPA sampling size is configured?
If so, does the “5” (green arrow) mean FPGA sample average is set to 5?
Does Counter/Get (red arrow) return the same thing as the GetPeriod() method in the Counter class in C++ and Java (i.e. period, in seconds, of the tooth count, based on the last 5 samples) ?
Thanks.
In a word, Yes.
The 5 there is just an example for # samples to average.
(For the OP’s programmers, e.g., Bunniy) For example, if you have multiple pieces of reflective tape around the wheel to increase your resolution, then averaging removes any displacement errors in positioning the individual pieces of tape. You know, if the pieces of tape aren’t perfectly spaced, perfectly sized, perfectly oriented. If you just use 1 piece of tape then I’d probably take the LabVIEW default of 1.
That Get wire is the average Period (in seconds) between pulses.
Thank you.
I have a more general LabVIEW question if I may. Before I posted the above question, I tried for about half an hour to find the answer on the internet. Do you (or does anyone reading) know of a site where you could type, say, “Counter Config Timer” into a search box and it would display the LabVIEW help screen for that icon? I had no success with Google.
Thank you mark for telling me that it should be set to 1. No wonder my wheel was spinning so fast!
im still having trouble. my motor keeps spinning as fast as possible even when i set the rpm to even 200.
Show a snippet of the code you’re using.
I may be a little slow responding, I’m shoveling snow.
P.S.
If you don’t know what a number in the example means, ask.
You don’t want the 99 for example, because you only have 1 tick per revolution.
Ether, I don’t know of a site that does that, but the editor will. If you click on search in the palettes, type Counter Config, it will have only one item in the list. Hover and the Context help window will show that item’s help. There is also a function called QuickDrop that some folks just love. You hit Ctl-Space and type some of the name and it does the same sort of list and you click and drop the node. It doesn’t look like the help updates until you drop the node.
Greg McKaskle
So you’re taking the total revs since the last time you checked the counter.
Dividing by a time constant, filtering the result, and applying a slew rate limiter?
I’m not a fan of the Counter reset applied that way. There’s a window to drop counts.
Seems a bit much for flywheel.
Is the slew rate limiter to avoid extended stall time at full power for the flywheel?
P.S. I overlooked that the slew rate is probably bypassed with the False Case.
Is that really 360 counts per revolution?
I thought you only had 1?
I don’t think you want that 60 or 360 applied there, but maybe I haven’t grasped what you are calculating.
Are you trying to read buttons and set a global variable in Begin.vi? It only runs once when the program starts up, and usually isn’t an appropriate place to do I/O actions.
Bunniy,
The first thing I would check is if you are actually getting an RPM reading by placing a “probe” just before the ">= " comparitor. Also, make sure the other input to the comparitor is seeing the desired RPM value.
If you are not seeing either at that point, then you will know where to start digging further.
I would recommend you let the FPGA compute the period in hardware with its 153KHz sampling and 1MHz clock (like Mark showed), instead of doing it in software. There’s no need for the IIR filter if you set the proper size for the FPGA’s sample ring buffer. If you you need to avoid large current spikes at startup (perhaps to prevent Jags from cutting out), try speed-based throttle limiting instead of time-based slew rate. I would avoid using a Jag for bang-bang because of the startup current spike.
When I first saw the code I was surprised at how familiar it looked, then I realized, I posted it last year.
Mark, would replacing the “Reset Counter” with a feedback loop and subtracting the previous count from the current count be a more stable option?
Both the IIR filter and the slew rate limiter were placed in this code as ways to compensate for other issues.
The slew rate limiter really is only needed when using a Jaguar. The current limiting circuit in the Jag can trip if the start up current is too high. If using a Talon or Victor, this entire block of code can be bypassed or completely removed.
Honestly, the IIR filter shouldn’t be used. It introduces lag into the control. I put it in there as a way to smooth out the RPM signal. I believe the main reason the signal was noisy was due to the use of a “wait” loop instead of a timed loop in the original version. In addition, we were using “Get Rate” in the original version. “Get Rate” is an instantaneous measurement that is inherently noisy. This version uses a count divided by time to determine RPM, which is a much cleaner approach. This filter can be bypassed by setting the filter strength to “0”, or just deleting that section of code.
The “360” is the number of ticks per revolution of the encoder it was designed to be used with. If the encoder is just a couple of lines on a wheel and an optical sensor, the this value needs to reflect the number of lines.
Bang-Bang is a simple control system. A comparison of the current RPM to the desired RPM. If the current is at or above the desired value, then turn off the motor. If it is below, turn the motor on at full power. Anything else in the loop just clutters the process.
my buttons are in teleop and send the numeric values to the global variable which is then sent to the bang bang controller in the periodic tasks.I downloaded the bang bang and did not change it except for the global variable. Now i dont know what most of the numbers mean but tell me what you think i shouild change.
P.S. sorry for my little kid posts and all, i just got my license yesterday, and a flat the same day, lost and found our pneumatic wheel at homedepot, and had a long day of course
Start by replacing the “360” in the left side of the periodic tasks with the number of counts you will have from a single rotation of the wheel.
Make sure the filter level is set to “0”, and lastly that the Boolean for the slew rate filter is set to “False”.
Does your Begine.vi have the correct configurations for the counter? (That was also included in the .zip version of the Bang-Bang control. The separate versions of the Bang_Bang I uploaded just added extra features.) If it is not there, then you will not be getting any input to the control and it will always be full on.