OCCRA
Go to Post By the way why do all american's spell Colour wrong?!?!?!?!?!?!?!? - akoscielski3 [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media  
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 02-18-2018, 07:10 PM
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #7226 (Error 404)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2011
Location: East Lansing
Posts: 327
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Labview Custom Dashboard problem reading NT values

Short: Our value only appears for a very short duration, and is set to 0 otherwise.

Long:
We are making a custom dashboard pane using labview and the default dashboard project (just modifying the custom tab) and we were trying to get and set values to the RoboRIO using Network Tables.

We currently have a "Set Numeric Value" block in teleop that reads an encoder position from the Talon SRX, and sets it to a NT Write value block.

On our dashboard, we have a NT Read block that we read that value from and display it with an indicator on the custom tab of the dashboard.

Most of the time it reads 0, but every once and a while, there are blips where you can see the proper value. A 'blip' being like 1 or 2 frames on the computer.

I don't have an image of the code yet, but I am installing labview on my personal computer to try and recreate the code.

My thought is that it reads the value, but doesn't store it, and then uses the default '0'. Every time it gets a packet, it updates the value but then quickly overwrites it with the default 0. The problem I would be having is having it 'remember' the last value sent

We are using this tab to set PID values so we don't have to keep recompiling. We are probably going to use this method for autonomous positions too. Is this something that is commonly done?
__________________
//TODO: make signature
Reply With Quote
  #2   Spotlight this post!  
Unread 02-18-2018, 08:54 PM
wt200999's Avatar
wt200999 wt200999 is offline
REV Robotics
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 368
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Re: Labview Custom Dashboard problem reading NT values

By default the LabVIEW Dashboard takes the controls and and links them to the robot variable by the control name. So if you name it and try to update it in the loop it'll overwrite itself constantly (writing the same control in multiple places). So if the name of the control is not an actual variable, it'll default to '0'. To link a variable it is actually much easier:

Quote:
Typical dashboard extensions only need to edit the panel. Adding new indicators or controls simply involves placing them on the panel in the Operations tab and naming them the same as the SmartDashboard variable on the robot
There is a VI in the default dashboard code that:

Quote:
Collects all controls and indicators in the Basic and Custom tab. If you need to bind additional controls, add their references. You can extend the enum constant or use an integer.
and works by

Quote:
Terminals of controls and indicators that are bound to the smart dashboard by name. You can place the terminals anywhere you like and even read data from them. You bind controls by adding the control reference to the array on the left. The subVI will do this for the contents of a tab, and you can do it for individual items too, as shown with the LED. To create get the reference, right-click and Create>>Reference.
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
Reply With Quote
  #3   Spotlight this post!  
Unread 02-19-2018, 12:17 AM
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #7226 (Error 404)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2011
Location: East Lansing
Posts: 327
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Re: Labview Custom Dashboard problem reading NT values

I don't think I understand completely.

As of right now, my code looks like the image attached.

How would I get a specific value from the RoboRIO to that indicator?

My other situation works - where I set the PID gains using NT (also below)

I understand that my code for reading encoders isn't right, but writing PID values seems to work.

Any advice? Thanks!
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2018-02-19 at 12.12.45 AM.png
Views:	41
Size:	29.4 KB
ID:	23038  Click image for larger version

Name:	Screen Shot 2018-02-19 at 12.20.35 AM.png
Views:	28
Size:	29.3 KB
ID:	23039  
__________________
//TODO: make signature
Reply With Quote
  #4   Spotlight this post!  
Unread 02-19-2018, 12:40 AM
jjustin jjustin is offline
Registered User
AKA: Justin
FRC #0585 (Cyber Penguins)
Team Role: Programmer
 
Join Date: Feb 2018
Rookie Year: 2014
Location: Tehachapi
Posts: 4
jjustin is an unknown quantity at this point
Re: Labview Custom Dashboard problem reading NT values

Is your code in a loop? Both the robot and the dashboard?

The code might just be running through once and displaying it only one time.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-19-2018, 01:10 AM
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #7226 (Error 404)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2011
Location: East Lansing
Posts: 327
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Re: Labview Custom Dashboard problem reading NT values

Yes, the encoder writing code is in the teleop block (not in a loop, but I believe it gets called every packet) and the encoder reading loop is in loop 1 in the dashboard.

I am going to experiment tomorrow by setting the values to global variables and sending them via periodic tasks in the 100ms loop, although I already tried by getting the motor reference and reading the encoder position in periodic tasks. I think the problem may have been accessing it while the robot isn't enabled and the Talon is in safety mode. It was giving me errors and not turning on the motor controllers - even in teleop enabled
__________________
//TODO: make signature
Reply With Quote
  #6   Spotlight this post!  
Unread 02-19-2018, 09:44 AM
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,864
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Labview Custom Dashboard problem reading NT values

I don't see an issue with what you attached. But I can explain a bit more about the value binding.

If you put a control into the Custom tab of the DB, the code will try to bind that control or indicator to a variable of the same name. This means that if you name a numeric Arm Position, you don't actually need a read or write on the DB. Any change to the Arm Position variable will show up in the DB and any change to the value on the DB will be sent to Network Tables.

The same is true of the Arm PID.

From your symptoms, it sounds like the variable is being set in more than one place. It may be worth searching for the text of the variable name. Ctl-F and search all project VIs.

Greg McKaskle
Reply With Quote
  #7   Spotlight this post!  
Unread 02-20-2018, 12:42 AM
Chadfrom308's Avatar
Chadfrom308 Chadfrom308 is offline
Slave to the bot
AKA: Chad Krause
FRC #7226 (Error 404)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2011
Location: East Lansing
Posts: 327
Chadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to beholdChadfrom308 is a splendid one to behold
Re: Labview Custom Dashboard problem reading NT values

The problem is that I was constantly overwriting it. I used a NT read block when I didnít need to since it automatically does it for you when you name your indicator the same as the NT write block on the RoboRIO
__________________
//TODO: make signature
Reply With Quote
  #8   Spotlight this post!  
Unread 03-12-2018, 03:01 AM
Tim_C_3344 Tim_C_3344 is offline
Registered User
FRC #3344
 
Join Date: Mar 2018
Location: Georgia
Posts: 1
Tim_C_3344 is an unknown quantity at this point
Re: Labview Custom Dashboard problem reading NT values

I may have just created the same problem.

I created a custom dashboard project
I put my CONTROL variables on the Drive Tab on the dashboard
On the block diagram I took those CONTROL variables and wrote them to the DASHBOARD WRITE VI.

Should I expect to have the same issue?

If I understand correctly, then i do not need to use the DASHBOARD WRITE VI on the dashboard block diagram. They will automatically be written for me. I will just need to READ them inside my team code. Correct?

Reply With Quote
  #9   Spotlight this post!  
Unread 03-12-2018, 08:16 AM
jdaming jdaming is offline
Registered User
FRC #5013 (Trobots)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2007
Location: Kansas City, MO
Posts: 123
jdaming is on a distinguished road
Re: Labview Custom Dashboard problem reading NT values

Tim, you are seeing the same problem (you are overwriting the NT variable) but you have a different solution.

Your robot will write a number to NT. The dashboard will read it.

By default the LV dashboard writes to controls of the same name on the Basic and Custom Tabs. If you are adding a variable on the Drive tab you will need to go to the top loop and add a NT Read similar (you just need a scalar that is an array) to the one for RobotDrive Motors and then wire the output of that to the control you created.
__________________
Certified LabVIEW Architect
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 09:05 PM.

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


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi