|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
||||
|
||||
|
Re: pic: Killer Bees 2011 Robot - Buzz XVI
Quote:
|
|
#47
|
|||||
|
|||||
|
Re: pic: Killer Bees 2011 Robot - Buzz XVI
Quote:
2. Beescript. I wrote it myself (and named it after Bees, of course). Basically, I read a text file on the cRio (which I upload via FTP), and separate it into an array of lines, and then do this: If the line starts with a #, skip it (it's a comment) If the line has <3 characters, skip it (it's probably a space or blank). Else, tokenize by spaces into an array of words, lookup the first word in an array to find the index, then look through another array of commands to find the command ref. Call it by ref, with the rest of the array as the argument (you have to use strict-type VI refs to do this). Each command has the argument array input, and then looks through the arguments to find the ones it wants(usually by assuming the first argument is X, the second is Y, etc.), and uses those to run what it runs. Upon entering auto, it populates the array, with each command having the command name and the ref in an array (look at the WPI refnum registries for an example of how to do this). 3. State-machines. I have an array of cal points, each of which has an elevator height and arm position. I also have an enumerated type which defines the state. I double-buffer the state to handle going over backwards and forwards, since those use collision avoidance. I take the resulting state and lookup the position in the array (since enumerated variables can be used as unsigned int's) and also have a few special states which I further process (especially the score positions, which have score sequencing). I have a single get-set VI which handles state storage, double-buffering, and initialization. If it is disabled, it will uninitialized, and a command must be sent to re-initialize. The motors will be set to 0 if it is not initialized, this is a safety feature. Simple: I use an enum and an array of positions, then lookup the position in the array. I also have a large case structure for special cases. 3a. I also have a few VI's that run after the state-machine, one which actually does P control to determine motors speeds, another which prevents the window motors from stalling (we have a few states which hit mechanical limits, so we drive the setpoint past the mechanical stop then kill it after it stalls to prevent PTC-tripping), and a third handles manual override. 3b. Since we have two robots (competition and practice), I translate all of the sensor inputs into inches and degrees, so I can use a single set of calibration data on both robots. |
|
#48
|
||||
|
||||
|
Re: pic: Killer Bees 2011 Robot - Buzz XVI
Ahhhh... you are a most clever code monkey...
that is much more than I am willing to take on at the moment, but we do have a few key variable data that needs to be tweaked and tested. I will look at what you have provided, and try to coach up the team. I have done this in the PLC world with servo controllers, where the servo is programmed to do one move with variable data, and I just adjust the data as required. Can you point me to where the data file should be placed on the cRio directory structure, and what type of file to create... standard text I am guessing is ok? I will google around later today. |
|
#49
|
|||||
|
|||||
|
Re: pic: Killer Bees 2011 Robot - Buzz XVI
If you FTP to the cRio, you can pick your directory. I put mine in /ni-rt/startup but the path in LabVIEW is c:\ni-rt\startup for some reason.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|