Go to Post The GDC made something easier??? Link or it didn't happen! - JesseK [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #31   Spotlight this post!  
Unread 02-04-2013, 17:47
meltbox360 meltbox360 is offline
Registered User
FRC #4302
 
Join Date: Jan 2012
Location: Chicago, Il
Posts: 32
meltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of light
Re: Consistent Encoder RPM Issues

I'm back. About to get to testing the code but I recompiled WPILib with the Java code diffs you gave me translated to C++

I will post back as soon as I have a result. I'll also post up what I changed if it works.
Reply With Quote
  #32   Spotlight this post!  
Unread 02-04-2013, 17:51
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by meltbox360 View Post
I recompiled WPILib...
See Kevin's recent post:

http://www.chiefdelphi.com/forums/sh...8&postcount=28


Reply With Quote
  #33   Spotlight this post!  
Unread 02-04-2013, 17:54
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,685
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Consistent Encoder RPM Issues

To follow up on my post, the single best reason for pulling out a copy of Counter.cpp and Counter.h is so you can easily stay up to date with WPILib releases that don't affect the Counter class. If you're recompiling WPILib, then you'll have to re-modify it and recompile it every time there's a new release.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #34   Spotlight this post!  
Unread 02-04-2013, 18:23
meltbox360 meltbox360 is offline
Registered User
FRC #4302
 
Join Date: Jan 2012
Location: Chicago, Il
Posts: 32
meltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of light
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by Kevin Sevcik View Post
To follow up on my post, the single best reason for pulling out a copy of Counter.cpp and Counter.h is so you can easily stay up to date with WPILib releases that don't affect the Counter class. If you're recompiling WPILib, then you'll have to re-modify it and recompile it every time there's a new release.
I was not aware that was possible. Thanks. You would however have to be careful to track any changes in files you pull out to ensure you have the latest version of those files. For example pulling out networkTables I think would have resulted in you not getting some of the updates in the latest release. It unfortunately works two ways.

If you make sure to manage it then pulling out the files id likely the better solution.
Reply With Quote
  #35   Spotlight this post!  
Unread 02-04-2013, 18:30
meltbox360 meltbox360 is offline
Registered User
FRC #4302
 
Join Date: Jan 2012
Location: Chicago, Il
Posts: 32
meltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of light
Re: Consistent Encoder RPM Issues

Wonderful it is fixed. I am seeing jitters of around 30 rpm now. This is absolutely wonderful. Should I go and try to smooth it further before attempting bang-bang or should I dive into that now. Thanks for the help couldn't have done it without you guys!

EDIT: My error is about .5% right now which I believe is good enough.

Last edited by meltbox360 : 02-04-2013 at 18:34.
Reply With Quote
  #36   Spotlight this post!  
Unread 02-04-2013, 18:39
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by meltbox360 View Post
Should I go and try to smooth it further before attempting bang-bang
Do not filter the signal going to bang-bang. Bang-bang does not like phase lag.

If you haven't seen it already, you might want to peruse this paper.

If bang-bang doesn't work for you, try Take Back Half.




Reply With Quote
  #37   Spotlight this post!  
Unread 02-04-2013, 18:46
meltbox360 meltbox360 is offline
Registered User
FRC #4302
 
Join Date: Jan 2012
Location: Chicago, Il
Posts: 32
meltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of light
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by Ether View Post
Do not filter the signal going to bang-bang. Bang-bang does not like phase lag.

If you haven't seen it already, you might want to peruse this paper.

If bang-bang doesn't work for you, try Take Back Half.




Thank you. I will post back when I have results along with the modified WPILib source files.
Reply With Quote
  #38   Spotlight this post!  
Unread 02-04-2013, 19:30
meltbox360 meltbox360 is offline
Registered User
FRC #4302
 
Join Date: Jan 2012
Location: Chicago, Il
Posts: 32
meltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of lightmeltbox360 is a glorious beacon of light
Re: Consistent Encoder RPM Issues

Looks like a simple way to do it however I am wondering if anyone knows of a simple way in vxWorks of starting a thread that does some task every some miliseconds. iterativeRobot is a little late to switch to at the moment (I think). I know platforms like QNX can do this with timers. Perhaps it is not necessary but it is nice to ensure consistent performance.
Reply With Quote
  #39   Spotlight this post!  
