Go to Post I have caught a very strong case of FIRST fever. - weinbergmath [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2013, 18:57
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Configure Timers

We're trying out JAVA this year on our Robot after using Labview the last few seasons (not ask)...

In Labview we use the Configure Timer VI's to set the number of samples for averaging when using encoders or counters for speed control.

We can't seem to find the equivilent Method Call in JAVA.
Anyone know if this exists or do we have to write our own averaging?
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2013, 19:06
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Configure Timers

Never Mind. Found my answer. Not available in C++ and JAVA.

http://www.chiefdelphi.com/forums/sh...7&postcount=24
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2013, 19:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by Phalanx View Post
Never Mind. Found my answer. Not available in C++ and JAVA.

http://www.chiefdelphi.com/forums/sh...7&postcount=24
Read this follow-up post:

http://www.chiefdelphi.com/forums/sh...3&postcount=29

It's not hard to do. A fairly simple change to the WPILib source code.



Last edited by Ether : 30-01-2013 at 19:29.
Reply With Quote
  #4   Spotlight this post!  
Unread 30-01-2013, 23:20
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Configure Timers

Thanks Ether. We'll look into modifying the encoder and/or counter class(s).
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


Reply With Quote
  #5   Spotlight this post!  
Unread 01-02-2013, 18:49
sjspry sjspry is offline
Registered User
FRC #1984
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Kansas
Posts: 125
sjspry has a spectacular aura aboutsjspry has a spectacular aura aboutsjspry has a spectacular aura about
Re: Configure Timers

You can use the TimerTask and Timer class, like we are doing. It will fire off a TimerTask's run() method every x milliseconds.
Reply With Quote
  #6   Spotlight this post!  
Unread 01-02-2013, 20:14
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by sjspry View Post
You can use the TimerTask and Timer class, like we are doing. It will fire off a TimerTask's run() method every x milliseconds.
Just curious: Have you ever measured the scheduling jitter? e.g. add code to toggle an IO pin at the start of the run() method and look at the pin on a scope.


Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2013, 01:27
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Configure Timers

Quote:
Originally Posted by Ether View Post
Just curious: Have you ever measured the scheduling jitter? e.g. add code to toggle an IO pin at the start of the run() method and look at the pin on a scope.


I have, and the worst I have seen is 2 ms of jitter, measured on the cRIO using the System Timer. This was both running at a 40ms period and a 100ms period, where the run() method had a 1ms calculation time.

So for example, if I was running something with a 40ms period, It would actually run between 38 - 42 ms, but for the most part the cRIO was pretty good about keeping it constant 40.

All of the threads I run on the robot use the TimerTask class. The timer task does not preempt the running thread, if they are at the same priority so keep that in mind, it will affect your thread execution.
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 02-02-2013 at 01:30.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2013, 09:44
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by NotInControl View Post
The timer task does not preempt the running thread, if they are at the same priority so keep that in mind, it will affect your thread execution.
Two questions come to mind:

1) Do you put code in each of your threads to monitor throughput margin and re-entrancy ?

2) Are there other scheduling options in FRC Java which will provide concurrent processing of same-priority threads ?


Reply With Quote
  #9   Spotlight this post!  
Unread 04-02-2013, 02:16
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Configure Timers

Quote:
Originally Posted by Ether View Post
Two questions come to mind:

1) Do you put code in each of your threads to monitor throughput margin and re-entrancy ?


Yes, I do, it is not necessary, but I just do out of habbit for all my embedded projects.

Especially when I run embedded code on an operating system that doesn't guarantee timing, I always put code in in there to monitor the execution of each state.

Unfortunately, the SwawkOS doesn't support :

Code:
System.nanoTime()
so timing is only good to the millisecond from:
Code:
System.currentTimeMillis();
but milli second accuracy is good enough for anything we will need to do in FIRST for sure.

Quote:
Originally Posted by Ether View Post

2) Are there other scheduling options in FRC Java which will provide concurrent processing of same-priority threads ?


When you use the TimeThread task, it doesn't run automatically, you need to create a separate scheduler which runs the task based on the periodicty set.

Something like:

Code:
		
this.executor = new java.util.Timer();
this.executor.schedule(new MyTimedTask(this), 0L, this.period);
There are different types of properties you can set on the scheduler. By default the scheduler doesn't preempt the running thread so lets say you kicked off a TimedTask thread, and then you entered this block of code after:

Code:
while(true)
  system.out.println("Hello World");
running as fast as it could, you would see that your timer task would not run at your set period, it would only get to run, between timesclices of the while loop that the cpu was free for an instance of time.

However, for JavaFRC you can use other properties of the Timer Task to control your concurrancy. For example you could use the scheduleAtFixedRate method of the TimerTask, which i believe does preempt the running thread to try and guarantee execution. (I never tested it however).

The better way to do it in a normal J2ME project would be to set the priority of all of your threads. Using the Thread.setPriority() and Thread.getPriority() functions and the Thread.xxPRIORITY static fields. You can have up to 10 levels of priorities. Where Higher priorities will pre-empt lower ones. However these methods are not supported by Squawk JVM for FRC, and all threads in FRC Java are created with the same NORMAL priority.

The best way to do it JavaFRC would be to avoid the need for preemption and try to ensure your code is optimized and runs in a period that is reasonable so that the CPU can be shared between all normal priority tasks. If all of your JavaFRC threads have relatively small execution times compared to its period, (and they should), then all your threads should have enough access to the CPU to run within its within its periodicity.

Java VM in general is not a real time OS, so timing is never truly guaranteed, no matter what we do. Most of the inconsistencies arise when you have threads that are relying on preemptive behavior, instead of cooperatively giving up CPU time.


Hope that helps,
- Kev
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 04-02-2013 at 02:47.
Reply With Quote
  #10   Spotlight this post!  
Unread 04-02-2013, 02:32
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by NotInControl View Post
milli second accuracy is good enough for anything we will need to do in FIRST for sure.
Thanks for your informative post. Let me take issue with the point above.

It's not good enough for accurately measuring the speed of a frisbee-shooting wheel using the counts/time method.

It's not good enough to measure the linear speed of a frisbee as it exits the shooter on your robot.


Reply With Quote
  #11   Spotlight this post!  
Unread 04-02-2013, 03:14
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Configure Timers

Quote:
Originally Posted by Ether View Post
Thanks for your informative post. Let me take issue with the point above.

Your very welcome!


Quote:
Originally Posted by Ether View Post
It's not good enough for accurately measuring the speed of a frisbee-shooting wheel using the counts/time method.



I am not sure what you mean by this. This is a "Too each his own" problem. How accurately do you think you need to measure the speed of a wheel? And what would happen if you were off by a couple RPM? Can you over come this by other robust code?

I come from the defense world where if timing is inaccurate people could loose their lives. We obviously don't have that problem in FIRST was my point and I believe our problems in FIRST can afford less accuracy in our software timers, which was the point I was making.

I have never observed good performance from the default encoder rate method but I have written my own encoder Rate codes with performance of +/- 3 rpm without averaging samples, where loop times were ~200ms, and that is way better than I need it for anything I need to do with a shooter wheel. What is your desired accuracy that calculating the speed of a wheel using time measured in milliseconds is not allowing you to achieve? What is driving this accuracy?

Here is some psuedocode from my 2013 robot giving the performance I stated above with a 500PPR encoder @ 2300 wheel speed. It is a class which extends the encoder, which is why it uses Super.

Code:
	public double getRPM()
	{
		
		//getRate
		timeNow = System.currentTimeMillis();
		countNow = super.get(); //calls encoder.get method
		rate=(countNow-countBefore)/(timeNow-oldTime); //counts per millisecond
		oldTime=timeNow;
		countBefore=countNow;

		//return average
		return rate*1000*60/PPR; //... rpm
	}


Quote:
Originally Posted by Ether View Post
It's not good enough to measure the linear speed of a frisbee as it exits the shooter on your robot.

Again how accurately do you need to measure this?

System.currentTimeMillis() is a software timer. To measure linear speed of the disc you need something which can provide you external readings first. If you had for example two IR line sensors in the path of the disc a set distance apart. Saved the time each IR sensor was crossed by the disc and then calculated the Velocity using distance over time, your saying the accuracy you would get from that wouldn't be good enough because the time measured was in Milliseconds? Not good enough to accomplish what exactly?
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner

Last edited by NotInControl : 04-02-2013 at 04:04. Reason: changed 1 to 3 (typo)
Reply With Quote
  #12   Spotlight this post!  
Unread 04-02-2013, 18:52
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by NotInControl View Post
my 2013 robot giving the performance I stated above with a 500PPR encoder @ 2300 wheel speed
What brand and model encoder is that?


Reply With Quote
  #13   Spotlight this post!  
Unread 04-02-2013, 19:35
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Configure Timers

Quote:
Originally Posted by Ether View Post
What brand and model encoder is that?


That response didn't really answer my questions above. But to answer yours information on the encoder in question can be found here:

http://www.robotshop.com/productinfo...-38&lang=en-US

It is an encoder I like to use on my personal projects. It won't be the final encoder we use on our Robot this year. The final encoders we use this year will be a GreyHill 256 PPR.

