![]() |
Re: Photosensor as encoder for bang bang.
Quote:
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. |
Re: Photosensor as encoder for bang bang.
Quote:
|
Re: Photosensor as encoder for bang bang.
Quote:
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. |
Re: Photosensor as encoder for bang bang.
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 :P |
Re: Photosensor as encoder for bang bang.
Quote:
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. |
Re: Photosensor as encoder for bang bang.
Quote:
You do have to be aware of how high the Counter can count and provide for wraparound if resolution makes that a potential problem. Counter Reset can be used when the shooter is turned off or first turned on, i.e., before or after the count integrity matters. Also, it should be made clear that a crude filter and a loss of resolution is being applied by converting the Counter to RPMs before doing the tests. My preference is to do all processing and comparisons in native units and only convert to RPMs for the human display. Bunniy, your Counter initialization in Begin.vi looks fine. See, you get your license and immediately you're doing errands.:) |
Re: Photosensor as encoder for bang bang.
The OP didn't mention the shooter speed(s) or the execution rate. So I'll pick some numbers. At 4500 rpm true wheel speed, sampling the counts of a one-per-rev sensor at a 20ms rate will give you 1 count 50% of the time and 2 counts 50% of the time. So if you compute speed by dividing counts by elapsed time, your measured rpm will be 3000 half the time and 6000 the other half, and that's assuming perfect 20ms scheduling of your control algorithm. That's a lot of noise. I wonder if the shooter inertia would be large enough to allow bang-bang to work with a signal like that. Maybe some inquisitive team will try it and report their results. If it doesn't work, let the FPGA do the sampling (at 153KHz) and timing (with its 1MHz timer). You'll see +/-3 rpm, and your 20ms scheduling doesn't need to be tightly held. |
Re: Photosensor as encoder for bang bang.
Thank you. That seems to have helped. Also i am using a pneumatic wheel and a painted a small white line of paint about 1/3 of an inch in diameter. Should i make it bigger. I am looking at my rpm calculator and it was only showing me 30 at full power. My thought is that it is not registering fast enough. Any suggestions?
|
Re: Photosensor as encoder for bang bang.
where exactly is the FPGA and what does that mean
|
Re: Photosensor as encoder for bang bang.
Quote:
FPGA stands for Field Programmable Gate Array. You can Google it for all the hairy details if you like. In a nutshell, it's a programmable piece of hardware that is in the cRIO (separate from the CPU that is running your program). The FPGA processes all the digital signals coming into the DSC. It polls those signals at 153KHz and has a 1MHz timer to timestamp events (like ticks from a sensor). The FPGA makes its information available to your program running in the cRIO CPU. It relieves the CPU from having to do the high-speed polling. |
Re: Photosensor as encoder for bang bang.
1 Attachment(s)
Ether means get the Period the way I showed how earlier.
That comes from the FPGA which is the chip that processes all the inputs and outputs on the cRIO. FPGA stands for Field Programmable Gate Array. P.S. Boy am I slow today. But I did just finish moving 1500 cubic feet of snow, shovel-full by shovel-full. |
Re: Photosensor as encoder for bang bang.
3 Attachment(s)
I still have no luck. Here are is my current project. I have the rpm value sent to my driver station which is named "Cim". Like i said i just have an photosensor and a little piece of the wheel white. It always runs at full speed when i press different desired RPM values. I dont know if it is a problem with the begin or even my global variable. Please look over it for me
|
Re: Photosensor as encoder for bang bang.
3 Attachment(s)
Mark,
I created a "Count only" version of the Bang-Bang control. Does this look correct? If so, I'll add it to my "White Paper" options. The only modifications needed are to replace the counter and motor names with the actual names. If actual RPM is needed, that can be added here or elsewhere. I also put a version together that uses the period approach you described earlier. |
Re: Photosensor as encoder for bang bang.
so i have tried to use it and i pluged in the Photosensor to the FPGA which is the card on the Crio. Now in the begin do i have to set it up a certain way or something? Because i tried using the robot with your new code and it is not even spinning the motor now
|
Re: Photosensor as encoder for bang bang.
Quote:
|
| All times are GMT -5. The time now is 22:48. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi