|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: What are you doing different from last year?
Quote:
|
|
#2
|
|||
|
|||
|
Re: What are you doing different from last year?
Could you elaborate a bit? I'd like to know how other people are approaching this problem.
![]() |
|
#3
|
|||||
|
|||||
|
Re: What are you doing different from last year?
Quote:
As for other stuff we'd like to do, we'd also like to have a lot of parameters stored in (INI?) files on the robot for easier loop tuning. Last year, I actually wrote some FTP VIs to update PID constants on the fly, so we might use something to that extent again. As for other stuff, a lot of it isn't really that well fleshed out yet (we have a good idea in our heads, but we haven't written too much code yet). If you have any questions about specific code parts, I'd be happy to answer them as best I can. |
|
#4
|
|||
|
|||
|
Re: What are you doing different from last year?
It all sounds great!
One thing I've been struggling with is along the lines of saving/updating "ini" files on the robot. Ideally you'd be able to modify key robot parameters from the Driver Station dashboard (so you don't need any additional computers). I've been trying to figure out the best way to do this. My general requirements have been as follows: -No extra computers are needed to make on-the-fly changes -Newer versions of Robot Code (that change the # or type of constants) should not require recompile/redeploy of DS Dashboard code So far, here was what we had come up with: 1) Robot reads constants from XML document on cRIO 2) Robot unflattens from XML, turning it into a typedef for use internally 3) If robot gets a request from DS as to what the current constants are, it flattens the tyepdef to XML and sends it as a string 4) DS can modify the string (typedefs flattened to xml are quite human-readable), and send back a new one (after doing some quick verification to make sure it's still valid) 5) Robot receives the data, saves it, and applies the new constants to the running program Sending XML helps decouple the DS and the Robot, but at the cost of needing to do some kind of XML validation again somewhere. I'm wondering if there is a more elegant way to do this. |
|
#5
|
|||||
|
|||||
|
Re: What are you doing different from last year?
|
|
#6
|
|||
|
|||
|
Re: What are you doing different from last year?
Quote:
My changes as a 3rd year programmer:
|
|
#7
|
|||
|
|||
|
Re: What are you doing different from last year?
Quote:
One of the things I like about the Flatten/Unflatten from XML is that all my variables are strongly typed in the robot, and I can reuse common names for things like PID gains since their parent typdef has a unique name. In addition, any changes I make to the typedefs themselves are transparent to the flattening process, so I don't need to make additional code changes. Are there similar benefits when using INI? |
|
#8
|
|||
|
|||
|
Re: What are you doing different from last year?
Quote:
|
|
#9
|
|||||
|
|||||
|
Re: What are you doing different from last year?
Quote:
A sample INI File is like this (with two sections, and associated key/value pairs): Code:
[pidConstants] p=.1 i=0 d=.01 [drivePID] p=.2 i=0 d=.02 Now, you could also use XML files to the same result, and I certainly won't stop you from doing that, but my personal opinion is that it's best to use an INI file in this situation. Actually, I'm not exactly sure the answer to that question. I know you can set the default value for data read from an INI file, but I'm not sure if/how to do it using a TypeDef. You might have to write a subVI. Hmmm, I'll have to think about that one. Last edited by plnyyanks : 09-01-2012 at 22:55. Reason: answered another question I missed the first time |
|
#10
|
|||
|
|||
|
Re: What are you doing different from last year?
Also look in the LabVIEW for FRC 2012 examples. There is a new example to show how the Configuration File API can be used.
|
|
#11
|
||||||
|
||||||
|
Re: What are you doing different from last year?
Quote:
I didn't see anything in the FRC section that seemed like it. Searching for Configuration found the Write Configuration Settings File and Read Configuration Settings File in Fundamentals\File Input and Output. |
|
#12
|
|||
|
|||
|
Re: What are you doing different from last year?
I'm not sure where it is in the example finder, but in the file system it's under examples/frc/file/read and write preferences or something close to that.
|
|
#13
|
||||||
|
||||||
|
Re: What are you doing different from last year?
I found it on the filesystem, but not in the example finder. I created a tracker.
|
|
#14
|
|||||
|
|||||
|
Re: What are you doing different from last year?
Quote:
To do this, all you have to do is flatten your data to a string and write that to the INI file, and then read it and unflatten it (just like you would with XML data). The only problem is that you can't read/edit the INI file in a text editor, but that problem is there whenever you use "flatten to string". Attached is some sample code to illustrate what I mean. |
|
#15
|
||||
|
||||
|
Re: What are you doing different from last year?
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|