Go to Post And the only thing that can really measure that is when you look a kid in the eye, say "We've got a problem..." and you see them smiling, "Bring it on." - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2013, 20:08
Deviator247 Deviator247 is offline
Registered User
FRC #2164
 
Join Date: Jan 2012
Location: Harrisonville, MO
Posts: 6
Deviator247 is an unknown quantity at this point
Connecting an FRC Dashboard project to an FRC cRio project

I need help connecting a 4 value slider to a cRio project in order to control a case structure in autonomous independent, preferably using Boolean Logic if possible, thanks
  #2   Spotlight this post!  
Unread 06-02-2013, 22:41
toastnbacon toastnbacon is offline
Registered User
AKA: James
FRC #3169 (Saintborgs)
Team Role: College Student
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Edmond
Posts: 97
toastnbacon is a jewel in the roughtoastnbacon is a jewel in the roughtoastnbacon is a jewel in the roughtoastnbacon is a jewel in the rough
Re: Connecting an FRC Dashboard project to an FRC cRio project

I don't know if this is the most elegant solution out there, but it should work. I also don't know how much you or the people from the future reading this know about programming, so I'll go ahead and explain it. What this will do is look at the analog input 1 slider. It divides it up into four sections (0-1, 1-2, 2-3, 3-5) and will build an array consisting of the Boolean values of if the slider falls in each of these sections. For example, a value of 1.5 would be read as [False, True, False, False]. It then searches for which value in the array is true (at any given point there will only be one true value) and takes the index (0, 1, 2, or 3) of it. This index is then plugged into a case structure (expanded for your viewing pleasure). If it's 0-1, case 0 will run. If it's 1-2, case 1 will run, etc.
Attached Thumbnails
Click image for larger version

Name:	For Deviator247.png
Views:	43
Size:	217.8 KB
ID:	13834  
Attached Files
File Type: vi Prog For Deviator247.vi (7.9 KB, 2 views)
__________________
"This must be what going insane feels like."-Simon Tam, Firefly
  #3   Spotlight this post!  
Unread 06-02-2013, 22:53
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Connecting an FRC Dashboard project to an FRC cRio project

What part are you having difficulty with?

Creating a 4 value slide control on the Dashboard front panel is straightforward. It'll automatically be a SmartDashboard variable. You can play with its properties to make it an integer with minimum value 1 and maximum value 4.

Reading that variable on the cRIO in the Autonomous Independent vi is also straightforward. Use the SD Read Number function. It'll probably arrive as a floating-point value, so you'll have to turn it into an integer before using it as the Selector for a Case Structure.
  #4   Spotlight this post!  
Unread 07-02-2013, 18:48
Deviator247 Deviator247 is offline
Registered User
FRC #2164
 
Join Date: Jan 2012
Location: Harrisonville, MO
Posts: 6
Deviator247 is an unknown quantity at this point
Re: Connecting an FRC Dashboard project to an FRC cRio project

Quote:
Originally Posted by Alan Anderson View Post
What part are you having difficulty with?

Creating a 4 value slide control on the Dashboard front panel is straightforward. It'll automatically be a SmartDashboard variable. You can play with its properties to make it an integer with minimum value 1 and maximum value 4.

Reading that variable on the cRIO in the Autonomous Independent vi is also straightforward. Use the SD Read Number function. It'll probably arrive as a floating-point value, so you'll have to turn it into an integer before using it as the Selector for a Case Structure.
I need help with connecting the dashboard project (PC dashboard) to the cRio project in order to use a slider that I've completed to set a time value, I basically need to use a slider to set a time delay on a while loop for a motor, the slider has 5 positions now, (Off, wait 2 seconds before running, wait 5 seconds, wait 8 seconds, and wait 11 seconds) these are times we need the autonomous to wait before starting our while loops, I was hoping to use a case structure to control the loop, where if the slider on the dashboard project is set to 1, there is no wait, and each other value sets a wait time before the motor in the while loop runs.I hope that clears it up a little
  #5   Spotlight this post!  
Unread 07-02-2013, 20:34
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Connecting an FRC Dashboard project to an FRC cRio project

I suggest just making a straightforward slider control that ranges from 0 to 15. Since it's going to control a delay time, I don't see any reason to limit it to specific predefined values.

"Connecting" a Dashboard control to a cRIO program is just a matter of letting the SmartDashboard communication do its job. If you make a Dashboard control and don't connect it to anything, it will be picked up as a SmartDashboard value and automatically shared with the cRIO.

Reading the value is just a matter of...reading the value. Use the SD Read Number function and tell it the name of the Dashboard control you created. Then multiply the value you get by 1000 and feed it to a Wait (ms) function.

There are several ways to keep the rest of the Autonomous code from running until the Wait has finished. I'll let you decide how you want to do it.
  #6   Spotlight this post!  
Unread 08-02-2013, 19:23
Deviator247 Deviator247 is offline
Registered User
FRC #2164
 
Join Date: Jan 2012
Location: Harrisonville, MO
Posts: 6
Deviator247 is an unknown quantity at this point
Re: Connecting an FRC Dashboard project to an FRC cRio project

Alright, thanks, I've got the slider values hooked to a case structure in our autonomous code, and it's working!
Closed Thread


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 02:08.

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