View Single Post
  #12   Spotlight this post!  
Unread 03-02-2010, 14:41
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Can't see any values on dashboard

Quote:
Originally Posted by Kyledoo View Post
Thank You!! Everyone kept saying MODIFY THE DASHBOARD!! but I am having enough trouble figuring out the encoders right now, and we have more sensors we want to set up. Where is the diagram though, I see the project explorer and it lets me open of the GUI. Other than figuring that out, I have never used labview. Since you have been so helpful, would you mind me asking you about an Encoder Example, maybe even one that sends it to the dashboard? If you could point me to something that would be very helpful. WPI documentation seems to be very lacking in the encoder area.
Here's some code for unit testing the Encoder class:

Code:
	double position4x, position2x, position1x;
	DigitalInput qA(5); // Digital I/O 5 on slot 4
	DigitalInput qB(6); // Digital I/O 6 on slot 4
	Encoder encoder4X(qA, qB, true);
	Encoder encoder2X(qA, qB, true, Encoder::k2X);
	Encoder encoder1X(qA, qB, true, Encoder::k1X);
	// 6 inch wheel (pi*d) is 18.85 inch circumference; 24:40 tooth sprockets; 250 pulses per rev.
	encoder4X.SetDistancePerPulse(18.85 * 0.6 / 250.0);
	encoder2X.SetDistancePerPulse(18.85 * 0.6 / 250.0);
	encoder1X.SetDistancePerPulse(18.85 * 0.6 / 250.0);
	Jaguar rightMotor(2);
	rightMotor.Set(-1.0);
	Wait(2.0); // wait for motor to get up to speed
	encoder4X.Reset();
	encoder2X.Reset();
	encoder1X.Reset();
	encoder4X.Start(); // start counting
	encoder2X.Start();
	encoder1X.Start();
	Wait(5.0); // wait for some distance to be covered
	position4x = encoder4X.GetDistance(); // get position in inches
	position2x = encoder2X.GetDistance();
	position1x = encoder1X.GetDistance();
This code is only interested in position, not speed. Hope this helps.

-Joe

Last edited by jhersh : 03-02-2010 at 14:46. Reason: Make it a bit more interesting...
Reply With Quote