Unread 03-04-2013, 02:10
Tanaythan's Avatar
Tanaythan Tanaythan is offline
Programmer
AKA: Tanay Nathan
FRC #3256 (Warriorborgs)
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2010
Location: San Jose
Posts: 27
Tanaythan is an unknown quantity at this point
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by meltbox360 View Post
Looks like a simple way to do it however I am wondering if anyone knows of a simple way in vxWorks of starting a thread that does some task every some miliseconds. iterativeRobot is a little late to switch to at the moment (I think). I know platforms like QNX can do this with timers. Perhaps it is not necessary but it is nice to ensure consistent performance.
There is a notifier class in wpilib that you can use. It spawns a new thread every few milliseconds. To reference the code it is used in the pidcontroller class.
__________________
Tanay Nathan
Programmer
Team #3256 Warriorborgs
Reply With Quote
  #40   Spotlight this post!  
Unread 03-04-2013, 12:55
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Consistent Encoder RPM Issues

In my bang-bang controller, I used a task (specifically jankyTask, courtesy of Bob.Wolff in this thread: http://www.chiefdelphi.com/forums/sh...ght=Tasks+in+C)

I setup the SetTargetRPM of our shooter, to use the RPM to compute a target_period, and in the task I read the period from the counter class, and compare it to the computed target period, if the period is above target set the motor to 100%, if the target is below I set 0%. I only call motor.Set if the motor command has changed from the previous run (since the set carries a good bit of overhead).

In addition, I've added some code akin to the take-back-half suggested by Ether. When we trigger our shot, I disable the bang-bang control and set a constant 50% power for a short time; this addition seemed to help our shot consistency, but it's a bit of a hack

Edit: I can provide source code if you like, but I didn't want to spoil the fun
Reply With Quote
  #41   Spotlight this post!  
Unread 05-04-2013, 12:58
nightpool's Avatar
nightpool nightpool is offline
robotRectifier
AKA: Evan
no team (formerly of CORE 2062)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Waukesha, WI
Posts: 81
nightpool is on a distinguished road
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by Ether View Post
Indeed. At frisbee shooter wheel speeds, many teams have had excellent results with one-count-per-rev sensors (optical and magnetic). One-count-per-rev sensors don't require changing the FPGA sample ring buffer default size.


Indeed. Our team dodged a bullet this year as our physical shooter design made it impossible to put a traditional encoder on and we had to figure out an alternative earlier in the season. It turned out to be very easy to use a normal Rockwell photoeye and a piece of white tape to measure shooter speed. The only biggish change we had to make was our own subclass of Counter to make it work with the WPILib PID controller, but that was pretty trivial, just like 15 lines of code.

The one thing to watch out for is the size of your flag (the tape or what have you). Too small and you might not see it as it flashes past. We had good results with about 30 degrees of coverage.
__________________
Proud alum of CORE 2062.
www.core2062.com
Reply With Quote
  #42   Spotlight this post!  
Unread 05-04-2013, 15:04
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by nightpool View Post
The one thing to watch out for is the size of your flag (the tape or what have you). Too small and you might not see it as it flashes past. We had good results with about 30 degrees of coverage.
At what RPM?


Reply With Quote
  #43   Spotlight this post!  
Unread 05-04-2013, 15:05
nightpool's Avatar
nightpool nightpool is offline
robotRectifier
AKA: Evan
no team (formerly of CORE 2062)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Waukesha, WI
Posts: 81
nightpool is on a distinguished road
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by Ether View Post
At what RPM?


Around 3600. We're probably going to be replacing the 5:1 bb on our shooter with either a 4:1 or a mini-cim though, so I'll update you guys on how that works.
__________________
Proud alum of CORE 2062.
www.core2062.com
Reply With Quote
  #44   Spotlight this post!  
Unread 05-04-2013, 15:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by nightpool View Post
Around 3600.
That's about 1.3ms (with 30 degree coverage).

What's the response time of that Rockwell photosensor?


Reply With Quote
  #45   Spotlight this post!  
Unread 05-04-2013, 15:12
nightpool's Avatar
nightpool nightpool is offline
robotRectifier
AKA: Evan
no team (formerly of CORE 2062)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Waukesha, WI
Posts: 81
nightpool is on a distinguished road
Re: Consistent Encoder RPM Issues

Quote:
Originally Posted by Ether View Post
That's about 1.3ms (with 30 degree coverage).

What's the response time of that Rockwell photosensor?


About 1ms IIRC. This is mainly estimates though.
__________________
Proud alum of CORE 2062.
www.core2062.com
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:31.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi