• 任务编排流程设计笔记

核心思想

  • 模块化编程,不同功能的设备独立设计,不互相依赖

  • 模块列表
    • 机械臂
    • 相机
    • 工具
    • 检测算法
    • 点云算法
  • 机械臂模块
    • 接收目标点,操控机械臂
    • 输出机械臂状态,实时仿真
  • 相机模块
    • 实时获取图片
  • 工具
    • 抓取目标
    • 释放目标
  • 检测算法
    • 接收图片,输出检测框结构化信息
  • 点云算法
    • 接收图片,参数,标定数据,输出点云,目标点集合
  • 五个模块互相合作,组成不同的作业流程

  • 作业流程分为两级
    • 第一级: 原子作业
    • 第二级: 作业任务
  • 原子作业
    • 检测作业
    • 抓取作业
    • 放置作业
    • 打磨作业
  • 作业任务
    • 无序抓取
    • 表面精加工
  • 作业任务与原子作业的关系
    • 无序抓取:
      • 检测作业
      • 抓取作业
      • 放置作业
    • 表面精加工
      • 检测作业
      • 打磨作业

检测作业

  • 使用的模块
    • 相机
    • 检测算法
    • 点云算法
  • 配置的参数
    • 相机 camera_id
    • 检测算法 detector_id
    • 点云算法 pcl_id
    • 标定结果 calibrate_string
    • 检测策略 detect_proto
  • 作业流程
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    
      camera_ptr = find(camera_id)
      detector_ptr = find(detector_id)
      detect_enum = find(detect_proto)
      pcl_ptr = find(pcl_id)
      calibrate_t = parse(calibrate_string)
    
      switch (detect_enum)
      {
      case 静态检测:
          {
              camera_ptr->getRGBD(&color, &depth, &cloud)
              
              detector_ptr->Detect(color, &box_set)
    
              pcl_ptr->Process(color, depth, cloud, calibrate_t, &obj_set)
          }
      case 动态检测:
          {
              velocity = DetectVelocity();  // 执行一次
    
              camera_ptr->getRGBD(&color, &depth, &cloud)
              
              detector_ptr->Detect(color, &box_set)
    
              pcl_ptr->Process(color, depth, cloud, calibrate_t, &obj_set)  
          }
      default:
          {
    
          }
      }
    
  • 输出的数据
    • 目标点集合 obj_set
    • 目标速度 velocity

抓取作业

  • 使用的模块
    • 机械臂
    • 工具
  • 配置的参数
    • 机械臂 robot_id, home_point, tool_t
    • 工具 tool_id
    • 抓取策略 catch_proto
    • 目标点集合 obj_set
  • 作业流程
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    
      robot_ptr = find(robot_id)
      tool_ptr = find(tool_id)
      catch_enum = find(catch_proto)
      target_pool->set(obj_set)
    
      robot_ptr->SetTool(tool_t)
      robot_ptr->Move(home_point)
      switch(catch_enum)
      {
      case 静态抓取:
          {
              obj = target_pool->PopNearest()
    
              robot_ptr->Move(obj)
    
              tool_ptr->Catch()
    
              robot_ptr->Move(home_point)
          }
      case 动态抓取:
          {
              target_pool->set(velocity)
              obj = target_pool->PopFarthest()
    
              robot_ptr->Move(obj)
    
              tool_ptr->Catch()
                
              robot_ptr->Move(home_point)
          }
      default:
        {
              
        }
      }
    

放置作业

  • 使用的模块
    • 机械臂
    • 工具
  • 配置的参数
    • 机械臂 robot_id, place_point, tool_t
    • 工具 tool_id
    • 放置策略 place_proto
    • 目标属性 object_attribute
  • 作业流程
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    
      robot_ptr = find(robot_it)
      tool_ptr = find(tool_id)
      place_enum = find(place_proto)
    
      place_pool->Init(place_point)
      switch (place_enum)
      {
      case 单点放置:
          {
              robot_ptr->Move(place_point)
    
              tool_ptr->Release()
          }
      case 平铺放置:
          {
              next_place_point = place_pool->GetNextPlace(object_attribute.width, object_attribute.length, object_attribute.height)
                
              robot_ptr->Move(next_place_point)
    
              tool_ptr->Release()
    
              place_pool->Push(next_place_point)
          }
      case 堆叠放置:
          {
              next_place_point = place_pool->GetNextPlace(object_attribute.width, object_attribute.length, object_attribute.height)
                
              robot_ptr->Move(next_place_point)
    
              tool_ptr->Release()
    
              place_pool->Push(next_place_point)
          }
      default:
          {
    
          }
      }
    

