OCCRA
Go to Post I feel like watching match videos from 2003 could be considered a form of cruel and unusual punishment. - Cory [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 03-27-2018, 10:45 AM
pcampbell pcampbell is offline
Registered User
no team
 
Join Date: Sep 2017
Location: Michigan
Posts: 21
pcampbell is an unknown quantity at this point
Creating the file path to Read/Write text files

Having issues creating the correct file path to read and write text files. I've successfully created a program in C++ Eclipse writing and reading values to and from text files. Now I'm having issues creating a LabVIEW program to be deployed on the RoboRIO to find the text files created in the C++ program and be able to read and write to and from them as well. Any suggestions are greatly appreciated!!



Here are a few LabVIEW file path attempts:

/C/Users/pcampbell/Desktop/Eclipse/Mar5/accel.txt
/172.22.11.1/C/Users/pcampbell/Eclipse/Mar5/accel.txt
/FTP/169.254.28.120:/C/Users/pcampbell/Eclipse/Mar5/accel.txt
Reply With Quote
  #2   Spotlight this post!  
Unread 03-27-2018, 11:02 AM
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: Creating the file path to Read/Write text files

Are you trying to have it read a file from the roboRIO to/from the PC or connected device? Or are you trying to read a local file from a deployed LabVIEW program?

My recommendation would be to store any files you want to read on the roboRIO in the default data directory which I think is /home/lvuser/natinst/LabVIEW Data/

If you use this path you can then use the 'Default Data Directory' VI to get the file location and build from there. For example we have a folder on the roboRIO in that location which stores our auton routines, and we read it like this:

__________________
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 03-27-2018, 12:00 PM
pcampbell pcampbell is offline
Registered User
no team
 
Join Date: Sep 2017
Location: Michigan
Posts: 21
pcampbell is an unknown quantity at this point
Re: Creating the file path to Read/Write text files

Thank you wt200999 for the prompt reply.

I am trying to have the C++ Eclipse program on the PC prompt the user to enter values like setting speed, acceleration, deceleration, etc, then write those values to a text file and the LabVIEW deployed program on the RIO read the values entered to the text file and use the values to set the speed, acceleration, etc. on the robot. Then use the encoder values to calculate actual speed, etc, and send the actual values back to the PC program. Hope this explanation makes sense.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-27-2018, 12:47 PM
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: Creating the file path to Read/Write text files

Quote:
Originally Posted by pcampbell View Post
Thank you wt200999 for the prompt reply.

I am trying to have the C++ Eclipse program on the PC prompt the user to enter values like setting speed, acceleration, deceleration, etc, then write those values to a text file and the LabVIEW deployed program on the RIO read the values entered to the text file and use the values to set the speed, acceleration, etc. on the robot. Then use the encoder values to calculate actual speed, etc, and send the actual values back to the PC program. Hope this explanation makes sense.
I think you are missing the transfer pieces. You are writing to a text file on the DS. You then need to transfer that file to a location on the roboRIO (I would use WebDAV). Which will then be read by your robot code. After performing your desired function send the data back to the DS, using Network Tables would probably be easiest.
__________________
Certified LabVIEW Architect
Reply With Quote
  #5   Spotlight this post!  
Unread 03-28-2018, 08:30 AM
mshafer1 mshafer1 is offline
Programming Mentor
AKA: Matthew Shafer
FRC #6321 (Rouse Raiders Robotics (R^3))
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2008
Location: Texas
Posts: 96
mshafer1 is a jewel in the roughmshafer1 is a jewel in the roughmshafer1 is a jewel in the rough
Re: Creating the file path to Read/Write text files

Quote:
Originally Posted by pcampbell View Post
Having issues creating the correct file path to read and write text files. I've successfully created a program in C++ Eclipse writing and reading values to and from text files. Now I'm having issues creating a LabVIEW program to be deployed on the RoboRIO to find the text files created in the C++ program and be able to read and write to and from them as well. Any suggestions are greatly appreciated!!



Here are a few LabVIEW file path attempts:

/C/Users/pcampbell/Desktop/Eclipse/Mar5/accel.txt
/172.22.11.1/C/Users/pcampbell/Eclipse/Mar5/accel.txt
/FTP/169.254.28.120:/C/Users/pcampbell/Eclipse/Mar5/accel.txt
I am unclear what you have been successful with, do you have the c++ program deploying the file to the rio? can you see the file on the rio using the the Web dashboard (http://172.22.11.1/) under the files tab, or using WinSCP?

My first thought is the problem is you are treating the file paths as if the rio were a windows target that allows you to read and write to any path, but it is a Linux target and requires you (or rather the use the program executes under) to have permission to read or write to the requested path.

Both of these tutorials have LV read a config file stored on the Rio (the second one used the home path of the user that the program will execute as by default, so if you're just trying to figure out the path, check out that code which is zipped with the tutorial).
https://frclabviewtutorials.com/sens...potentiometer/
https://frclabviewtutorials.com/profiledAuto/

If these don't help, please post back with more specifics of what you are trying to do (are you stuck at the writing, or the reading??).


P.S. I will reply faster if you PM or email me as I monitor my email more than CD (i.e., please message me for clarification).
__________________
National Instruments Software Engineer
http://frclabviewtutorials.com Curator
Reply With Quote
  #6   Spotlight this post!  
Unread 03-29-2018, 08:30 AM
pcampbell pcampbell is offline
Registered User
no team
 
Join Date: Sep 2017
Location: Michigan
Posts: 21
pcampbell is an unknown quantity at this point
Re: Creating the file path to Read/Write text files

Quote:
Originally Posted by wt200999 View Post
Are you trying to have it read a file from the roboRIO to/from the PC or connected device? Or are you trying to read a local file from a deployed LabVIEW program?

My recommendation would be to store any files you want to read on the roboRIO in the default data directory which I think is /home/lvuser/natinst/LabVIEW Data/

If you use this path you can then use the 'Default Data Directory' VI to get the file location and build from there. For example we have a folder on the roboRIO in that location which stores our auton routines, and we read it like this:


Could you explain how to get a file onto the RoboRIO? Thank you!
Reply With Quote
  #7   Spotlight this post!  
Unread 03-29-2018, 08:32 AM
pcampbell pcampbell is offline
Registered User
no team
 
Join Date: Sep 2017
Location: Michigan
Posts: 21
pcampbell is an unknown quantity at this point
Re: Creating the file path to Read/Write text files

Quote:
Originally Posted by jdaming View Post
I think you are missing the transfer pieces. You are writing to a text file on the DS. You then need to transfer that file to a location on the roboRIO (I would use WebDAV). Which will then be read by your robot code. After performing your desired function send the data back to the DS, using Network Tables would probably be easiest.
Thank you for your help. Do you know of any tutorials for using WebDAV and Network Tables?
Reply With Quote
  #8   Spotlight this post!  
Unread 04-02-2018, 03:17 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: Creating the file path to Read/Write text files

Here is the process we currently use:
  1. Develop our auton routine including paths etc into a text file (we use a LabVIEW program but I assume this is where you would run your C++ script)
  2. In a File Explorer window, go to ftp://roboRIO-3005-FRC.local and navigate to the path we want. Of course change 3005 to your team number.



    Again we choose /home/lvuser/natinst/LabVIEW Data/ since there is a built in VI that points to this path. We added a folder called 'Auton'. The path is from my memory so it may be slightly off, but that should give you the idea. You can navigate to that from the explorer window.
  3. From here we copy/paste the files using normal Windows operations.
  4. On the roboRIO we read the file using the above snippet and parse the data accordingly for our auton
  5. To see feedback from our auton we use front panel controls when debugging or Network Tables when deployed. For this you may need to develop a custom dashboard program.

There is a basic description of network tables here. There are network tables VIs in the WPILib palette that are fairly straight forward, they are all the VIs with 'NT' in their icon. You can see examples in Teleop. We generally have a parallel loop that sends back all the useful data.

I have never used WebDAV to transfer files, there is a generic tutorial here, we may look at this as an alternative to FTP that we use.
__________________
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
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 08:38 PM.

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


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