iT邦幫忙

2025 iThome 鐵人賽

DAY 18
0
AI & Data

機器人的時代來了(協作型手臂的開發與實作)系列 第 18

[Day 18] 寫程式囉!ur-rtde跨平台函式庫

  • 分享至 

  • xImage
  •  

ur-rtde(SDU Robotics 維護的工程化封裝):以 C++ 核心+Python 綁定,跨平台 pip/apt 安裝,支援以 RTDE 控制/讀取、較完整 API 與部署文件,適合工程環境長期維護與效能需求。

以下是簡單的用python Code做Blending Move的例子:

from rtde_control import RTDEControlInterface as RTDEControl

rtde_c = RTDEControl("127.0.0.1")

velocity = 0.5
acceleration = 0.5
blend_1 = 0.0
blend_2 = 0.02
blend_3 = 0.0
path_pose1 = [-0.143, -0.435, 0.20, -0.001, 3.12, 0.04, velocity, acceleration, blend_1]
path_pose2 = [-0.143, -0.51, 0.21, -0.001, 3.12, 0.04, velocity, acceleration, blend_2]
path_pose3 = [-0.32, -0.61, 0.31, -0.001, 3.12, 0.04, velocity, acceleration, blend_3]
path = [path_pose1, path_pose2, path_pose3]

# Send a linear path with blending in between - (currently uses separate script)
rtde_c.moveL(path)
rtde_c.stopScript()

當然,也是有C++的例子可以參考:

#include <ur_rtde/rtde_control_interface.h>

using namespace ur_rtde;

int main(int argc, char* argv[])
{
  RTDEControlInterface rtde_control("127.0.0.1");

  double velocity = 0.5;
  double acceleration = 0.5;
  double blend_1 = 0.0;
  double blend_2 = 0.02;
  double blend_3 = 0.0;
  std::vector<double> path_pose1 = {-0.143, -0.435, 0.20, -0.001, 3.12, 0.04, velocity, acceleration, blend_1};
  std::vector<double> path_pose2 = {-0.143, -0.51, 0.21, -0.001, 3.12, 0.04, velocity, acceleration, blend_2};
  std::vector<double> path_pose3 = {-0.32, -0.61, 0.31, -0.001, 3.12, 0.04, velocity, acceleration, blend_3};

  std::vector<std::vector<double>> path;
  path.push_back(path_pose1);
  path.push_back(path_pose2);
  path.push_back(path_pose3);

  // Send a linear path with blending in between - (currently uses separate script)
  rtde_control.moveL(path);
  rtde_control.stopScript();

  return 0;
}


上一篇
[Day 17] 寫程式囉! Python 函式庫python-urx
系列文
機器人的時代來了(協作型手臂的開發與實作)18
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言