Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Switch Camera in Labview Dashboard with Joystick (http://www.chiefdelphi.com/forums/showthread.php?t=133889)

Crossle86 02-02-2015 23:29

Switch Camera in Labview Dashboard with Joystick
 
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.

Greg McKaskle 03-02-2015 06:52

Re: Switch Camera in Labview Dashboard with Joystick
 
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

Crossle86 03-02-2015 14:24

Re: Switch Camera in Labview Dashboard with Joystick
 
Greg,
Thanks for the detailed answer. I think I understand and I have coded up your suggestion. Will test it later today.

Crossle86 04-02-2015 13:08

Re: Switch Camera in Labview Dashboard with Joystick
 
Greg,
That worked like a charm.


All times are GMT -5. The time now is 10:27.

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