7.9 Task Execution Section

7.9 Task Execution Section

7.9.1 Overview

AimMaster provides a guided task feature, allowing users to create guided tasks on AimMaster and use programmatic interfaces for invocation and other operations.

Note that task creation, editing, deletion, and other operations still need to be performed through the AimMaster software. The programmatic interface only provides basic functions such as starting, pausing, and canceling tasks.

7.9.2 Single Task Information RPC Interface

Interface Namepb:/aimdk.protocol.TaskEngineService/GetTask
Function SummaryRetrieve execution information for a single task
Interface TypeHTTP JSON RPC
URLhttp://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/GetTask
Input Parameters
text
{
  "task_id": "1"
}
  • task_id: Task ID
Output Parameters
text
{
  "data": [
    {
      "task_id": "1",
      "name": "task1",
      "is_valid": true,
      "state": "StateType_IDLE",
      "duration": "0",
      "setting": "task_type: interaction_1 xxx YAML content"
    }
  ]
}
  • task_id: Task ID
  • name: Task name
  • is_valid: Task validity
  • state: Task state
    • StateType_UNDEFINED
    • StateType_IDLE
    • StateType_RUNNING
    • StateType_PAUSED
    • StateType_STOPPED
    • StateType_PAUSING
    • StateType_STOPPING
    • StateType_RESUMING
    • StateType_FAILPAUSE
    • StateType_FAILSTOP
    • StateType_FAILRESUME
    • StateType_EXCEPTION
    • StateType_LAZY_PAUSING
  • duration: Reserved field
  • setting: Reserved field
Example Scriptexamples/task_engine/get_task.sh
Notes

7.9.3 All Tasks Information RPC Interface

Interface Namepb:/aimdk.protocol.TaskEngineService/GetAllTasks
Function SummaryRetrieve execution information for all tasks
Interface TypeHTTP JSON RPC
URLhttp://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/GetAllTasks
Input Parameters
text
{}
Output Parameters
text
{
  "data": [
    {
      "task_id": "1",
      "name": "task1",
      "is_valid": true,
      "state": "StateType_IDLE",
      "duration": "0",
      "setting": "task_type: interaction_1 xxx YAML content"
    }
  ]
}
The fields are the same as the single task information interface, but it includes information and execution status for all tasks.
Example Scriptexamples/task_engine/get_all_tasks.sh
Notes

7.9.4 Task Execution RPC Interface

The task execution interface requires the use of two interfaces: first, call SetCurrentTask to set the current task, then call LaunchTask to start the task.

Before calling LaunchTask to start a task, you must switch the SM (System State Management) module to the Auto functional group. This is achieved by executing the following synchronous interface:

bash
curl -i -H 'content-type:application/json' -X POST 'http://192.168.100.110:51056/rpc/aimdk.protocol.SystemService/MigrateSystemStateSync' -d '{"state": "Auto"}'

If this step is not performed, the call may return the result res: ReturnType_FAIL_UNKNOWN.

Interface Namepb:/aimdk.protocol.TaskEngineService/SetCurrentTask
Function SummarySet the current task
Interface TypeHTTP JSON RPC
URLhttp://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/SetCurrentTask
Input Parameters
text
{
  "task_id": "15"
}
Output Parameters
text
{
  "task_id": "15",
  "is_success": true
}
  • task_id: Task ID
  • is_success: Whether the setting was successful
Example Scriptexamples/task_engine/set_current_task.sh
NotesCannot be called when a task is currently executing
Interface Namepb:/aimdk.protocol.TaskEngineService/LaunchTask
Function SummaryStart task execution
Interface TypeHTTP JSON RPC
URLhttp://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/LaunchTask
Input Parameters
text
{
  "task_id": "15"
}
Output Parameters
text
{
  "task_id": "15",
  "res": "ReturnType_SUCCEED"
}
  • task_id: Task ID
  • res: Start result
    • ReturnType_UNDEFINED
    • ReturnType_SUCCEED
    • ReturnType_FAIL_TASK_CONFLICT
    • ReturnType_FAIL_TASK_VALIDATE
    • ReturnType_FAIL_UNKNOWN
Example Scriptexamples/task_engine/launch_task.sh
Notes
  • Before starting task execution, you need to call the SetCurrentTask interface to set the current task
  • You must pass the same task_id; passing a different task_id is undefined behavior

7.9.5 Task Control RPC Interface

Interface Namepb:/aimdk.protocol.TaskEngineService/CtrlTaskState
Function SummaryControl task pause, resume, stop, etc.
Interface TypeHTTP JSON RPC
URLhttp://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/CtrlTaskState
Input Parameters
text
{
  "task_id": "15",
  "type": "Type_PAUSE"
}
  • task_id: Task ID
  • type: Control type
    • Type_UNDEFINED
    • Type_PAUSE
    • Type_RESUME
    • Type_STOP
Output Parameters
text
{
  "task_id": "15",
  "res": "ReturnType_SUCCEED"
}
  • task_id: Task ID
  • res: Control result
    • ReturnType_UNDEFINED
    • ReturnType_SUCCEED
    • ReturnType_FAIL_TASK_CONFLICT
    • ReturnType_FAIL_TASK_VALIDATE
    • ReturnType_FAIL_UNKNOWN
Example Scriptexamples/task_engine/ctrl_task_state.sh
Notes