Skip to main content
Skip table of contents

User Command Guide

Change Note

Type

Changes

Compatible Task Editor Module Version
(Release date)

1

NEW

First created. Interface design for ‘User Commands’ function.

v1.0.0

2

NEW

  • ‘gen_command_call’ API

    • Added gen_command_call API for User Command with return value

  • ‘Get / Watch Global / System Variables from Task Editor’ API

    • Add API to get current Global and System variables from Task Editor

v1.4.0

3

REMOVED

  • Remove the componentId in 'req_to_save_commands_def_as_sub_program” API.

    • Changed the DRL of User Command, which is a SubProgram, to call only one for each User Command module package.

    • TIP Therefore, only one DRL per module can be saved as a User Command, so all def functions must be included in one DRL.

v1.4.0

4

NEW

  • ‘gen_command_call’ API

    • Add the "validity" property to activating or inactivating the user command block within the task editor module.

      • Tip: You can deactivate a command if required data for a property is missing.

image-20241101-064114.png

v2.0.5

5

NEW

Release UserCommand V2

  • Provides the following features, which introduce a new approach while maintaining support for the existing V1 interface.

    • start_command_data_monitor

    • image-20250724-042857.png
    • update_task_data_to_monitor

    • command_data_validity_changed

    • get_conveyor_coordinates

    • changed_conveyor_coordinates

    • get_command_defined_data

    • changed_command_defined_data

v4.0.18

Overview

Task Editor is a default module included in Dart-Platform and User Command is one of the functions in this module.

What is the User Command?

The User Command module is ideal for adding new command blocks in the Task Editor module.

Advantages

  • Peripheral device vendors can provide user commands, allowing users to use peripheral devices directly in the task editor, in addition to connection and configuration functionalities (equivalent to skills in Dart-Platform 2.x).

  • A single module can offer multiple user commands.

스크린샷 2025-07-24 오전 10.28.31.png

 

스크린샷 2025-07-24 오전 10.28.56.png

1. Interface call relationship diagram

Interface version

Interface Version

Action
(Manifest.json)

Channel Events

V1

(Dart-Platform v3.2.0 or later & TaskEditor v2.x.x or before)

com.dart.module.taskeditor.action.USER_COMMAND

  • Supports SDK2 or higher.

  • get_current_data

  • data_changed

  • req_to_save_commands_def_as_sub_program

  • gen_command_call

  • get_variables

  • changed_variables

  • get_required_sub_program
    (Supports SDK3 or higher.)

V2

(Dart-Platform v3.4.0 or later & TaskEditor v4.0.18 or later)

com.dart.module.taskeditor.action.USER_COMMAND_V2

  • Supports SDK4 or higher.

Note.

When migrating to V2, simply replacing USER_COMMAND with USER_COMMAND_V2 will not ensure proper operation. You must reimplement the structure based on the new Channel Event definitions in the USER_COMMAND_V2 interface.

Supports the following interfaces in addition to V1.

  • start_command_data_monitor

  • stop_command_data_monitor

  • update_task_data_to_monitor

  • command_data_validity_changed

  • get_conveyor_coordinates

  • changed_conveyor_coordinates

  • get_command_defined_data

  • changed_command_defined_data

The Interface that User Command type module supports are following below.

Use Case

Description

1

List-up

  • Displays the module list of User Command type which is installed within the User Command category in Dart-Platform.

  • However, only the modules that provide interface Task Editor module requests are displayed.

2

Start a PiP Screen with/without saved data

  • If user selects random menu among the submenus of Use Command, it runs the PiP Screen of the slected User Command module and initializes the UI with the delivered data.

3

Get data from the PiP Screen

  • Delivers the entered value in the PiP Screen of selected User Command module to the Task Editor module.

4

Request save DRL Function Definition for the User Command to the Controller

  • Requests the registration of DRL Function Definition defined in User Command into Sub program in Controller.

  • Uses User Command by loading it via ‘sub_program_run()’ DRL within the Task Editor.

CODE
from DRCF import * // The import statement must be declared for the sub program
 
def pick(j1, j2, j3, ...)
     ...
     movej(posj(j1, j2, j3, …), …)
     ...
5

Generate Function Call of the User Command

  • Delivers the calling code of ‘DRL Function’ to Task Editor according to entered value by the user of each User Command.

CODE
dart_module_xxx_mycommands.pick(0,0,0, ...)

2. Detailed Definition on the Interface and its Example codes