Hope this helps,
Kev
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
Reply With Quote
  #14   Spotlight this post!  
Unread 04-02-2013, 20:43
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,043
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: Configure Timers

Quote:
Originally Posted by NotInControl View Post
That response didn't really answer my questions above.
In order to prepare a thoughtful analytical response, I needed to gather some technical information to clear up some ambiguities in your post.

But since you're in a hurry, I'll just ask you for clarification instead of taking the time to research it myself.

When you use the term PPR, what do you mean by that? Do you mean the same thing that US Digital does (see attachment)? Or do you use the term PPR to mean what US Digital calls CPR?

GrayHill specs their encoders in CPR, not PPR, and they define CPR the same way that US Digital does.

So is your "256 PPR" GrayHill encoder 256 CPR or 64 CPR?

And is your "500 PPR" Cytron encoder 500 CPR or 125 CPR?

If you don't have this info, I will respond to your post without it, but my response will be in generalities and therefor less useful I would think.


Reply With Quote
  #15   Spotlight this post!  
Unread 04-02-2013, 22:28
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: Configure Timers

Quote:
Originally Posted by Ether View Post
In order to prepare a thoughtful analytical response, I needed to gather some technical information to clear up some ambiguities in your post.

But since you're in a hurry, I'll just ask you for clarification instead of taking the time to research it myself.

Not a problem, I am not really in a hurry, I am just curious, and as build season winds down your insight and viewpoint may show something we are overlooking when solving this problem, or an oversimplification we are applying which may be inaccurate for some reason.

I believe I have all bases covered but I won't know for sure until you share your perspective and reasoning. But I do appreciate you taking the time to formulate a complete answer... so thank you.

Quote:
Originally Posted by Ether View Post
When you use the term PPR, what do you mean by that? Do you mean the same thing that US Digital does (see attachment)? Or do you use the term PPR to mean what US Digital calls CPR?

GrayHill specs their encoders in CPR, not PPR, and they define CPR the same way that US Digital does.

So is your "256 PPR" GrayHill encoder 256 CPR or 64 CPR?

And is your "500 PPR" Cytron encoder 500 CPR or 125 CPR?

If you don't have this info, I will respond to your post without it, but my response will be in generalities and therefor less useful I would think.

I do not see an attachment with your post so it's hard for me to say how my definition lines up with US Digital however,

When I use the Term PPR, as in Pulses per revolution, I mean it in terms of the square wave being generated. A Pulse in my definition is a complete rising edge, width, and falling edge.

Therefore, if you are counting all rising and falling edges, a single pulse produces 2 counts.

If the encoder is quadrature, there are two digital outputs each generating its own pulse. Therefore if you were to count all rising and falling edges from a quadrature encoder, each pulse would return 2 counts but you have 2 pulses to deal with so the total is 4 counts.

So in my definition, a quadrature 500PPR, can produce 2000 counts per revolution when counting all rising and falling edges on both channels.

I believe GreyHill defines this as Cycles Per Revolution (CPR) which is another term used in industry but means the exact same thing as my PPR. I avoid using CPR because unless you are intimately familiar with the definitions you may confuse CPR to mean "Count Per Revolution" (or at least I would, and that is completely wrong).

So the GreyHill 256 Cycles Per Rotation encoder I mentioned would produce 1000 counts per rev if you were counting the rising and falling edge of each signal. or as I call it 256 Pulses per revolution (On a Single Channel).

Does that clarify things and answers your question?

Hope that helps,
Kev
__________________
Controls Engineer, Team 2168 - The Aluminum Falcons
[2016 Season] - World Championship Controls Award, District Controls Award, 3rd BlueBanner
-World Championship- #45 seed in Quals, World Championship Innovation in Controls Award - Curie
-NE Championship- #26 seed in Quals, winner(195,125,2168)
[2015 Season] - NE Championship Controls Award, 2nd Blue Banner
-NE Championship- #26 seed in Quals, NE Championship Innovation in Controls Award
-MA District Event- #17 seed in Quals, Winner(2168,3718,3146)
[2014 Season] - NE Championship Controls Award & Semi-finalists, District Controls Award, Creativity Award, & Finalists
-NE Championship- #36 seed in Quals, SemiFinalist(228,2168,3525), NE Championship Innovation in Controls Award
-RI District Event- #7 seed in Quals, Finalist(1519,2168,5163), Innovation in Controls Award
-Groton District Event- #9 seed in Quals, QuarterFinalist(2168, 125, 5112), Creativity Award
[2013 Season] - WPI Regional Winner - 1st Blue Banner
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 11:19.

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