Main Content

Virtual Control Panel

vrdemo_panel example shows the use of sensing objects that are available in the 3D World Editor Components library. These objects combine VRML sensors whose values can be read into Simulink® by the VR Source block with logic (implemented using VRML Scripts and Routes) that changes their visual appearance based on user input.

The control panel contains a pushbutton, switch button, toggle switch and a 2D setpoint selection area. Outputs of these elements are read into Simulink model and subsequently either displayed using standard sinks, or used as inputs of blocks that control back some objects in the virtual world.

Pushbutton, switch button and toggle switch have the state outputs, which are of boolean type. Their values are displayed using the Scope.

Two outputs of the 2D setpoint area are used to achieve the desired behaviour. The value of the "SetPoint_Changed" eventOut is continuously updated when the pointer is over the sensor area. This value is triggered by the second output - "isActive" that is true only on pressing the pointer button. Triggered value - coordinates of the active point on the sensor plane are sent back to the virtual world in two ways - as a position of green cone marker and as a text displayed on the control panel using Simulink string signal.