打磨作业

  • 使用的模块
    • 机械臂
    • 工具
  • 配置的参数
    • 机械臂 robot_id, home_point, tool_t
    • 工具 tool_id
    • 打磨策略 polish_proto
    • 目标点集合 obj_set
  • 作业流程 ``` robot_ptr = find(robot_id) tool_ptr = find(tool_id) polish_enum = find(polish_proto)

    robot_ptr->SetTool(tool_t) robot_ptr->Move(home_point) switch(polish_enum) { case 间隔两个点打磨: { new_obj_set = Process(obj_set)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
          tool_ptr->enable()
    
          for (auto& obj : new_obj_set)
          {
              robot_ptr->Move(obj)
          }
      }   case 打磨指定区域:
      {
          new_obj_set = Process(obj_set)
    
          tool_ptr->enable()
    
          for (auto& obj : new_obj_set)
          {
              robot_ptr->Move(obj)
          }
      }   default:
      {
    
      }   }
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

## 无序抓取

+ 使用到的作业
  + 检测作业(camera_id, detector_id, pcl_id, calibrate_string, detect_proto)
  + 抓取作业(robot_id, home_point, tool_t, tool_id, catch_proto)
  + 放置作业(robot_id, place_point, tool_t, tool_id, place_proto, object_attribute)

+ 配置的参数
  + 相机            camera_id
  + 检测算法         detector_id
  + 点云算法         pcl_id
  + 标定结果         calibrate_string
  + 检测策略         detect_proto
  + 机械臂           robot_id
    + Home点         home_point
    + 末端工具配置     tool_t
    + place点        place_point
  + 工具             tool_id
  + 抓取策略          catch_proto
  + 放置策略          place_proto
  + 目标属性          object_attribute
    + 长
    + 宽
    + 高

+ 任务流程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
用户选择相机,机械臂,工具,检测算法,点云算法

用户选择检测策略,抓取策略,放置策略

用户配置Home点,机械臂末端工具,place点,目标属性

while (1)
{
    obj_set, velocity = 启动检测作业(camera_id, detector_id, pcl_id, calibrate_string, detect_proto)

    bool success = 启动抓取作业(robot_id, home_point, tool_t, tool_id, catch_proto)

    if (success)
    {
        success = 启动放置作业(robot_id, place_point, tool_t, tool_id, place_proto, object_attribute)
        if (success)
        {
            cnt++
        }
    }
} ```

表面精加工

  • 使用到的作业
    • 检测作业(camera_id, detector_id, pcl_id, calibrate_string, detect_proto)
    • 打磨作业(robot_id, home_point, tool_t, tool_id, polish_proto)
  • 配置的参数
    • 相机 camera_id
    • 检测算法 detector_id
    • 点云算法 pcl_id
    • 标定结果 calibrate_string
    • 检测策略 detect_proto
    • 机械臂 robot_id
      • Home点 home_point
      • 末端工具配置 tool_t
      • place点 place_point
    • 工具 tool_id
    • 打磨策略 polish_proto
  • 任务流程
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
      用户选择相机,机械臂,工具,检测算法,点云算法
    
      用户选择检测策略,打磨策略
    
      用户配置Home点,机械臂末端工具,place点
    
      while (1)
      {
          obj_set = 启动检测作业(camera_id, detector_id, pcl_id, calibrate_string, detect_proto)
    
          bool success = 启动打磨作业(robot_id, home_point, tool_t, tool_id, polish_proto)
            
          if (success)
          {
              cnt++
              return SUCCESS
          }
      }