Task Editor module considers defined component ‘com.dart.module.taskeditor.action.USER_COMMAND’ as module component that provides interface for ‘User Command’.

2-1) List-up

  • When: entering into Task writing screen of Task Editor module.

  • Purpose: To display User Command module block which is installed in Dart-Platform within the ‘User Commands’ Category.

  • Method: IModulePackageManager & Message

Type

Value

Description / Mandatory

action

Interface version V1

TYPESCRIPT
com.dart.module.taskeditor.action.USER_COMMAND

Action and Category info for Task Editor components.

The interface version and how it works (data structure) change based on the Action name.

O

Interface version V2 RECOMMENDED

TYPESCRIPT
com.dart.module.taskeditor.action.USER_COMMAND_V2

O

category

TYPESCRIPT
Context.CATEGORY_PIP_SCREEN (= “dart.message.category.PIP_SCREEN”)
Context.CATEGORY_SERVICE (= “dart.message.category.SERVICE”)

O

data

TYPESCRIPT
{
  endCommand: { 
    name: string;
    disallowedChildCommands?: {
        packageName: string;
        ids?: string[];
        directChildOnly?: boolean;
    }[]
  }
}

Declare when a Start–End command structure is required, as shown below.

image-20250724-042857.png
  • name: Display name of the End command

  • disallowedChildCommands: Define additional restricted command IDs under the Start–End command

X

Example code
  1. Use Command

JSON
// manifest.json
screens: [
  {
    "name": {Command name},
    "id": {pip-screen-component-id},
    "data": {
        "endCommand": { // Used when a Start–End command structure is required
            "name": "{End Command name}",
            "disallowedChildCommands": [
                {
                    "packageName": "com.dart.module.taskeditor",
                    "ids": ["movej", "movesj", "movejx"] // Disallow embedded Task Editor commands
                },
                {
                    "packageName": "com.dart.module.bridge.commands.conveyor",
                    "ids": ["ConveyorTracking"] // Disallow specific User Command commands
                }
            ]
        }
    },
    "messageFilters": [
      {
        "action": "com.dart.module.taskeditor.action.USER_COMMAND",
        "category": "dart.message.category.PIP_SCREEN"
      }
    ]
  }
],

services: [
  {
    "name": {Service component name},
    "id": {service-component-id},
    "messageFilters": [
      {
        "action": "com.dart.module.taskeditor.action.USER_COMMAND_V2", // or com.dart.module.taskeditor.action.USER_COMMAND
        "category": "dart.message.category.SERVICE"
      }
    ]
  }
]

  1. Task Editor

CODE
const message = new Message({action:"com.dart.module.taskeditor.action.USER_COMMAND", category: Context.CATEGORY_PIP_SCREEN});
const packageManager = this.moduleContext.getSystemManager(Context.MODULE_PACKAGE_MANAGER) as IModulePackageManager;
const resolveInfos = packageManager.queryModuleScreenInfo(message);
// Compose the sub menu of 'User Command' by using resolveInfos information

2-2) Start a PiP Screen with/without saved data

  • When: selecting ‘User Command’ block which is added within the task of Task Editor module

  • Purpose: To displaying the PRoperty of selected User Command (PiP Screen) and initialize data.

  • Method : IModuleScreenManager & Message

Type

Value

Description/Mandatory

componentId

componentId

Component ID information of the target PIP Screen

O

data

TYPESCRIPT
savedData: CommandData | undefined
  • It is a data delivered from User Command module via ‘2-3’ interface.

  • It is composed of key-value pair object which is defined in each User Command.

O

TYPESCRIPT
savedData: {
    data?: CommandData;
    validity: CommandDataValidity;
    summary: string;
    commandDefined?: {
        scope: CommandDefinedDataScope;
        conveyorCoordinates?: ConveyorCoordinatesData[];
        variables?: CommandDefinedVariable[];
        data?: CommandDefinedData;
    }
}
  • For User Command modules that use the Task Editor v2 interface, the data structure (GetDataV2Res) provided to the Task Editor module via get_current_data_v2 or data_changed_v2 is passed as-is when rendering the ModuleScreen.

O

TYPESCRIPT
savedVersion: string
  • Version of the User Command module used at the time of data storage

O

Example code
  1. User Command

CODE
class PipScreenForTaskEditor extends ModuleScreen { 
  componentDidMount() {
    // 1. At PiPScreen mount point, when saveData exists in message, UI initialization proceeds
    if (this.message && this.message.data.hasOwnProperty("savedData")) {
      const version = this.message.data["savedVersion"];
      const data = this.message.data["savedData"];
    }
  }
}

2. Task Editor

CODE
readonly handleOnClickMenu = (packageName: string) => { // packageName of User Command module that User selected
  // 1. Initialization of message obejct for PiPScreen execution of selected User Command module
  const message = new Message({action:"com.dart.module.taskeditor.action.USER_COMMAND", category: Context.CATEGORY_PIP_SCREEN, packageName});

  // 2. When loading the saved data to the screen, add data to message.data
  // const { data, version } = db.query(...);
  // message.data = { savedVersion: version, savedData: data};

  // 3. Request for execution and binding of PiPScreen
  const screenManager = this.moduleContext.getSystemManager(Context.MODULE_SCREEN_MANAGER) as IModuleScreenManager;
  screenManager.bindPipModuleScreen(message, this.refCotnainer.current, this.binder)
    .then(result => {
      if (!result) {
        // Exception handling is required on binding failure
      }
  });
}

private channel: IModuleChannel | null = null;
// 4. binder Initializaion
readonly binder: IModuleComponentBinder = {
  onBound: (packageName: string, componentId: string, channel: IModuleChannel) => {
    // Check whether the channel of binded User Command module component provides the event this Task Editor module needs
    if (!channel.containsOnAnotherSide(["get_current_data"]) {
      // Exception handling is needed on required event absence
    }
  }
}

2-3) Get data from PiP Screen

  • When: saving the task of Task Editor module

  • Purpose: To transmit and receive data in order to save the user’s entered value within Property (PiP Screen) of User command module into Task Editor DB.

  • Method: ModuleScreen & IModuleChannel

Type

Value

Description/Mandatory

Event Name

Parameter

Request: Task Editor

CODE
"get_current_data"

-

  • Event requesting the current input values of the User Command module’s PiP Screen

O

Response: User Command

CODE
CommandData
  • Responds with the currently entered data in the Property screen as key–value pairs.

Request: Task Editor V2

CODE
"get_current_data"

-

  • Event requesting the current input values of the User Command module’s PiP Screen

O

Response: User Command V2

TYPESCRIPT
{
    data?: CommandData;
    validity: CommandDataValidity;
    summary: string;
    commandDefined?: {
        scope: CommandDefinedDataScope;
        conveyorCoordinates?: ConveyorCoordinatesData[];
        variables?: CommandDefinedVariable[];
        data?: CommandDefinedData;
    }
}
  • data(optional): Data of the User Command module
    validity: Data validity, used to update the command status in the Task List based on this information

    • -1 : error

    • 0: invalid

    • 1: valid

  • summary: Summary information text of the Task List

    image-20250724-054855.png
  • commandDefined(optional): User Command creation data that can be referenced by the Task Editor or other User Commands.

    • scope: Scope of the data validity

      • 0: below – Commands declared below the current command and its child commands

      • 1: child – Only the child commands of the current command

    • conveyorCoordinates: Conveyor coordinates information defined in the User Command module

    • variables: Variable information defined in the User Command module

    • data: Customized data that can be referenced by other User Command modules

Send: User Command

TYPESCRIPT
"data_changed"

-

  • Event requesting the current input values of the User Command module’s PiP Screen

O

Recevie: Task Editor

CODE
CommandData

Send: User Command V2

TYPESCRIPT
"data_changed"

-

O

Recevie: Task Editor V2

TYPESCRIPT
{
    data?: CommandData;
    validity: CommandDataValidity;
    summary: string;
    commandDefined?: {
        scope: CommandDefinedDataScope;
        conveyorCoordinates?: ConveyorCoordinatesData[];
        variables?: CommandDefinedVariable[];
        data?: CommandDefinedData;
    }
}
Example code
  1. User Command

TYPESCRIPT
class PipScreenForTaskEditor extends ModuleScreen {
  onBind(message: Message, channel: IModuleChannel): boolean {
      ...
      // 1. Event Registration for receiving "get_current_data" event from Task Editor module
      channel.receive("get_current_data", () => {
          const data: Record<string, any> = {};

          // 2. Add data entered in PiPScreen to data object
          // data["..."] = ...;

          // 3. Deliver it to Task Editor module
          channel.send("get_current_data", data);
      });
      ...
      return true;
  }
  
  private dataChanged() {
    const currentEnteredData = ...;
    this.channel.send("data_changed", currentEnteredData);  
  }
}

2. Task Editor

TYPESCRIPT
getDataFromUserCommand = (channel: IModuleChannel, resolveInfo: IModuleResolveInfo) => {
  // 1. Event registration for receiving "get_current_data" response event from User Command
  channel.receive("get_current_data", (data?: Record<string, any>) => {
    if (data) {
      // 3-1. Version information of User Command module
      const version = resolveInfo.packageInfo.version;
      const packageName = resolveInfo.packageInfo.packageName;

      // 3-2. Save data and version information delivered from User Command module
      const db.insert/update(packageName, version, data);
    }
  });

  channel.receive("data_changed", (data?: Record<string, any>) => {
    if (data) {
      // 3-1. Version information of User Command module
      const version = resolveInfo.packageInfo.version;
      const packageName = resolveInfo.packageInfo.packageName;

      // 3-2. Save data and version information delivered from User Command module
      const db.insert/update(packageName, version, data);
    }
  });

  // 2. "get_current_data" event request to User Command module
  channel.send("get_current_data");
}

2-4) Request to save Commands Definition as sub program / Generate Command Call through ModuleService

  • When: generating DRL syntax for task execution in Task Editor module

  • Purpose : To transmit and receive the DRL syntax information on User Command used in Task.

  • Method : ModuleService & IModuleChannel

Sort

Value

Description/Mandatory

Event Name

Parameter

Request: Task Editor

CODE
"req_to_save_commands_def_as_sub_program"
TYPESCRIPT
{
  programName: string
}
  • Request event to save the Command Function Definition defined in the User Command as a sub program in the Controller

  • Only one request per User Command module package used within the task

O

Response: User Command

TYPESCRIPT
boolean
  • Receiving event of delivering the Command Function Definition saving result on Controller.

Request: Task Editor

CODE
"get_required_sub_program"
TYPESCRIPT
{
  // User Command's component id
  componentId: string;
  // User Command's saved data
  data: CommandData;
}
  • Event requesting subprogram (DRL) information from other modules required for the User Command’s subprogram execution.

X

Response: User Command

TYPESCRIPT
{
    // ModuleService's package name
    packageName: string;
    // ModuleService's component id
    componentId: string;
    // ModuleService's action
    action: string;
    // IModuleChannel's event to request to save a sub program
    eventName: string;
    // sub program's name
    programName: string;
    // options for the sub program
    options?: Record<string, any>;
}[] | null
  • Event receiving subprogram (DRL) information from other modules required for the User Command’s subprogram execution.

Request: Task Editor

CODE
"gen_command_call"
TYPESCRIPT
{
  componentId:string,
  data: CommandData,
  endCommand?: boolean // SDK4 이상
}

  • Request event of Command Function Call command generation based on the entered value by user on User Command.

CODE
i.e.) “pick(10,20,30,…)”

O

Response: User Command

TYPESCRIPT
string | {
  command: string,
  variableName: string,
  validity: boolean (default true)
}
  • Received event for Command Function Call with return value

e.g. default return value

CODE
{
   command: "pick(10,20,30,…)',
   variableName: "global_pos"
}

e.g. When the data is invalid and the DRL cannot be generated, the value should be provided as shown below.

CODE
{
   validity: false
}

An example DRL that is generated is as follows:

CODE
{variableName} = {subProgramInstance}.{command}

Request: Task Editor V2

CODE
"start_command_data_monitor"
TYPESCRIPT
{
  componentId: string;
  data: GetDataV2Res;
  taskData: TaskData;
}
  • Monitoring request event for the validity of command block data through the User Command’s (background) Service

  • The User Command’s Service must monitor the validity of the received data.
    If the data validity changes, it must send a command_data_validity_changed event to the Task Editor.

X

Response: User Command V2

TYPESCRIPT
string | null
  • Provides a monitoring ID for the Task Editor to update or stop monitoring-related data.

Request: Task Editor V2

CODE
"stop_command_data_monitor"
TYPESCRIPT
{
  id?: string;
}
  • Request event to stop monitoring the data validity corresponding to the received id.

If id is undefined, stop all monitoring.

X

Response: User Command V2

TYPESCRIPT
boolean
  • Response indicating the result of stopping data validity monitoring

Send: Task Editor V2

CODE
"update_task_data_to_monitor"
TYPESCRIPT
{
    id: string;
    taskData: TaskData;
}
  • Event that delivers updated task file data for data validity monitoring

X

Receive: User Command V2

Send: User Command V2

CODE
"command_data_validity_changed"
TYPESCRIPT
{
    id: string;
    validity: CommandDataValidity;
}
  • Event for notifying data validity changes during monitoring

X

Response: Task Editor V2

Example code
  1. User Command

CODE
class ServiceForTaskEditor extends ModuleService {
  onBind(message: Message, channel: IModuleChannel): boolean {
      ...
      // 1-1. Event registration for receiving "req_to_save_commands_def_as_sub_program" event from Task Editor module
      channel.receive("req_to_save_commands_def_as_sub_program", ({programName: string}) => {
          // 1-2. Generate Commands Definition for User Command execution
          const program = `
          from DRCF import *
          def pick(j1, j2, j3, ...):
              movej(posj(j1, j2, j3, ...), ...)
              ...
          
          def releaes(j1, j2, j3, ...):
              movej(posj(j1, j2, j3, ...), ...)
              ...
          `;

          const programManager = this.moduleContext.getSystemManager(Context.PROGRAM_MANAGER) as IProgramManager;
          programManager.saveSubProgram(PROGRAM_SAVE_MODE.SAVE, programName, program)
            .then(result => {
                // 1-3. Delivers the information on sub program saving result to Task Editor
                channel.send("req_to_save_commands_def_as_sub_program", result);
            });
      });

      // 2-1. Event registration for receiving "gen_command_call" event from Task Editor module
      channel.receive("gen_command_call", ({componentId: string, data: Record<string, any>}) => {
          // 2-2. About the appropriate Command for 'componentId', generates Command Function Call create command based on the data (user input) (The function must be existing on Command Definition registered at 1.2)
          const result = "..."; // i.e.) pick(10,20,30, ...);
          
          // // i.e) result sample with return variable 
          // // global_pos = pick(10,20,30,…)
          // const result = {
          //        command: "pick(10,20,30,…)',
          //        variableName: "global_pos"
          //      }
          
          // // i.e) result sample when it fail to generate DRL code. 
          // const result = {
          //        validity: false
          //      }
          
          // 2-3. Deliver result (string)
          channel.send("gen_command_call", result);
      });
      ...
      return true;
  }
}

  1. Task Editor

CODE
private bindToUserCommandService = (packageName: string) => {
  // 1. Define Message to bind with Service Component of target User Command module
  const message = new Message({action:"com.dart.module.taskeditor.action.USER_COMMAND", category: Context.CATEGORY_SERVICE, packageName });
 
  // 2. Binding request via IModuleServiceManager
  const serviceManager = this.moduleContext.getSystemManager(Context.MODULE_SERVICE_MANAGER);
  serviceManager.bindModuleService(message, this.binder)
    .then(result => {
      if (!result) {
        // Exception handling is required on binding failure
      } else if (!channel.containsOnAnotherSide(["req_to_save_commands_def_as_sub_program", "gen_command_call"]) {
        // Exception handling is needed on event absence Task Editor module requires
      } else {
        // do something
      }
  });
}

private channel: IModuleChannel | null = null;
private binder: IModuleComponentBinder = {
   onBound: (packageName: string, componentId: string, channel: IModuleChannel) => {
      this.channel = channel
  },
  onUnbound(packageName: string, componentId: string): void {
      this.channel = null;
  }
}

// When running task, request to register the function definition file on User Commands which are used in the Task, as Sub Program directly to the Controller with User Command module
private reqToSaveCommandDefAsSubProgram = (channel: IModuleComponentBinder, commandModulePackageName: string, componentId: string) => {
  // 3. Event register for receiving "gen_drl_function_definition" response from User Command module
  const subProgramName = `${commandModulePackageName.replaceAll(".", "_")}_commands`;
  channel.receive("req_to_save_commands_def_as_sub_program", (result: boolean) => {
    if (result) {
       // 5-1. If User Commands successes to save sub program, add DRL command that loads the sub program from the top of the task of Task Editor
       // i.e.) Statements such as "xxxCommands = sub_program_run("subProgramName"")" must be added on the top of the DRL program data
    } else {
       // 5-2. Handling exceptions that prevent DRL execution due to the User Command issue
    }
  });
  
  // 4. "req_to_save_dommands_def_as_sub_program" event request to User Command module
  channel.send("req_to_save_commands_def_as_sub_program", {programName: subProgramName});
}

// When running task, adding Function Call statement is needed for operation of each User Command (Required for each User Command added within the task)
private generateDrlFunctionCall = (channel: IModuleComponentBinder, componentId: string, data: Record<string, any>) => {

  // 6. Event registration for receiving "gen_command_call" response from User Command module
  channel.receive("gen_command_call", (cmdCallFunc: string | null) => {
    if (cmdCallFunc) {
      // 8. Add call syntax by combining cmdCallFunc value delivered from User Command module and variable value loaded Command program of 5-1
      // i.e.) Assuming cmdCallFunc is 'pick(10, 20, 30, ...)', DRL syntax xxxCommands.pick(10, 20, 30, ...) must be added
    } else {
      5-2. Handling exception occurred by Command Call Function generation failure of User Command
    }
  });

  // 7. "gen_command_call" event request to User Command module
  channel.send("gen_drl_function_call", {componentId: componentId, data: data});
}

2-5) Get / Watch Global / System Variables from Task Editor

  • When: selecting the ‘User Command’ block added within the task of the Task Editor module

  • Purpose: Provide variables to store result values in the Property (PiP Screen) of the selected User Command

  • Method: IModuleScreenManager & Message

