![]() |
Re: Magnetic Sensor
2 Attachment(s)
Inf would be because you're getting 0 for the period. Try setting the MaxPeriod to something reasonable. gts.SetMaxPeriod(0.25) or so. The counter class clears out the buffer if it doesn't see a pulse in within MaxPeriod seconds, and I don't know what the default is. Past that, I made my own class that did a little filtering of values so I'd ignore values I knew were bad. I've attached the files, you can try using it. You'd just need to modify "prevResult = 60.0 / period;" to read "prevResult = 10.0 / period;" And you'd want to reduce periodThreshold in the .h file to something like 1e-3 just so it doesn't limit the max RPM to something less that what you can actually output. It's set up so you can use it as a PIDSource for a PIDController.
|
Re: Magnetic Sensor
i changed :
Code:
m_counter->writeTimerConfig_AverageSize(6, &localStatus);Code:
m_counter->writeTimerConfig_AverageSize(1, &localStatus);Edit: consistent rpm of 247 rpm when i do Code:
talon.Set(.1); |
Re: Magnetic Sensor
Does it looks like your wheel is turning at 247 RPM? That's about 4 revs per second. Max period wouldn't help with the 30k blip. That's why I added a minimum period check in my RPMCounter class to ignore any period values that were obviously too small. Max period will help if your feedback is going from some number like 100 straight to zero. or flashing between 0 and 100. That's the counter thinking the wheel hast stopped and sending a 0 for period, then sending a good value when it sees the next pulse. Less likely to happen on your setup since you have 6 screw heads.
The 30k problem might be your screwheads. The GTS might be picking up the small gap in the screwhead for the flathead screwdriver. Using a hex-head fastener or something without the gap in the middle would probably work better. |
Re: Magnetic Sensor
ok sweet the only problem im having now is the random blips of high rmp you said that in your rpm counter class you used a function to ignore small rpm can i do that to ignore the high ones as well?
|
Re: Magnetic Sensor
Quote:
|
Re: Magnetic Sensor
Ahhh thank you for your help. Two more quick question why would i need to change the "periodThreshold in the .h file to something like 1e-3". Also in the .cpp you have
Code:
prevResult = 60.0 / period;Code:
prevResult = ( ((1 / period) / 6) * 60) |
| All times are GMT -5. The time now is 14:24. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi