Skip to content

7.9 Task Execution Section

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

Section titled “7.9.2 Single Task Information RPC Interface”
Interface Name pb:/aimdk.protocol.TaskEngineService/GetTask
Function Summary Retrieve execution information for a single task
Interface Type HTTP JSON RPC
URL http://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/GetTask
Input Parameters
{
  "task_id": "1"
}
  • task_id: Task ID
Output Parameters
{
  "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 Script examples/task_engine/get_task.sh
Notes
Interface Name pb:/aimdk.protocol.TaskEngineService/GetAllTasks
Function Summary Retrieve execution information for all tasks
Interface Type HTTP JSON RPC
URL http://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/GetAllTasks
Input Parameters
{}
Output Parameters
{
  "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 Script examples/task_engine/get_all_tasks.sh
Notes

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:

Terminal window
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 Name pb:/aimdk.protocol.TaskEngineService/SetCurrentTask
Function Summary Set the current task
Interface Type HTTP JSON RPC
URL http://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/SetCurrentTask
Input Parameters
{
  "task_id": "15"
}
Output Parameters
{
  "task_id": "15",
  "is_success": true
}
  • task_id: Task ID
  • is_success: Whether the setting was successful
Example Script examples/task_engine/set_current_task.sh
Notes Cannot be called when a task is currently executing
Interface Name pb:/aimdk.protocol.TaskEngineService/LaunchTask
Function Summary Start task execution
Interface Type HTTP JSON RPC
URL http://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/LaunchTask
Input Parameters
{
  "task_id": "15"
}
Output Parameters
{
  "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 Script examples/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
Interface Name pb:/aimdk.protocol.TaskEngineService/CtrlTaskState
Function Summary Control task pause, resume, stop, etc.
Interface Type HTTP JSON RPC
URL http://192.168.100.110:57881/rpc/aimdk.protocol.TaskEngineService/CtrlTaskState
Input Parameters
{
  "task_id": "15",
  "type": "Type_PAUSE"
}
  • task_id: Task ID

  • type: Control type

    • Type_UNDEFINED
    • Type_PAUSE
    • Type_RESUME
    • Type_STOP
Output Parameters
{
  "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 Script examples/task_engine/ctrl_task_state.sh
Notes