Type

Value

Description/Mandatory

Event Name

Parameter

Request: User Command

CODE
"get_variables"

-

  • Event to request the list of System, Global, and Define variables declared in the current task file

CODE
division
- 0: system
- 1: global or define

type
- bool:0, int:1, float:2, string:3:, posj:4, posx:5, list:6, unknown:7

coordinates
- base:0, tool:1, world:2, user: 101 ~ 200

X

Response: Task Editor

TYPESCRIPT
{
  name: string;
  division: 0|1;
  type: SystemVariableType;
  data: string;
  coordinates: CoordinateSystem | number;
}[]

Request: User Command V2

CODE
"get_variables"

-

X

Response: Task Editor V2

TYPESCRIPT
{
  name: string;
  division: VariableDivision;
  type: VariableType;
  data: string;
  coordinates?: CoordinateSystem | number | string; // conveyor coordinates 는 string
}[]
  • Add define and command_defined types to division.

  • Include commandDefined - variable data received through get_current_data_v2 and data_changed_v2.

CODE
division
- 0: system
- 1: global
- 2: define
- 3: command_defined

type
- bool:0, int:1, float:2, string:3:, posj:4, posx:5, list:6, unknown:7
- conveyor posx: 0x0001_0001

coordinates
- base:0, tool:1, world:2, user: 101 ~ 200, conveyor: string

Send: Task Editor

CODE
"changed_variables"
TYPESCRIPT
{
  name: string;
  division: 0|1;
  type: SystemVariableType;
  data: string;
  coordinates: CoordinateSystem | number;
}[]
  • Event to notify when the list of System, Global, and Define variables declared in the current task file has changed

X

Receive: User Command

Send: Task Editor V2

CODE
"changed_variables"
TYPESCRIPT
{
  name: string;
  division: VariableDivision;
  type: VariableType;
  data: string;
  coordinates?: CoordinateSystem | number | string; // conveyor coordinates 는 string
}[]
  • Event to notify when the list of System, Global, and Define variables declared in the current task file has changed

X

Receive: User Command V2

Request: User Command V2

CODE
"get_conveyor_coordinates"

-

  • Event requesting conveyorCoordinates data obtained through get_current_data and data_changed.

  • The data returned must be limited to what the requesting command can access, as defined by the commandDefined scope.

X

Response: Task Editor V2

TYPESCRIPT
ConveyorCoordinatesData[]

Send: Task Editor V2

CODE
"changed_conveyor_coordinates"
TYPESCRIPT
ConveyorCoordinatesData[] 
  • Event to notify changes in the list of Conveyor Coordinates declared in the current task file

X

Receive: User Command V2

Request: User Command V2

CODE
"get_command_defined_data"

-

  • Event requesting commandDefined data received via get_current_data and data_changed.

  • Only data accessible to the requested command must be provided, based on the commandDefined scope.

X

Response: Task Editor V2

TYPESCRIPT
SharedCommandDefinedData[]

Send: Task Editor V2

CODE
"changed_command_defined_data"
TYPESCRIPT
SharedCommandDefinedData[]
  • Event notifying changes to the commandDefined data accessible by the command

X

Receive: User Command V2

Reference: Data type definitions

TYPESCRIPT
import { ConveyorCoordinates, ConveyorDistance, ConveyorEnv, ConveyorWorkpieceContainerType, CoordinateSystem, ExternalEncoderChannel, ExternalEncoderModeData, ExternalEncoderPolarityData, ManipulatorPose, SixNumArray, SystemVariableType } from "dart-api";

export const ACTION_USER_COMMAND_SERVICE = "com.dart.module.taskeditor.action.USER_COMMAND_V2";

export const TaskEditorScreenEvent = {
    GET_VARIABLES: "get_variables",
    CHANGED_VARIABLES: "changed_variables",
    GET_CONVEYOR_COORDINATES: "get_conveyor_coordinates",
    CHANGED_CONVEYOR_COORDINATES: "changed_conveyor_coordinates",
    GET_COMMAND_DEFINED_DATA: "get_command_defined_data",
    CHANGED_COMMAND_DEFINED_DATA: "changed_command_defined_data"
};

export const UserCommandScreenEvent = {
    SAVED_DATA: "savedData",
    SAVED_VERSION: "savedVersion",
    GET_DATA: "get_current_data",
    DATA_CHANGED: "data_changed",
};

export const UserCommandServiceEvent = {
    SAVE_SUB_PROGRAM: "req_to_save_commands_def_as_sub_program",
    GET_REQUIRED_SUB_PROGRAM: "get_required_sub_program",
    GEN_COMMAND_CALL: "gen_command_call",
    START_COMMAND_DATA_MONITOR: "start_command_data_monitor",
    STOP_COMMAND_DATA_MONITOR: "stop_command_data_monitor",
    UPDATE_TASK_DATA_TO_MONITOR: "update_task_data_to_monitor",
    COMMAND_DATA_VALIDITY_CHANGED: "command_data_validity_changed"
};


///////////////////////////// [START] Common /////////////////////////////
export const CommandDataValidity = {
    ERROR: -1,
    INVALID: 0,
    VALID: 1
} as const;
export type CommandDataValidity = typeof CommandDataValidity[keyof typeof CommandDataValidity];

export const VariableDivision = {
    SYSTEM: 0,
    GLOBAL: 1,
    DEFINE: 2,
    COMMAND_DEFINED: 3
} as const;
export type VariableDivision = typeof VariableDivision[keyof typeof VariableDivision];

export const VariableType = {
    ...SystemVariableType,
    CONVEYOR: 0x0001_0001
} as const;
export type VariableType = typeof VariableType[keyof typeof VariableType];

export const UserCommandDefinedDataScope = {
    ALL: 0,
    BELOW: 1,
    CHILD: 2
} as const;
export type UserCommandDefinedDataScope = typeof UserCommandDefinedDataScope[keyof typeof UserCommandDefinedDataScope];

export type TaskEditorVariable = {
    name: string;
    division: typeof VariableDivision.SYSTEM | typeof VariableDivision.GLOBAL;
    type: SystemVariableType;
    data: string;
    coordinates?: CoordinateSystem | number;
};

export type TaskEditorVariableV2 = {
    name: string;
    division: VariableDivision;
    type: VariableType;
    data: string;
    coordinates?: CoordinateSystem | number | string;
};

export type TaskEditorPoseVariable = Omit<TaskEditorVariableV2, "data"> & {
    data: SixNumArray;
}

export type CommandDefinedVariable = Omit<TaskEditorVariableV2, "division"> & {
    division: typeof VariableDivision.COMMAND_DEFINED
};

export type CommandData = Record<string, any>;

export type CommandDefinedData = {
    packageName: string;
    componentId: string;
    data: Record<string, any>;
};

export type SharedCommandDefinedData = CommandDefinedData & {
    providerPath: string; // added by Task Editor
};

export type ConveyorCoordinatesData = {
    name: string;
    containerType: ConveyorWorkpieceContainerType;
    timeout?: number;
    offsetCoordinates?: {
        pose?: ManipulatorPose;
        variable?: string;
    }
    encoder: ExternalEncoderModeData & ExternalEncoderPolarityData & {
        channel: ExternalEncoderChannel;
    }
    conveyor: {
        name: string;
        env: ConveyorEnv;
        coordinates: ConveyorCoordinates;
        distance: ConveyorDistance;
    }
};

export type TaskData = {
    variables: TaskEditorVariableV2[];
    conveyorCoordinates: ConveyorCoordinatesData[];
    commandDefinedData: SharedCommandDefinedData[];
};

export type MonitorId = string;
///////////////////////////// [END] Common /////////////////////////////


///////////////////////////// [START] TaskEditorScreen /////////////////////////////
// [START] TaskEditorScreenEvent.GET_VARIABLES / CHANGED_VARIABLES
export type GetVariableReq = undefined;
export type GetVariableRes = TaskEditorVariable[];
export type GetVariableV2Req = undefined;
export type GetVariableV2Res = TaskEditorVariableV2[];
// [END] TaskEditorScreenEvent.GET_VARIABLES / CHANGED_VARIABLES

