Go to Post ...never do something because it is comfortable, do something because you WANT to do it. - Andrew Schreiber [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
  #1   Spotlight this post!  
Unread 30-01-2010, 13:58
Kyledoo Kyledoo is offline
Registered User
FRC #2603
 
Join Date: Jan 2010
Location: Ohio
Posts: 24
Kyledoo is an unknown quantity at this point
Getting Encoder Values in the Dashboard

I am trying to get Encoder Values back into the Dashboard and have no idea where to start. We are working on trying to get PWM values back into Dashboard right now, but I cannot find ANY info this procedure for Encoders.
Please help if you have successfully done this.
Reply With Quote
  #2   Spotlight this post!  
Unread 31-01-2010, 00:58
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: Getting Encoder Values in the Dashboard

I've sent arbitrary data to the dashboard. Only the type matters, not the source. Encoders will return either an INT32 or a double depending on if you call Get() or GetDistance(). You can send either one by using the correct data type when you pack the dashboard data.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-02-2010, 00:16
Kyledoo Kyledoo is offline
Registered User
FRC #2603
 
Join Date: Jan 2010
Location: Ohio
Posts: 24
Kyledoo is an unknown quantity at this point
Re: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by jhersh View Post
I've sent arbitrary data to the dashboard. Only the type matters, not the source. Encoders will return either an INT32 or a double depending on if you call Get() or GetDistance(). You can send either one by using the correct data type when you pack the dashboard data.
Thank you, that should help a little bit, but how do you pack the data you receive from a function for the dashboard? Do I have to call another class (like DashboardDataFormat) or is it just another function?

For Example

double dblEncoder1Value;
dblEncoder1Value = encoder1.Get();
then would I do something like:
PackAndSend(dblEncoder1Value);

Forgive me if the questions I have asked sound obvious, I just really can't figure this out.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-02-2010, 01:21
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: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by Kyledoo View Post
Thank you, that should help a little bit, but how do you pack the data you receive from a function for the dashboard? Do I have to call another class (like DashboardDataFormat) or is it just another function?

For Example

double dblEncoder1Value;
dblEncoder1Value = encoder1.Get();
then would I do something like:
PackAndSend(dblEncoder1Value);

Forgive me if the questions I have asked sound obvious, I just really can't figure this out.
The DashboardDataFormat class in the example is just a way to organize the code. The actual library interface is the Dashboard class which you access via the DriverStation class using GetHighPriorityDashboardPacker() or GetLowPriorityDashboardPacker(). Follow the example you see in the code inside the DashboardDataFormat class.
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2010, 14:02
Kyledoo Kyledoo is offline
Registered User
FRC #2603
 
Join Date: Jan 2010
Location: Ohio
Posts: 24
Kyledoo is an unknown quantity at this point
Re: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by jhersh View Post
The DashboardDataFormat class in the example is just a way to organize the code. The actual library interface is the Dashboard class which you access via the DriverStation class using GetHighPriorityDashboardPacker() or GetLowPriorityDashboardPacker(). Follow the example you see in the code inside the DashboardDataFormat class.
Thanks to everyone's, especially your help, we were able to get data back to the dashboard last week. Now we are trying to get the actual values of the encoders passed back to the user messages box. We have successfully sent words back to this spot, but cannot figure out how to parse the encoder value to get passed back. Any help?
EDIT:
we have the variable that holds the encoder value declared as an INT32 because that is what the .Get() function returns. We are using the DriverStationLCD class to print the value back to the dashboard (actually the user messages section of the driver station)

Also, we tried setting our loop to only run while the encoder value was less than a specific amount (in this case 500) and it just kept running. Has anyone else had this problem and how did you get it fixed? I noticed something a little strange: When our wheels are turning, the 3rd, 4th, 5th, and 6th light under Digital I/O on the dashboard flash. The first 2 are greyed out. I thought this was strange because our encoders are plugged into ports 11, 12, 13, and 14. I am starting to wonder if this is what is causing the issue because of the way I have the encoders declared/initialized

Last edited by Kyledoo : 07-02-2010 at 21:43.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-02-2010, 14:50
Kyledoo Kyledoo is offline
Registered User
FRC #2603
 
Join Date: Jan 2010
Location: Ohio
Posts: 24
Kyledoo is an unknown quantity at this point
Re: Getting Encoder Values in the Dashboard

Has anyone else gotten encoder or other numerical values in this field? How did you format the data?
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2010, 15:23
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: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by Kyledoo View Post
Has anyone else gotten encoder or other numerical values in this field? How did you format the data?
If you are using the DriverStationLCD class, you can call:

Code:
myDS_LCD->Printf(DriverStationLCD::kUser_Line1, 1, "%d", encoderValue);
myDS_LCD->UpdateLCD();
Reply With Quote
  #8   Spotlight this post!  
Unread 09-02-2010, 09:29
Kyledoo Kyledoo is offline
Registered User
FRC #2603
 
Join Date: Jan 2010
Location: Ohio
Posts: 24
Kyledoo is an unknown quantity at this point
Re: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by jhersh View Post
If you are using the DriverStationLCD class, you can call:

Code:
myDS_LCD->Printf(DriverStationLCD::kUser_Line1, 1, "%d", encoderValue);
myDS_LCD->UpdateLCD();
Thank you, we ended up figuring it out. FINALLY THE TROUBLE WITH ENCODERS IS OVER!!
Reply With Quote
  #9   Spotlight this post!  
Unread 09-02-2010, 12:07
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,050
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Getting Encoder Values in the Dashboard

Quote:
Originally Posted by jhersh View Post
If you are using the DriverStationLCD class, you can call:

Code:
myDS_LCD->Printf(DriverStationLCD::kUser_Line1, 1, "%d", encoderValue);
myDS_LCD->UpdateLCD();

I'd recommend using PrintfLine instead (available in newest version of WPILib), which pads the line with blank spaces. If you just use printf, then if your number grows and then shrinks it will leave parts of the old number there.

Of course, one could play with formatting options to fix that...
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't see any values on dashboard kevinb999 C/C++ 11 03-02-2010 14:41
Optical encoder not returning values MBernstein Motors 11 09-02-2009 22:10
help getting servo values from camera ruddy Programming 12 30-11-2007 23:18
Dashboard View of Pan and Tilt Servo Values JoeXIII'007 Programming 1 02-02-2005 22:34


All times are GMT -5. The time now is 13:51.

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