Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, Clipboard, and Errors
   Dialog Functions
   Platform and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Global objects
    settings
    controller
    session
    python
   Collections
    array
    map
    bytes
   File Format I/O
    image_data
    image_stream
   Utils
    crypto
    timer
   Comm
    serial
   Dialogs
    file_open
    file_save
    msg_ok
    msg_ok_cancel
    msg_yes_no
    msg_password
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:objects:controller

controller

`controller` is a built-in global object for reading basic controller state and sending basic controller commands.

It is used directly by name. Do not call `controller()`.

Controller commands affect the connected machine controller. Use them only in scripts where that behavior is intentional.

Constructor

`controller` is a predefined global object. It is not created with a constructor.

Item Description
Syntax `controller`
Arguments not applicable
Returns controller object
print(controller.name);

Properties

Properties are read-only snapshots of current controller state.

Property Type Description
`is_connected` boolean `true` when the host has an active controller connection.
`serial` number Current controller serial number.
`version` number Current main controller firmware version.
`name` string Current controller device kind/name.
`e_stop` boolean `true` when controller E-stop state is active.

Example:

print('controller: ', controller.name);
print('serial: ', controller.serial);
print('version: ', controller.version);
print('connected: ', controller.is_connected);
print('e-stop: ', controller.e_stop);

Common Object Methods

to_string()

Returns a display string for the object.

Item Description
Syntax `value.to_string()`
Arguments none
Returns string

Example:

text = value.to_string();

`clone()` is not supported for `controller`.

Methods

reset()

Sends a reset command to the controller.

Item Description
Syntax `controller.reset()`
Arguments none
Returns result value

The returned result indicates whether the host accepted and sent the command successfully.

result = controller.reset();
print(result);

e_stop()

Requests controller E-stop.

Item Description
Syntax `controller.e_stop()`
Arguments none
Returns result value

This command activates E-stop. It is not a replacement for physical safety wiring or operator safety procedures.

result = controller.e_stop();
print(result);

Assignment

`controller` is a protected built-in global name. The name itself cannot be overwritten.

controller = 1;     // error

Use `controller` methods to request controller actions.

Example

if (controller.is_connected)
{
    print('Connected to ', controller.name, ', serial ', controller.serial);
 
    if (controller.e_stop)
    {
        print('Controller is in E-stop');
    }
}
else
{
    print('Controller is not connected');
}

Previous: settings

Next: session

exprv4/reference/objects/controller.txt · Last modified: by 127.0.0.1

Page Tools