Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   How to use eeprom in labview (http://www.chiefdelphi.com/forums/showthread.php?t=97153)

windtakers 28-08-2011 21:28

How to use eeprom in labview
 
I've been reading the forums, and from what I've read eeprom it is use to store data and play it back for the robot to use during autonomous. But what I don't understand is how to program that into labview. If anyone can help me, or if i have my info totally wrong please let me know.

plnyyanks 28-08-2011 21:56

Re: How to use eeprom in labview
 
Quote:

Originally Posted by windtakers (Post 1075105)
I've been reading the forums, and from what I've read eeprom it is use to store data and play it back for the robot to use during autonomous. But what I don't understand is how to program that into labview. If anyone can help me, or if i have my info totally wrong please let me know.

Well, EEPROM is a relatively general term meaning
Quote:

Originally Posted by Wikipedia
Electrically Erasable Programmable Read-Only Memory and is a type of non-volatile memory used in computers and other electronic devices to store small amounts of data that must be saved when power is removed, e.g., calibration tables or device configuration.

Now, for a robot application, it can be useful to write things to the cRIO's memory for use later (like autonomous data, logs, other configuration files, etc), and many teams do this. From my experience, the best way to do this would be to use some native LabVIEW VIs to write files containing whatever data you want to store to the cRIO. In the Programming Pallate, go the the File I/O subpalate. From there, there are various ways to do that. You can use the open/write/close VIs and write a string to a file. You can use the Write Spreadsheet String to File VI to write something spreadsheet-like (like a CSV File, or you can go to the Configuration File subpalate to write an INI File. Of course, you can use the corresponding Read VIs to read from the file as well.

Hopefully, this answered what you were asking; your question was a little unclear (but I did my best). If it was, there's some information about getting started with file operations in LabVIEW on their Developer Zone. Anything else, feel free to ask me.

windtakers 29-08-2011 14:12

Re: How to use eeprom in labview
 
Thank you for the amazing advice, but what do i put for the file path?

plnyyanks 29-08-2011 14:36

Re: How to use eeprom in labview
 
1 Attachment(s)
Quote:

Originally Posted by windtakers (Post 1075167)
Thank you for the amazing advice, but what do i put for the file path?

The filepath should be the input terminal on the upper left in all three methods discussed above. Also, I don't know how the cRIO's filesystem is structured off the top of my head, so just make sure this is a valid file path to somewhere on the cRIO. If you need to check this, there's an FTP server built in, and you can browse the the directory structure from there. You can log on with a blank username & password using a FTP client (like Filezilla or Cyberduck), or I can give you a VI to do it through LabVIEW.

I also made a quick VI demonstrating the different ways to read/write from files. Note that isn't not intended to be functional, just to show how the different VIs interact with one another. LabVIEW can be like that new fancy gadget: really complicated at first sight, but once you get to know its nuances, it's a dream come true. If you need anything else, don't hesitate to ask.

windtakers 30-08-2011 14:10

Re: How to use eeprom in labview
 
I have another question. if i want to record the joystick movements,X and Y, how would i get that data into the write text file, or is it better to use a spreadsheet. If so how would i get the data into the spread sheet. also i'm planning on having the data be written in the periodic tasks.

plnyyanks 30-08-2011 15:28

Re: How to use eeprom in labview
 
Quote:

Originally Posted by windtakers (Post 1075355)
I have another question. if i want to record the joystick movements,X and Y, how would i get that data into the write text file, or is it better to use a spreadsheet. If so how would i get the data into the spread sheet. also i'm planning on having the data be written in the periodic tasks.

In this case, I (personally) would use the Write to Spreadsheet File VI, if only because this type of data can be put into an array nicely and it's less work on the coding end (However, you can use any of the other methods and still have it work, but this would be the best/simplest).

To do that, start by putting a Joystick Get inside a loop in Periodic Tasks and unbundle the "axes" output. Then, use a Build Array (in the array palate) to make an array of the X and Y axes. You will also want to have some kind of time identifier in the array as well. Off the top of my head, the best way to do this would be to use FPGA Time VI (found in WPI Robotics Library -> Utilities). Then, you can wire this array to the 1D array input on the Write to Spreadsheet File VI (make sure it's set to append the file, not to replace it; it's a boolean input). Also, make sure there's some sort of timing on your while loop, as to not waste resources by writing files as fast as possible (maybe every 250 ms would be a good time).

Although it would probably be easier for me to just give you a VI for this, I'm not going to. One of the funny things about programming is that you actually learn best by writing things yourself. So, try to write this on your own, and if you need help, I'll help you through it.

windtakers 31-08-2011 22:23

Re: How to use eeprom in labview
 
1 Attachment(s)
Is it possible to just use a regular tick counter or do i have to use the robot time vi. Because isn't the whole point of putting time into the spread sheet so that the motors know how long to run on a specific speed in Autonomous? Also here is a picture of my periodic tasks.

Greg McKaskle 01-09-2011 06:57

Re: How to use eeprom in labview
 
Inside the loop, the code compares the millisecond tick time to 1500. The millisecond tick is relative to when the robot booted, or when the app started, and keeps going up until it wraps. More than likely, the code should take the time when the button latched, subtract from the current time, and compare to 1500.

Also, personally, I'd take the time, X, and Y, and write them to a single file rather than having the data spread amongst two with duplicated times. This also extends if you add a manipulator or another degree of freedom to the robot or even sensor values that record the response of the robot.

Greg McKaskle

windtakers 01-09-2011 11:32

Re: How to use eeprom in labview
 
The Thing I'm having trouble with is the tick counter. Because i only want the joysticks to be recorded for 15sec, but because the tick counter starts at the robot boot up and not when the case is true the tick counter is already over 15sec even before i get to actually wanting to record the joysticks.

Mark McLeod 01-09-2011 11:44

Re: How to use eeprom in labview
 
It goes something like this, although this example is for a different purpose you should be handling the time in a similar fashion:


windtakers 01-09-2011 14:19

Re: How to use eeprom in labview
 
1 Attachment(s)
this is awesome, and by the way i use your team website for labview help all the time. can't believe i didn't see this one. I think I have the timed task all done now. when I extract the data in autonomous that was saved into the spreadsheet i know that i need to tell the motors how long to run on a certain speed, but i don't know how to do that. Also this is a picture of my updated periodic tasks.

Mark McLeod 02-09-2011 13:34

Re: How to use eeprom in labview
 
To play it back you can run a While loop inside the Autonomous vi
  • Set initial conditions, e.g., pseudo-joystick values = zero
  • Feed initial pseudo-joystick values into motor set speed
  • While forever loop (with an appropriate delay)
    • Read one playback line
    • In an inside loop (with an appropriate delay)
      • Keep checking until elapsed time >= recorded Robot Time (make sure the times are measured the same)
      • When the condition is true, pass the new pseudo-joystick values out, exit the inside loop
    • Feed pseudo-joystick values into motor set speed
    • Make allowances to set speed to zero after the last playback line is read as a safety measure (that'll also help handle partial/incomplete playback files)

windtakers 02-09-2011 19:29

Re: How to use eeprom in labview
 
1 Attachment(s)
Here is a picture of my autonomous. Can you tell me if it's programed right.


All times are GMT -5. The time now is 09:35.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi