22
33---
44
5- ## 前言(Introduction)
5+ ## 前言
66
77本项目介绍通过Unity3D仿真Panda机械臂,为研究机械臂的控制算法、控制效果和构建复杂仿真环境提供虚拟化平台。
88
9+
10+ | ![ ] ( images/2025-5-18.gif ) | ![ ] ( images/2025-6-2.gif ) |
11+ | :---:| :---:|
12+ | 2025-5-18| 2025-6-2|
13+
914要点:
1015
1116- ` PandaArmUnity3D ` :` Unity3D ` 项目
1217- ` ros2_docker_ws ` :` ros2 ` 项目
1318- ` matlab ` :包含了验证机械臂位置正逆运动学的算法分析
1419
1520> ** video:**
21+ > - [ 2025-6-2: YOLO 机械臂丨使用unity搭建仿真环境,YOLO算法识别,Moveit2控制] ( https://www.bilibili.com/video/BV1657mzFEdd/?vd_source=3bf4271e80f39cfee030114782480463 )
1622> - [ 2025-5-18: 机械臂位置正逆运动学原理与代码] ( https://www.bilibili.com/video/BV1ghJGzJEnp/?vd_source=3bf4271e80f39cfee030114782480463 )
1723> - [ 2025-4-13: ros2-rviz2控制unity仿真的6关节机械臂,探索从仿真到实际应用的过程] ( https://www.bilibili.com/video/BV1E9dkYAEkX/?vd_source=3bf4271e80f39cfee030114782480463 )
1824
1925
20-
21- > ** 参考:**
22- > - [ docker-ros2-unity-tcp-endpoint] ( https://github.com/frankjoshua/docker-ros2-unity-tcp-endpoint/tree/master )
23- > - [ Robotics-Nav2-SLAM-Example] ( https://github.com/Unity-Technologies/Robotics-Nav2-SLAM-Example?tab=readme-ov-file )
24- > - [ unity坐赛车游戏,简单三分钟了解一下] ( https://www.bilibili.com/video/BV1LU4y1o7re/?vd_source=3bf4271e80f39cfee030114782480463 )
25- > - [ How to Setup Unity and ROS2 in less than 5 minutes!] ( https://www.youtube.com/watch?v=1X6uzrvNwCk )
26- > - [ ros2-for-unity] ( https://github.com/RobotecAI/ros2-for-unity )
27- > - [ moveit2_yolobb_ws] ( https://github.com/laoxue888/moveit2_yolobb_ws )
28- > - [ Unity-Robotics-Hub] ( https://github.com/Unity-Technologies/Unity-Robotics-Hub )
29- > - [ JSON Output] ( https://api-docs.deepseek.com/zh-cn/guides/json_mode )
30- > - [ DeepSeek提示库] ( https://api-docs.deepseek.com/zh-cn/prompt-library/ )
31- > - [ Binary Installation on Ubuntu] ( https://gazebosim.org/docs/harmonic/install_ubuntu/ )
32- > - [ Docs / Gazebo Harmonic] ( https://gazebosim.org/docs/harmonic/getstarted/ )
33- > - [ ros_gz branch jazzy] ( https://github.com/gazebosim/ros_gz/tree/jazzy )
34-
35-
36- ## 搭建开发环境(Setup Development Environment)
26+ ## 搭建开发环境
3727
3828> - Unity:2022
3929> - Ubuntu:24.04
4030> - Ros2: jazzy
4131
42- ## 在window中安装Unity(Install Unity in window)
32+ ## 在window中安装Unity
4333
4434先安装Unityhuyb,然后再安装Unity
4535
4636[ https://unity.cn/releases ] ( https://unity.cn/releases )
4737
48- ## 创建Docker容器,并安装相关软件(Create Docker containers and install related software)
38+ ## 创建Docker容器,并安装相关软件
4939
5040❇️创建Docker容器
5141
@@ -92,11 +82,9 @@ cd src/graph_executer_controller/
9282pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages
9383pip install pyqtgraph ultralytics --break-system-packages
9484
95-
9685# 调试工具
9786python3 -m pip install ipykernel -U --user --force-reinstall -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages
9887
99-
10088# 配置Ubuntu支持中文
10189sudo apt-get install language-pack-zh-hans -y
10290apt install vim -y
@@ -120,42 +108,17 @@ sudo apt-get install fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-
120108
121109# 安装支持playsound的库
122110apt-get install libgstrtspserver-1.0-dev gstreamer1.0-rtsp -y
123-
124- # 安装mujoco
125- mkdir /opt/mujoco_softwares
126- cd /opt/mujoco_softwares/
127- wget https://github.com/google-deepmind/mujoco/releases/download/3.3.2/mujoco-3.3.2-linux-x86_64.tar.gz
128- tar xvzf mujoco-3.3.2-linux-x86_64.tar.gz
129- echo " export PATH=$PATH :/opt/mujoco_softwares/mujoco-3.3.2/bin" >> ~ /.bashrc
130- source ~ /.bashrc
131- # 测试
132- # simulate /opt/mujoco_softwares/mujoco-3.3.2/model/humanoid/humanoid.xml
133- pip install mujoco -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages
134-
135- # 安装gz
136- sudo apt-get update
137- sudo apt-get install curl lsb-release gnupg
138-
139- sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
140- echo " deb [arch=$( dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $( lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
141- sudo apt-get update
142- sudo apt-get install gz-harmonic
143-
144- sudo sh -c ' echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
145- curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
146- sudo apt-get update
147- sudo apt install ros-jazzy-ros-gz -y
148-
149- apt install ros-${ROS_DISTRO} -gz-ros2-control -y
150111```
151112
152- ## 运行测试(Run test)
113+ ## 运行测试
153114
154115
155116❇️在windows上运行` PulseAudio ` 服务
156117
157118![ alt text] ( images/image.png )
158119
120+ ❇️启动Unity
121+
159122❇️编译项目
160123
161124``` shell
@@ -191,8 +154,24 @@ ros2 launch panda_moveit_config demo.launch.py
191154```
192155> 启动rviz2后,可以看到机械臂会有干涉,现手动调整到不干涉的位置,然后才使用moveitpy控制机械臂,否则无法控制机械臂。
193156
157+
194158# 改进
195159
160+ ## 添加删除节点前的函数调用
161+
162+ 问题描述:由于nodegraphqt没有删除节点的操作,这里为其添加。
163+
164+ 在` /usr/local/lib/python3.12/dist-packages/NodeGraphQt/base/graph.py ` 的` NodeGraph ` 类的` delete_node(self, node, push_undo=True) ` 函数中添加以下内容:
165+
166+ ![ alt text] ( images/image-1.png )
167+
168+ ``` python
169+ if hasattr (node, ' _del_node' ):
170+ node._del_node()
171+ ```
172+
173+ # 报错
174+
196175## ❌框选节点的时候报错
197176
198177``` shell
@@ -228,15 +207,40 @@ self.scene().setSelectionArea(
228207)
229208` ` `
230209
231- # # 添加删除节点前的函数调用
232210
233- 问题描述:由于nodegraphqt没有删除节点的操作,这里为其添加。
211+ # # ❌如果无法控制机械臂,查看rviz2的终端,应该会有
234212
235- 在` /usr/local/lib/python3.12/dist-packages/NodeGraphQt/base/graph.py` 的` NodeGraph` 类的` delete_node(self, node, push_undo=True)` 函数中添加以下内容:
213+ ` ` ` shell
214+ [move_group-3] [ERROR] [1748613208.480924749] [move_group.moveit.moveit.ros.check_start_state_bounds]: Joint ' panda_joint2' from the starting state is outside bounds by: [1.76294 ] should be in the range [-1.7628 ], [1.7628 ].
215+ [move_group-3] [ERROR] [1748613208.480986559] [move_group]: PlanningRequestAdapter ' CheckStartStateBounds' failed, because ' Start state out of bounds.' . Aborting planning pipeline.
216+ ` ` `
236217
237- ! [alt text](images/image-1.png)
218+ ✔️:重新启动rviz2即可
238219
239- ` ` ` python
240- if hasattr(node, ' _del_node' ):
241- node._del_node ()
220+ # # ❌规划路径超出范围
221+
222+ ` ` ` shell
223+ [ERROR] [1742603349.012384448] [moveit_3836862178.moveit.ros.check_start_state_bounds]: Joint ' panda_finger_joint1' from the starting state is outside bounds by: [-6.61565e-14 ] should be in the range [0 ], [0.04 ].
224+ [ERROR] [1742603349.012503158] [moveit_py]: PlanningRequestAdapter ' CheckStartStateBounds' failed, because ' Start state out of bounds.' . Aborting planning pipeline.
225+ [ERROR] [1742603349.013678982] [moveit_py.pose_goal]: Planning failed
242226` ` `
227+
228+ ✔️修改` joint_limits.yaml` ,限制关节的最大最小位置
229+
230+ ! [alt text](ros2_docker_ws/src/_docs/images/image-2.png)
231+
232+
233+ # 参考
234+
235+ > - [docker-ros2-unity-tcp-endpoint](https://github.com/frankjoshua/docker-ros2-unity-tcp-endpoint/tree/master)
236+ > - [Robotics-Nav2-SLAM-Example](https://github.com/Unity-Technologies/Robotics-Nav2-SLAM-Example? tab=readme-ov-file)
237+ > - [unity坐赛车游戏,简单三分钟了解一下](https://www.bilibili.com/video/BV1LU4y1o7re/? vd_source=3bf4271e80f39cfee030114782480463)
238+ > - [How to Setup Unity and ROS2 in less than 5 minutes! ](https://www.youtube.com/watch? v=1X6uzrvNwCk)
239+ > - [ros2-for-unity](https://github.com/RobotecAI/ros2-for-unity)
240+ > - [moveit2_yolobb_ws](https://github.com/laoxue888/moveit2_yolobb_ws)
241+ > - [Unity-Robotics-Hub](https://github.com/Unity-Technologies/Unity-Robotics-Hub)
242+ > - [JSON Output](https://api-docs.deepseek.com/zh-cn/guides/json_mode)
243+ > - [DeepSeek提示库](https://api-docs.deepseek.com/zh-cn/prompt-library/)
244+ > - [Binary Installation on Ubuntu](https://gazebosim.org/docs/harmonic/install_ubuntu/)
245+ > - [Docs / Gazebo Harmonic](https://gazebosim.org/docs/harmonic/getstarted/)
246+ > - [ros_gz branch jazzy](https://github.com/gazebosim/ros_gz/tree/jazzy)
0 commit comments