文章目錄
- 前言
- 環境配置
- 運行測試
- 報錯
前言
通過使用智能化的工作流控制系統來精確操控機械臂,不僅能夠基于預設算法可靠地規劃每個動作步驟的執行順序和力度,確保作業流程的標準化和可重復性,還能通過模塊化的程序設計思路靈活地在原有工作流中插入新的控制節點,這種可擴展的架構設計使得系統能夠在不影響既有功能穩定性的前提下,便捷地集成諸如視覺識別、力反饋調節或協同作業等進階功能模塊,從而持續提升機械臂在復雜工業場景中的適應性和多功能性。
這里我增加了DeepSeek控制節點,通過給DeepSeek提示,讓它幫助給出機械臂的末端位置。該節點利用大語言模型強大的邏輯推理和空間理解能力,能夠將模糊的自然語言指令(如“向右移動5厘米”或“避開紅色障礙物”)自動轉化為精確的坐標參數和運動軌跡。這一集成顯著提升了人機交互效率,使得非專業用戶也能通過口語化指令快速完成復雜的位姿調整任務,為柔性生產線或科研實驗場景提供了更高層次的智能化支持。
參考:
- JSON Output
- DeepSeek提示庫
video:【代碼】通過DeepSeek大語言模型控制panda機械臂,聽懂人話,擬人性回答。智能機械臂助手又進一步啦
環境配置
- Ubuntu:24.04
- Ros2:jazzy
??使用VMWare安裝Ubuntu24.04
??配置開發環境
# VMware的復制粘貼問題:先打開VMware的設置,點開選項->常規->共享文件夾->勾選啟用共享文件夾sudo apt-get autoremove open-vm-tools -y
sudo apt-get install open-vm-tools -y
sudo apt-get install open-vm-tools-desktop -y
sudo reboot# 按照魚香ros一鍵安裝ros2
sudo apt-get update
sudo apt install wget -y
wget http://fishros.com/install -O fishros && sudo bash fishros# 安裝遠程顯示服務程序
sudo apt-get install x11-xserver-utils
sudo apt install libxcb* -y
sudo apt-get install x11-apps -y# 安裝moveit
# 重新打開一個終端
sudo apt install ros-${ROS_DISTRO}-moveit* -y# 安裝ros2的控制功能包
sudo apt install ros-${ROS_DISTRO}-controller-manager -y
sudo apt install ros-${ROS_DISTRO}-joint-trajectory-controller -y
sudo apt install ros-${ROS_DISTRO}-joint-state-broadcaster -y
sudo apt install ros-${ROS_DISTRO}-diff-drive-controller -y# 安裝運行`graph_executer_controller`相關的Python包
sudo apt update
sudo apt install python3-pip -y
sudo apt-get install portaudio19-dev -y
sudo apt install espeak -y# 使用清華源下載
cd src/graph_executer_controller/
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages# 調試工具
python3 -m pip install ipykernel -U --user --force-reinstall -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages# 配置Ubuntu支持中文
sudo apt-get install language-pack-zh-hansvim /etc/environment
# 添加內容
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"vim /var/lib/locales/supported.d/local
# 添加內容
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN GB2312sudo locale-gen# 安裝中文字體
sudo apt-get install fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming
運行測試
??編譯項目
colcon build
??運行panda_moveit_config
的demo.launch.py
source install/setup.bash
ros2 launch panda_moveit_config demo.launch.py
啟動rviz2后,可以看到機械臂會有干涉,現手動調整到不干涉的位置,然后才使用moveitpy控制機械臂,否則無法控制機械臂。
??運行moveitpy_controller
# 打開新的終端
source install/setup.bash
ros2 launch control_server arm_control.launch.py
??運行graph_executer_controller
# 打開新的終端
source install/setup.bash
cd src/graph_executer_controller
python3 main.py
報錯
- ?框選節點的時候報錯
File "/usr/local/lib/python3.12/dist-packages/NodeGraphQt/widgets/viewer.py", line 619, in mouseMoveEventself.scene().setSelectionArea(
TypeError: 'PySide6.QtWidgets.QGraphicsScene.setSelectionArea' called with wrong argument types:PySide6.QtWidgets.QGraphicsScene.setSelectionArea(QPainterPath, ItemSelectionMode)
Supported signatures:PySide6.QtWidgets.QGraphicsScene.setSelectionArea(path: PySide6.QtGui.QPainterPath, /, selectionOperation: PySide6.QtCore.Qt.ItemSelectionOperation = Instance(Qt.ReplaceSelection), mode: PySide6.QtCore.Qt.ItemSelectionMode = Instance(Qt.IntersectsItemShape), deviceTransform: PySide6.QtGui.QTransform = Default(QTransform))PySide6.QtWidgets.QGraphicsScene.setSelectionArea(path: PySide6.QtGui.QPainterPath, deviceTransform: PySide6.QtGui.QTransform, /)
Error calling Python override of QGraphicsView::mouseMoveEvent(): Traceback (most recent call last):File "/usr/local/lib/python3.12/dist-packages/NodeGraphQt/widgets/viewer.py", line 619, in mouseMoveEventself.scene().setSelectionArea(
TypeError: 'PySide6.QtWidgets.QGraphicsScene.setSelectionArea' called with wrong argument types:PySide6.QtWidgets.QGraphicsScene.setSelectionArea(QPainterPath, ItemSelectionMode)
Supported signatures:PySide6.QtWidgets.QGraphicsScene.setSelectionArea(path: PySide6.QtGui.QPainterPath, /, selectionOperation: PySide6.QtCore.Qt.ItemSelectionOperation = Instance(Qt.ReplaceSelection), mode: PySide6.QtCore.Qt.ItemSelectionMode = Instance(Qt.IntersectsItemShape), deviceTransform: PySide6.QtGui.QTransform = Default(QTransform))PySide6.QtWidgets.QGraphicsScene.setSelectionArea(path: PySide6.QtGui.QPainterPath, deviceTransform: PySide6.QtGui.QTransform, /)
??Pyside6和nodegraphqt版本不適配導致,更改viewer.py
以下位置即可:
# "/usr/local/lib/python3.12/dist-packages/NodeGraphQt/widgets/viewer.py"# self.scene().setSelectionArea(
# path, QtCore.Qt.IntersectsItemShape
# )
self.scene().setSelectionArea(path,selectionOperation=QtCore.Qt.ItemSelectionOperation.ReplaceSelection,mode=QtCore.Qt.ItemSelectionMode.IntersectsItemShape
)