Developing a User Command
Overview
User Command refers to various commands that operate on the robot. User Command operates in the Task Editor module that is installed by default in the Dart-Platform, and can create a number of commands necessary for robot operation, such as basic motion, communication, and control of the robot.
User Command can be operated using DRL, and can not only be used independently in the Task Editor, but can also be used in conjunction with the installed module of the Dart-Platform.


How to develop User Command in the project
This guide will provide a detailed overview of implementing a general User Command, using the DIO Gripper Module sample as a reference. It includes clear explanations and examples to enhance understanding.
Github - User Command Samples
To develop a User Command module, the following five parts must be implemented:
Step 1. User Command List-up
Define the Screen and Service of the User Command with their identifiers (componentId). This is used in the Task Editor > Command tab to display the command list and show the screen when a command block is clicked.
Step 2. Sub Program Implementation
Create a DRL file and define one def function for each User Command.
Step 3. Sub Program Run Implementation
In the Task Editor > Property tab, retrieve the stored values entered by the user and add them as parameters to the def function to generate the execution statement (text).
Step 4. PIP Screen Implementation
Construct the screen displayed in the Task Editor > Property tab. The data entered by the user on the screen is saved in the Task Editor as savedData.
Step 5. Returning Screens and Services
Link each screen and service according to their identifiers (componentId).
1. User Command List Up (manifest.json)
Source | |
Purpose |
|
Description | The items included in this manifest are divided into two categories: screens and services. |
Implementation | |
1.Screens | This is the User Command content that will be displayed in the Task editor. It is used for displaying and listing the PIP Screen.
CODE
|
2.Services | This service is used to deliver the list of User Commands and is used in Sub Program Run.
Note The id of the command service must be the same as the id defined in screens.
CODE
|
2. Sub Program Implementation (*.drl)
Source | |
Purpose | Implement the DRL file corresponding to the Sub Program |
Description |
|
3. Sub Program Run Implementation (UserCommandService.ts)
Source | com.sample.diogripper/com.sample.diogripper/src/UserCommandService/UserCommandService.ts |
Purpose | Implement an interface to run Sub Program |
Required Include Files |
CODE
|
Description | This is a class for loading the Sub Program corresponding to the User Command. It is implemented by extending ModuleService in Dart-APIs. |
Implementation | |
1.file_read | Function for reading the DRL file.
CODE
|
2.onBind | This is the part where the function that is linked with Task Editor Module is defined. It receives commands from the channel (from Task Editor Module) and defines the corresponding conten
CODE
|
3.ProgramManager | It is declared to save SubProgram.
CODE
|
4.req_to_save_ | This is the event for retrieving the DRL code content corresponding to the User Command. In the function declarations that correspond to the Sub Program, Once the DRL code is completed, use the saveSubProgram function of the ProgramManager to download the Sub Program. At this time, the result can be confirmed with the result using .then, and this result is delivered to the Task Editor side.
CODE
|
5.gen_command_call (componentId, data) | This is the event for creating the execution statement of the User Command.
When running the event, create separate execution statements according to componentId.
Info. When the data is invalid and the DRL cannot be generated, you should return the value should be provided as shown below. ![]()
CODE
CODE
|
4. PIP Screen Implementation (PIPScreen.tsx)
Source | com.sample.diogripper/com.sample.diogripper/src/UserCommand_PiPScreen/PIPScreen.tsx |
Purpose | Display the properties of the selected User Command (PIP Screen) and initialize data |
Required Include Files |
CODE
|
Description | This is the setting window of the User command where you can specify the input that will be executed in the command, and the variable where the results will be stored. |
Implementation | |
1.data interface | Declare the data format to be sent to the Task Editor as an interface before the class declaration.
CODE
|
2.PiP Screen | Implemented as a class, it is implemented by extending ModuleScreen from Dart-api.
CODE
|
3.channel | Used for communication with the task editor. Set the channel from the onBind to send messages to the channel whenever the state changes.
CODE
|
4.(optional) get data from database | Declare an array to get the database set in the module and display it as a List.
CODE
|
5.constructor | This segment is executed upon the initial entry to the Property screen. It initializes the state variables necessary for usage within this screen. Required State
Subsequently, it sets the state information to be utilized as input in the execution statement.
CODE
|
6.componentDidMount | This segment is executed when the component is mounted (i.e., when the PIP Screen is accessed for the first time). In this segment, you can load the variable values stored in the existing task editor.
CODE
CODE
this.UpdatePreloadData
|
7.onBind | This segment defines the function to be executed when saving tasks or transitioning properties in the Task Editor.
CODE
get_current_Data
CODE
get_variables
CODE
changed_variables
CODE
dataChange
CODE
|
8.render | This stage involves composing the UI and functionality to be displayed on the screen.
CODE
Then, it returns the screen to be displayed on the PIP Screen. At this time, the UI content is declared between <ThemeProvider> </ThemeProvider>, and within this part, you can create the Property screen using the IDE.
CODE
|
5. Returning Screens and Services (index.tsx)
Source | |
Purpose | This screen is designated for calling the previously created classes. You only need to modify the Module class here. |
Required Include Files |
CODE
|
Description | Module: A class for calling Screen and Service, used by extending BaseModule. |
Implementation | |
1.getModuleScreen | This selects the screen to be displayed using the component id set in the manifest.json.
CODE
|
2.getModuleService | This function is used to run the service executed by usercommand. In this example, since the User Command instructions are generated within a single ServiceForTaskEditor using the componentId, the code is written as follows.
CODE
|