|
Re: LabView code of other teams ?
Globals have a bad reputation. If used properly, they are fine, and often the best and most efficient method of sharing data. If used improperly, they will cause race conditions. Because they also represent a data copy operation, they can cause lag, but so will most other sharing mechanisms.
Simply opening the encoder and configuring it will make it available on the LV dashboard in test mode. That may be good enough for diagnostics, but not for driving feedback.
Sharing data to the dashboard is accomplished by reading the encoder and writing it to a SmartDashboard variable. On the dashboard the encoder will be in the Variables tab automatically. If you want it in your own display element, drop one in either Operation or Auto tabs and give it the name of the SD variable. Those tabs default to binding to SD variables using the control name. If you want other tabs to bind to SD, add them to the array on the block diagram.
For more sophisticated displays, you may instead choose to do an explicit read on the dashboard, do the calculation or combination of data, and update the display elements yourself. A good example of this would be graphing left versus right or doing other calculations and displays of encoder data. The top loop is a pretty good place for code like this. You could also make your own loop.
WPIEnhanced... is telling the driver station how the Cypress I/O board pins are to be configured. This can be done interactively on the I/O tab of the DS. It can also be done at runtime from the robot as they demonstrate.
Greg McKaskle
|