We are using Java on the robot and the Labview dashboard program. We don’t know much about Labview but have customized the DB by adding simple display controls and setting values from Java with SmartDashboard.PutXXX calls. The Labview DB has a drop down list that allows the DS operator to select which camera feed to display. We’d like to be able to do that camera choice (and switch on the fly) with a joystick button. I’m drawing a blank on how to change the setting of the camera selection drop down control from the Java code monitoring the joystick or if there is a way to have the DB LV code monitor the joystick and change the camera display. I’m sure there is a way to do this but its outside our LV capability at this moment. Any help would be appreciated.
If the camera selector already does what you want, the task isn’t hard, but will involve a little code in each language.
In Java, on the robot, read the joystick and update a Smart Dashboard variable that represents the desired camera state.
On the DB, in LV, in the top loop, you will want to read the Smart Dashboard variable by name and update the LabVIEW control using a local variable update. The top loop already has several reads of the joystick and motors. You can drop another by right clicking on the diagram and going to the bottom of the palettes. Drop the SD Read Value, choose the correct type from the selector, and wire up the name of the SD Variable.
In the second loop, where the vision is performed, you can right click on the blue Vision terminal and choose to Create >> Local Variable. Drop it into the top loop downstream of the SD Read. Wire the output of the read to the local variable. Add any mapping math to either the Java or Dashboard.
Greg McKaskle
Greg,
Thanks for the detailed answer. I think I understand and I have coded up your suggestion. Will test it later today.
Greg,
That worked like a charm.