// [START] TaskEditorScreenEvent.GET_CONVEYOR_COORDINATES / CHANGED_CONVEYOR_COORDINATES
export type GetConveyorCoordinatesReq = undefined;
export type GetConveyorCoordinatesRes = ConveyorCoordinatesData[];
// [END] TaskEditorScreenEvent.GET_CONVEYOR_COORDINATES / CHANGED_CONVEYOR_COORDINATES

// [START] TaskEditorScreenEvent.GET_COMMAND_DEFINED_DATA / CHANGED_COMMAND_DEFINED_DATA
export type getCommandDefinedDataReq = undefined;
export type getCommandDefinedDataRes = SharedCommandDefinedData[];
// [END] TaskEditorScreenEvent.GET_COMMAND_DEFINED_DATA / CHANGED_COMMAND_DEFINED_DATA
///////////////////////////// [END] TaskEditorScreen /////////////////////////////


///////////////////////////// [START] UserCommandScreen /////////////////////////////
// [START] UserCommandScreenEvent.GET_DATA / DATA_CHANGED
export type GetDataReq = undefined;
export type GetDataRes = CommandData | undefined;

export type GetDataV2Req = undefined;
export type GetDataV2Res = {
    data?: CommandData;
    validity: CommandDataValidity;
    summary: string;
    commandDefined?: {
        scope: UserCommandDefinedDataScope;
        conveyorCoordinates?: ConveyorCoordinatesData[];
        variables?: CommandDefinedVariable[];
        data?: CommandDefinedData;
    }
};
// [END] UserCommandScreenEvent.GET_DATA / DATA_CHANGED
///////////////////////////// [END] UserCommandScreen /////////////////////////////

///////////////////////////// [START] UserCommandService /////////////////////////////
// [START] UserCommandServiceEvent.SAVE_SUB_PROGRAM
export type SaveSubProgramReq = {
    programName: string;
};
export type SaveSubProgramRes = boolean;
// [END] UserCommandServiceEvent.SAVE_SUB_PROGRAM

// [START] UserCommandServiceEvent.GET_REQUIRED_SUB_PROGRAM
export type GetRequiredSubProgramReq = {
    // User Command's component id
    componentId: string;
    // User Command's saved data
    data: CommandData;
};
export type GetRequiredSubProgramRes = null | {
    // ModuleService's package name
    packageName: string;
    // ModuleService's component id
    componentId: string;
    // ModuleService's action
    action: string;
    // IModuleChannel's event to request to save a sub program
    eventName: string;
    // sub program's name
    programName: string;
    // options for the sub program
    options?: Record<string, any>;
}[];
// [END] UserCommandServiceEvent.GET_REQUIRED_SUB_PROGRAM

// [START] UserCommandServiceEvent.GEN_COMMAND_CALL
export type GenCommandCallReq = {
    componentId: string;
    data: CommandData;
    endCommand?: boolean;
};
export type GenCommandCallRes = string | {
    command?: string;
    validity?: boolean;
    variableName?: string;
};
// [END] UserCommandServiceEvent.GEN_COMMAND_CALL

// [START] UserCommandServiceEvent.START_COMMAND_DATA_MONITOR
export type StartCommandDataMonitorReq = {
    componentId: string;
    data: GetDataV2Res;
    taskData: TaskData;
};
export type StartCommandDataMonitorRes = MonitorId | null;
// [END] UserCommandServiceEvent.START_COMMAND_DATA_MONITOR

// [START] UserCommandServiceEvent.STOP_COMMAND_DATA_MONITOR
export type StopCommandDataMonitorReq = {
    id?: MonitorId;
};
export type StopCommandDataMonitorRes = boolean;
// [END] UserCommandServiceEvent.STOP_COMMAND_DATA_MONITOR

// [START] UserCommandServiceEvent.UPDATE_TASK_DATA_TO_MONITOR
export type UpdateTaskDataToMonitorReq = {
    id: MonitorId;
    taskData: TaskData;
};
// [END] UserCommandServiceEvent.UPDATE_TASK_DATA_TO_MONITOR

// [START] UserCommandServiceEvent.COMMAND_DATA_VALIDITY_CHANGED
export type CommandDataValidityChangedRes = {
    id: MonitorId;
    validity: CommandDataValidity;
};
// [END] UserCommandServiceEvent.COMMAND_DATA_VALIDITY_CHANGED
///////////////////////////// [END] UserCommandService /////////////////////////////
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.