:lang: en
:toc:

[[cha:qtvcp-vcp-panels]]
= QtVCP Virtual Control Panels

// Custom lang highlight
// must come after the doc title, to work around a bug in asciidoc 8.6.6
:ini: {basebackend@docbook:'':ini}
:hal: {basebackend@docbook:'':hal}
:ngc: {basebackend@docbook:'':ngc}

QtVCP is an infrastructure to display a custom CNC screen or control
panel in LinuxCNC. +
It displays a UI file built with the QTDesigner screen editor or combines
this with python programming to create a VCP Panel. +
QtVCP is completely customizable - you can add different buttons and
status LEDs etc. or add python code for even finer grain customization.

== Builtin panels

There are several builtin HAL panels available. +
in a  terminal type 'qtvcp list' <return> to see a list. +

=== copy

used for copying QtVCP's builtin screen/panels/vismach code to a folder
so one can customize it.

In a terminal:

[source,{hal}]
----
qtvcp copy
----

.copy Dialog - Copy QtVCP's builtin Screen, Panel or Vismach code
image::images/qtvcp_copy_dialog.png["Copy Dialog",align="left"]

=== test_dial

- This panel has a dial that adjusts S32 and Float HAL output pins. +
- The dial's range can be adjusted from a drop down menu. +
- The output can be scaled with the spinbox. +
- A combobox can be used to automatically select and connect to a signal.

[source,{hal}]
----
loadusr qtvcp test_dial
----

.test dial - Test Dial VCP
image::images/qtvcp_test_dial.png["Test Dial",align="left"]

=== test_led

- This panel has an LED that can selected to watch HAL bit pins/signals. +
- The LED's color can be adjusted from a drop down menu. +
- The text box and state can be output as speech if sound is selected. +
- A combobox can be used to automatically select and connect to a pin/signal. +
- You can add more LEDs from the drop down menu. +
- The LED can be detached from the main windows.

Here is how to load test_led from a HAL script. +
The '-o' switch sets how many LEDs the panel starts with. +
(If loading directly from a terminal omit the 'loadusr')

[source,{hal}]
----
loadusr qtvcp test_led
loadusr qtvcp -o 4 test_led
----

.test dial - Test Dial VCP
image::images/qtvcp_test_led.png["Test LED",align="left"]

=== test_panel

- collect of useful widgets for testing HAL component. Including speech
  of LED state.

[source,{hal}]
----
loadusr qtvcp test_panel
----

.test panel - Test Panel VCP
image::images/test_panel.png["Test Panel",align="left"]

=== cam_align

- a camera display widget for rotational alignment

.QtVCP cam align- Camera based alignment panel
image::images/qtvcp-cam-align.png["Qt Camera Alignment",align="left"]

=== sim_panel

- a small control panel to simulate MPG jogging controls etc. for
  simulated configurations

[source,{hal}]
----
loadusr qtvcp sim_panel
----

.QtVCP sim panel - Simulated controls for screen testing.
image::images/qtvcp_sim_panel.png["Sim Panel",align="left"]

[[cha:qtvcp-vismach-panels]]

=== vismach_mill_xyz

- 3d openGL view of a 3 axis milling machine

[source,{hal}]
----
loadusr qtvcp vismach_mill_xyz
----

.QtVCP vismach- 3 Axis Mill panel
image::images/qtvismach.png["QtVCP Vismach Mill",align="left"]

=== vismach_scara

- 3d openGL view of a scara based milling machine

[source,{hal}]
----
loadusr qtvcp vismach_scara
----

.QtVCP vismach- 3 Axis Mill panel
image::images/qtvismach_scara.png["QtVCP Vismach Scara",align="left"]

=== vismach_millturn

- 3d openGL view of a 3 axis milling machine with an A axis/spindle

[source,{hal}]
----
loadusr qtvcp vismach_millturn
----

.QtVCP vismach- 3 Axis Mill panel
image::images/qtvismach_millturn.png["QtVCP Vismach MillTurn",align="left"]

=== vismach_mill_5axis_gantry

- 3d openGL view of a 5 axis gantry type milling machine

[source,{hal}]
----
loadusr qtvcp vismach_mill_5axis_gantry
----

.QtVCP vismach- 3 Axis Mill panel
image::images/qtvismach_5axis_gantry.png["QtVCP Vismach 5 Axis Gantry",align="left"]

=== vismach_fanuc_200f

- 3d openGL view of a 6 joint robotic arm.

[source,{hal}]
----
loadusr qtvcp vismach_fanuc_200f
----

.QtVCP vismach- 6 Joint Robotic Arm
image::images/qtvismach_fanuc_200f.png["QtVCP 6 Joint Robotic Arm",align="left"]


=== tool_dialog

- manual toolchange dialog that gives tool description.

[source,{hal}]
----
loadusr -Wn tool_dialog qtvcp -o speak_on -o audio_on tool_dialog
----

Options:

* -o notify_on -use desktop notify dialogs instead of qtvcp native ones.
* -o audio_on -play sound on tool change
* -o speak_on -speak announcement of tool change

.QtVCP tool dialog - Manual Tool Change Dialog
image::images/qtvcp_toolChange.png["Tool Change Dialog",align="left"]

== Custom Panels

You can of course make your own panel and load it. +
If you made a ui file named 'my_panel.ui' and name the following HAL
file, 'my_panel.hal' +
You would then load this from a terminal with halrun -I -f my_panel.hal +

[source,{hal}]
----
# load realtime components
loadrt threads 
loadrt classicladder_rt

# load user space programs
loadusr classicladder
loadusr -Wn my_panel qtvcp my_panel.ui

# add components to thread
addf classicladder.0.refresh thread1


# connect pins
net bit-input1     test_panel.checkbox_1        classicladder.0.in-00
net bit-hide       test_panel.checkbox_4        classicladder.0.hide_gui

net bit-output1    test_panel.led_1             classicladder.0.out-00

net s32-in1        test_panel.doublescale_1-s   classicladder.0.s32in-00

# start thread
start
----

In this case we load qtvcp using -Wn; which waits for the panel to
finish loading before continuing to run the next HAL command. This is so
the HAL pins from the panel are finished in case the are used in the
rest of the file.


== More Information

<<cha:qtvcp-widgets,QtVCP Widgets>>

<<cha:qtvcp-libraries,QtVCP Libraries>>

<<cha:qtvcp-code,QtVCP Handler File Code Snippets>>

<<cha:qtvcp-development,QtVCP Development>>

<<cha:qtvcp-custom-widgets,QtVCP Custom Designer Widgets>>

// vim: set syntax=asciidoc:
