当前位置:   article > 正文

Moveit +Gazebo:搭建单臂机械臂仿真平台_moveit gazebo

moveit gazebo

环境:Ubuntu20.04 ros-noetic

先放上效果展示:

 

 首先要先安装ROS 和 Moveit,ROS的安装就不说了,Moeit的安装参看官网教程

Getting Started — moveit_tutorials Noetic documentation

安装过程中,用到了命令:

rosdep update

最好在安装的时候能够科学上网

搭建单臂仿真平台主要分为4大步

        1.准备urdf/xacro文件

        2.通过moveit setup assistant进行配置

        3.controller的配置

        4.launch文件的编写

准备urdf/xacro文件

这里我采用了 panda机械臂的功能包,首先进行该功能包的安装,通过命令:

sudo apt install ros-noetic-franka-description

        安装好之后呢就可以在目录/opt/ros/noetic/share/franka_description下找到要用的panda机械臂模型的xacro相关文件,这里在进行第二步之前呢,还需要对panda机械臂的xacro文件进行一点点修改,修改的目的主要是使模型具有gazebo仿真的相关标签和数据,这里可以直接使用我修改完成的。(需要安装franka-description包)

建议在moveit的工作空间下,新建一个功能包放置相关文件,比如

我在 moveit_ws/src下新建了panda_dual_arms的功能包,在panda_dual_arms/robot_description下放置了下面的模型文件left_arm.urdf

  1. <?xml version="1.0" ?>
  2. <robot name="left_arm">
  3. <link name="world"/>
  4. <joint name="left_base_to_world" type="fixed">
  5. <parent link="world"/>
  6. <child link="left_base"/>
  7. <origin rpy="0 0 0" xyz="0 0 0"/>
  8. </joint>
  9. <link name="left_base"/>
  10. <joint name="left_arm_joint_base" type="fixed">
  11. <parent link="left_base"/>
  12. <child link="left_arm_link0"/>
  13. <origin rpy="0 0 0" xyz="0 0 0"/>
  14. </joint>
  15. <!-- sub-link defining detailed meshes for collision with environment -->
  16. <link name="left_arm_link0">
  17. <visual>
  18. <geometry>
  19. <mesh filename="package://franka_description/meshes/visual/link0.dae"/>
  20. </geometry>
  21. </visual>
  22. <collision>
  23. <geometry>
  24. <mesh filename="package://franka_description/meshes/collision/link0.stl"/>
  25. </geometry>
  26. </collision>
  27. <inertial>
  28. <origin rpy="0 0 0" xyz="-0.041018 -0.00014 0.049974"/>
  29. <mass value="0.629769"/>
  30. <inertia ixx="0.00315" ixy="8.2904e-07" ixz="0.00015" iyy="0.00388" iyz="8.2299e-06" izz="0.004285"/>
  31. </inertial>
  32. </link>
  33. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  34. <link name="left_arm_link0_sc">
  35. </link>
  36. <!-- fixed joint between both sub-links -->
  37. <joint name="left_arm_link0_sc_joint" type="fixed">
  38. <origin rpy="0 0 0"/>
  39. <parent link="left_arm_link0"/>
  40. <child link="left_arm_link0_sc"/>
  41. </joint>
  42. <!-- sub-link defining detailed meshes for collision with environment -->
  43. <link name="left_arm_link1">
  44. <visual>
  45. <geometry>
  46. <mesh filename="package://franka_description/meshes/visual/link1.dae"/>
  47. </geometry>
  48. </visual>
  49. <collision>
  50. <geometry>
  51. <mesh filename="package://franka_description/meshes/collision/link1.stl"/>
  52. </geometry>
  53. </collision>
  54. <inertial>
  55. <origin rpy="0 0 0" xyz="0.003875 0.002081 -0.04762"/>
  56. <mass value="4.970684"/>
  57. <inertia ixx="0.70337" ixy="-0.000139" ixz="0.006772" iyy="0.70661" iyz="0.019169" izz="0.009117"/>
  58. </inertial>
  59. </link>
  60. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  61. <link name="left_arm_link1_sc">
  62. </link>
  63. <!-- fixed joint between both sub-links -->
  64. <joint name="left_arm_link1_sc_joint" type="fixed">
  65. <origin rpy="0 0 0"/>
  66. <parent link="left_arm_link1"/>
  67. <child link="left_arm_link1_sc"/>
  68. </joint>
  69. <joint name="left_arm_joint1" type="revolute">
  70. <origin rpy="0 0 0" xyz="0 0 0.333"/>
  71. <parent link="left_arm_link0"/>
  72. <child link="left_arm_link1"/>
  73. <axis xyz="0 0 1"/>
  74. <limit effort="87.0" lower="-2.8973" upper="2.8973" velocity="2.175"/>
  75. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
  76. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  77. </joint>
  78. <!-- sub-link defining detailed meshes for collision with environment -->
  79. <link name="left_arm_link2">
  80. <visual>
  81. <geometry>
  82. <mesh filename="package://franka_description/meshes/visual/link2.dae"/>
  83. </geometry>
  84. </visual>
  85. <collision>
  86. <geometry>
  87. <mesh filename="package://franka_description/meshes/collision/link2.stl"/>
  88. </geometry>
  89. </collision>
  90. <inertial>
  91. <origin rpy="0 0 0" xyz="-0.003141 -0.02872 0.003495"/>
  92. <mass value="0.646926"/>
  93. <inertia ixx="0.007962" ixy="-0.003925" ixz="0.010254" iyy="0.02811" iyz="0.000704" izz="0.025995"/>
  94. </inertial>
  95. </link>
  96. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  97. <link name="left_arm_link2_sc">
  98. </link>
  99. <!-- fixed joint between both sub-links -->
  100. <joint name="left_arm_link2_sc_joint" type="fixed">
  101. <origin rpy="0 0 0"/>
  102. <parent link="left_arm_link2"/>
  103. <child link="left_arm_link2_sc"/>
  104. </joint>
  105. <joint name="left_arm_joint2" type="revolute">
  106. <origin rpy="-1.5707963267948966 0 0" xyz="0 0 0"/>
  107. <parent link="left_arm_link1"/>
  108. <child link="left_arm_link2"/>
  109. <axis xyz="0 0 1"/>
  110. <limit effort="87.0" lower="-1.7628" upper="1.7628" velocity="2.175"/>
  111. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-1.7628" soft_upper_limit="1.7628"/>
  112. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  113. </joint>
  114. <!-- sub-link defining detailed meshes for collision with environment -->
  115. <link name="left_arm_link3">
  116. <visual>
  117. <geometry>
  118. <mesh filename="package://franka_description/meshes/visual/link3.dae"/>
  119. </geometry>
  120. </visual>
  121. <collision>
  122. <geometry>
  123. <mesh filename="package://franka_description/meshes/collision/link3.stl"/>
  124. </geometry>
  125. </collision>
  126. <inertial>
  127. <origin rpy="0 0 0" xyz="2.7518e-02 3.9252e-02 -6.6502e-02"/>
  128. <mass value="3.228604"/>
  129. <inertia ixx="0.037242" ixy="-0.004761" ixz="-0.011396" iyy="0.036155" iyz="-0.012805" izz="0.01083"/>
  130. </inertial>
  131. </link>
  132. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  133. <link name="left_arm_link3_sc">
  134. </link>
  135. <!-- fixed joint between both sub-links -->
  136. <joint name="left_arm_link3_sc_joint" type="fixed">
  137. <origin rpy="0 0 0"/>
  138. <parent link="left_arm_link3"/>
  139. <child link="left_arm_link3_sc"/>
  140. </joint>
  141. <joint name="left_arm_joint3" type="revolute">
  142. <origin rpy="1.5707963267948966 0 0" xyz="0 -0.316 0"/>
  143. <parent link="left_arm_link2"/>
  144. <child link="left_arm_link3"/>
  145. <axis xyz="0 0 1"/>
  146. <limit effort="87.0" lower="-2.8973" upper="2.8973" velocity="2.175"/>
  147. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
  148. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  149. </joint>
  150. <!-- sub-link defining detailed meshes for collision with environment -->
  151. <link name="left_arm_link4">
  152. <visual>
  153. <geometry>
  154. <mesh filename="package://franka_description/meshes/visual/link4.dae"/>
  155. </geometry>
  156. </visual>
  157. <collision>
  158. <geometry>
  159. <mesh filename="package://franka_description/meshes/collision/link4.stl"/>
  160. </geometry>
  161. </collision>
  162. <inertial>
  163. <origin rpy="0 0 0" xyz="-5.317e-02 1.04419e-01 2.7454e-02"/>
  164. <mass value="3.587895"/>
  165. <inertia ixx="0.025853" ixy="0.007796" ixz="-0.001332" iyy="0.019552" iyz="0.008641" izz="0.028323"/>
  166. </inertial>
  167. </link>
  168. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  169. <link name="left_arm_link4_sc">
  170. </link>
  171. <!-- fixed joint between both sub-links -->
  172. <joint name="left_arm_link4_sc_joint" type="fixed">
  173. <origin rpy="0 0 0"/>
  174. <parent link="left_arm_link4"/>
  175. <child link="left_arm_link4_sc"/>
  176. </joint>
  177. <joint name="left_arm_joint4" type="revolute">
  178. <origin rpy="1.5707963267948966 0 0" xyz="0.0825 0 0"/>
  179. <parent link="left_arm_link3"/>
  180. <child link="left_arm_link4"/>
  181. <axis xyz="0 0 1"/>
  182. <limit effort="87.0" lower="-3.0718" upper="-0.0698" velocity="2.175"/>
  183. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-3.0718" soft_upper_limit="-0.0698"/>
  184. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  185. </joint>
  186. <!-- sub-link defining detailed meshes for collision with environment -->
  187. <link name="left_arm_link5">
  188. <visual>
  189. <geometry>
  190. <mesh filename="package://franka_description/meshes/visual/link5.dae"/>
  191. </geometry>
  192. </visual>
  193. <collision>
  194. <geometry>
  195. <mesh filename="package://franka_description/meshes/collision/link5.stl"/>
  196. </geometry>
  197. </collision>
  198. <inertial>
  199. <origin rpy="0 0 0" xyz="-1.1953e-02 4.1065e-02 -3.8437e-02"/>
  200. <mass value="1.225946"/>
  201. <inertia ixx="0.035549" ixy="-0.002117" ixz="-0.004037" iyy="0.029474" iyz="0.000229" izz="0.008627"/>
  202. </inertial>
  203. </link>
  204. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  205. <link name="left_arm_link5_sc">
  206. </link>
  207. <!-- fixed joint between both sub-links -->
  208. <joint name="left_arm_link5_sc_joint" type="fixed">
  209. <origin rpy="0 0 0"/>
  210. <parent link="left_arm_link5"/>
  211. <child link="left_arm_link5_sc"/>
  212. </joint>
  213. <joint name="left_arm_joint5" type="revolute">
  214. <origin rpy="-1.5707963267948966 0 0" xyz="-0.0825 0.384 0"/>
  215. <parent link="left_arm_link4"/>
  216. <child link="left_arm_link5"/>
  217. <axis xyz="0 0 1"/>
  218. <limit effort="12.0" lower="-2.8973" upper="2.8973" velocity="2.61"/>
  219. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
  220. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  221. </joint>
  222. <!-- sub-link defining detailed meshes for collision with environment -->
  223. <link name="left_arm_link6">
  224. <visual>
  225. <geometry>
  226. <mesh filename="package://franka_description/meshes/visual/link6.dae"/>
  227. </geometry>
  228. </visual>
  229. <collision>
  230. <geometry>
  231. <mesh filename="package://franka_description/meshes/collision/link6.stl"/>
  232. </geometry>
  233. </collision>
  234. <inertial>
  235. <origin rpy="0 0 0" xyz="6.0149e-02 -1.4117e-02 -1.0517e-02"/>
  236. <mass value="1.666555"/>
  237. <inertia ixx="0.001964" ixy="0.000109" ixz="-0.001158" iyy="0.004354" iyz="0.000341" izz="0.005433"/>
  238. </inertial>
  239. </link>
  240. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  241. <link name="left_arm_link6_sc">
  242. </link>
  243. <!-- fixed joint between both sub-links -->
  244. <joint name="left_arm_link6_sc_joint" type="fixed">
  245. <origin rpy="0 0 0"/>
  246. <parent link="left_arm_link6"/>
  247. <child link="left_arm_link6_sc"/>
  248. </joint>
  249. <joint name="left_arm_joint6" type="revolute">
  250. <origin rpy="1.5707963267948966 0 0" xyz="0 0 0"/>
  251. <parent link="left_arm_link5"/>
  252. <child link="left_arm_link6"/>
  253. <axis xyz="0 0 1"/>
  254. <limit effort="12.0" lower="-0.0175" upper="3.7525" velocity="2.61"/>
  255. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-0.0175" soft_upper_limit="3.7525"/>
  256. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  257. </joint>
  258. <!-- sub-link defining detailed meshes for collision with environment -->
  259. <link name="left_arm_link7">
  260. <visual>
  261. <geometry>
  262. <mesh filename="package://franka_description/meshes/visual/link7.dae"/>
  263. </geometry>
  264. </visual>
  265. <collision>
  266. <geometry>
  267. <mesh filename="package://franka_description/meshes/collision/link7.stl"/>
  268. </geometry>
  269. </collision>
  270. <inertial>
  271. <origin rpy="0 0 0" xyz="1.0517e-02 -4.252e-03 6.1597e-02"/>
  272. <mass value="0.735522"/>
  273. <inertia ixx="0.012516" ixy="-0.000428" ixz="-0.001196" iyy="0.010027" iyz="-0.000741" izz="0.004815"/>
  274. </inertial>
  275. </link>
  276. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  277. <link name="left_arm_link7_sc">
  278. </link>
  279. <!-- fixed joint between both sub-links -->
  280. <joint name="left_arm_link7_sc_joint" type="fixed">
  281. <origin rpy="0 0 0.7853981633974483"/>
  282. <parent link="left_arm_link7"/>
  283. <child link="left_arm_link7_sc"/>
  284. </joint>
  285. <joint name="left_arm_joint7" type="revolute">
  286. <origin rpy="1.5707963267948966 0 0" xyz="0.088 0 0"/>
  287. <parent link="left_arm_link6"/>
  288. <child link="left_arm_link7"/>
  289. <axis xyz="0 0 1"/>
  290. <limit effort="12.0" lower="-2.8973" upper="2.8973" velocity="2.61"/>
  291. <safety_controller k_position="100.0" k_velocity="40.0" soft_lower_limit="-2.8973" soft_upper_limit="2.8973"/>
  292. <dynamics D="1" K="7000" damping="0.003" friction="0.0" mu_coulomb="0" mu_viscous="16"/>
  293. </joint>
  294. <link name="left_arm_link8"/>
  295. <joint name="left_arm_joint8" type="fixed">
  296. <origin rpy="0 0 0" xyz="0 0 0.107"/>
  297. <parent link="left_arm_link7"/>
  298. <child link="left_arm_link8"/>
  299. </joint>
  300. <joint name="left_arm_hand_joint" type="fixed">
  301. <parent link="left_arm_link8"/>
  302. <child link="left_arm_hand"/>
  303. <origin rpy="0 0 -0.7853981633974483" xyz="0 0 0"/>
  304. </joint>
  305. <!-- sub-link defining detailed meshes for collision with environment -->
  306. <link name="left_arm_hand">
  307. <visual>
  308. <geometry>
  309. <mesh filename="package://franka_description/meshes/visual/hand.dae"/>
  310. </geometry>
  311. </visual>
  312. <collision>
  313. <geometry>
  314. <mesh filename="package://franka_description/meshes/collision/hand.stl"/>
  315. </geometry>
  316. </collision>
  317. <inertial>
  318. <origin rpy="0 0 0" xyz="-0.01 0 0.03"/>
  319. <mass value="0.73"/>
  320. <inertia ixx="0.001" ixy="0" ixz="0" iyy="0.0025" iyz="0" izz="0.0017"/>
  321. </inertial>
  322. </link>
  323. <!-- sub-link defining coarse geometries of real robot's internal self-collision -->
  324. <link name="left_arm_hand_sc">
  325. </link>
  326. <!-- fixed joint between both sub-links -->
  327. <joint name="left_arm_hand_sc_joint" type="fixed">
  328. <origin rpy="0 0 0"/>
  329. <parent link="left_arm_hand"/>
  330. <child link="left_arm_hand_sc"/>
  331. </joint>
  332. <!-- Define the hand_tcp frame -->
  333. <link name="left_arm_hand_tcp"/>
  334. <joint name="left_arm_hand_tcp_joint" type="fixed">
  335. <origin rpy="0 0 0" xyz="0 0 0.1034"/>
  336. <parent link="left_arm_hand"/>
  337. <child link="left_arm_hand_tcp"/>
  338. </joint>
  339. <link name="left_arm_leftfinger">
  340. <visual>
  341. <geometry>
  342. <mesh filename="package://franka_description/meshes/visual/finger.dae"/>
  343. </geometry>
  344. </visual>
  345. <!-- screw mount -->
  346. <collision>
  347. <origin rpy="0 0 0" xyz="0 18.5e-3 11e-3"/>
  348. <geometry>
  349. <box size="22e-3 15e-3 20e-3"/>
  350. </geometry>
  351. </collision>
  352. <!-- cartriage sledge -->
  353. <collision>
  354. <origin rpy="0 0 0" xyz="0 6.8e-3 2.2e-3"/>
  355. <geometry>
  356. <box size="22e-3 8.8e-3 3.8e-3"/>
  357. </geometry>
  358. </collision>
  359. <!-- diagonal finger -->
  360. <collision>
  361. <origin rpy="0.5235987755982988 0 0" xyz="0 15.9e-3 28.35e-3"/>
  362. <geometry>
  363. <box size="17.5e-3 7e-3 23.5e-3"/>
  364. </geometry>
  365. </collision>
  366. <!-- rubber tip with which to grasp -->
  367. <collision>
  368. <origin rpy="0 0 0" xyz="0 7.58e-3 45.25e-3"/>
  369. <geometry>
  370. <box size="17.5e-3 15.2e-3 18.5e-3"/>
  371. </geometry>
  372. </collision>
  373. <inertial>
  374. <origin rpy="0 0 0" xyz="0 0 0"/>
  375. <mass value="0.015"/>
  376. <inertia ixx="2.3749999999999997e-06" ixy="0" ixz="0" iyy="2.3749999999999997e-06" iyz="0" izz="7.5e-07"/>
  377. </inertial>
  378. </link>
  379. <link name="left_arm_rightfinger">
  380. <visual>
  381. <origin rpy="0 0 3.141592653589793" xyz="0 0 0"/>
  382. <geometry>
  383. <mesh filename="package://franka_description/meshes/visual/finger.dae"/>
  384. </geometry>
  385. </visual>
  386. <!-- screw mount -->
  387. <collision>
  388. <origin rpy="0 0 0" xyz="0 -18.5e-3 11e-3"/>
  389. <geometry>
  390. <box size="22e-3 15e-3 20e-3"/>
  391. </geometry>
  392. </collision>
  393. <!-- cartriage sledge -->
  394. <collision>
  395. <origin rpy="0 0 0" xyz="0 -6.8e-3 2.2e-3"/>
  396. <geometry>
  397. <box size="22e-3 8.8e-3 3.8e-3"/>
  398. </geometry>
  399. </collision>
  400. <!-- diagonal finger -->
  401. <collision>
  402. <origin rpy="-0.5235987755982988 0 0" xyz="0 -15.9e-3 28.35e-3"/>
  403. <geometry>
  404. <box size="17.5e-3 7e-3 23.5e-3"/>
  405. </geometry>
  406. </collision>
  407. <!-- rubber tip with which to grasp -->
  408. <collision>
  409. <origin rpy="0 0 0" xyz="0 -7.58e-3 45.25e-3"/>
  410. <geometry>
  411. <box size="17.5e-3 15.2e-3 18.5e-3"/>
  412. </geometry>
  413. </collision>
  414. <inertial>
  415. <origin rpy="0 0 0" xyz="0 0 0"/>
  416. <mass value="0.015"/>
  417. <inertia ixx="2.3749999999999997e-06" ixy="0" ixz="0" iyy="2.3749999999999997e-06" iyz="0" izz="7.5e-07"/>
  418. </inertial>
  419. </link>
  420. <joint name="left_arm_finger_joint1" type="prismatic">
  421. <parent link="left_arm_hand"/>
  422. <child link="left_arm_leftfinger"/>
  423. <origin rpy="0 0 0" xyz="0 0 0.0584"/>
  424. <axis xyz="0 1 0"/>
  425. <limit effort="100" lower="0.0" upper="0.04" velocity="0.2"/>
  426. <dynamics damping="0.3"/>
  427. </joint>
  428. <joint name="left_arm_finger_joint2" type="prismatic">
  429. <parent link="left_arm_hand"/>
  430. <child link="left_arm_rightfinger"/>
  431. <origin rpy="0 0 0" xyz="0 0 0.0584"/>
  432. <axis xyz="0 -1 0"/>
  433. <limit effort="100" lower="0.0" upper="0.04" velocity="0.2"/>
  434. <mimic joint="left_arm_finger_joint1"/>
  435. <dynamics damping="0.3"/>
  436. </joint>
  437. <gazebo reference="left_arm_joint1">
  438. <!-- Needed for ODE to output external wrenches on joints -->
  439. <provideFeedback>true</provideFeedback>
  440. </gazebo>
  441. <transmission name="left_arm_joint1_transmission">
  442. <type>transmission_interface/SimpleTransmission</type>
  443. <joint name="left_arm_joint1">
  444. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  445. </joint>
  446. <actuator name="left_arm_joint1_motor">
  447. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  448. </actuator>
  449. </transmission>
  450. <gazebo reference="left_arm_joint2">
  451. <!-- Needed for ODE to output external wrenches on joints -->
  452. <provideFeedback>true</provideFeedback>
  453. </gazebo>
  454. <transmission name="left_arm_joint2_transmission">
  455. <type>transmission_interface/SimpleTransmission</type>
  456. <joint name="left_arm_joint2">
  457. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  458. </joint>
  459. <actuator name="left_arm_joint2_motor">
  460. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  461. </actuator>
  462. </transmission>
  463. <gazebo reference="left_arm_joint3">
  464. <!-- Needed for ODE to output external wrenches on joints -->
  465. <provideFeedback>true</provideFeedback>
  466. </gazebo>
  467. <transmission name="left_arm_joint3_transmission">
  468. <type>transmission_interface/SimpleTransmission</type>
  469. <joint name="left_arm_joint3">
  470. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  471. </joint>
  472. <actuator name="left_arm_joint3_motor">
  473. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  474. </actuator>
  475. </transmission>
  476. <gazebo reference="left_arm_joint4">
  477. <!-- Needed for ODE to output external wrenches on joints -->
  478. <provideFeedback>true</provideFeedback>
  479. </gazebo>
  480. <transmission name="left_arm_joint4_transmission">
  481. <type>transmission_interface/SimpleTransmission</type>
  482. <joint name="left_arm_joint4">
  483. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  484. </joint>
  485. <actuator name="left_arm_joint4_motor">
  486. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  487. </actuator>
  488. </transmission>
  489. <gazebo reference="left_arm_joint5">
  490. <!-- Needed for ODE to output external wrenches on joints -->
  491. <provideFeedback>true</provideFeedback>
  492. </gazebo>
  493. <transmission name="left_arm_joint5_transmission">
  494. <type>transmission_interface/SimpleTransmission</type>
  495. <joint name="left_arm_joint5">
  496. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  497. </joint>
  498. <actuator name="left_arm_joint5_motor">
  499. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  500. </actuator>
  501. </transmission>
  502. <gazebo reference="left_arm_joint6">
  503. <!-- Needed for ODE to output external wrenches on joints -->
  504. <provideFeedback>true</provideFeedback>
  505. </gazebo>
  506. <transmission name="left_arm_joint6_transmission">
  507. <type>transmission_interface/SimpleTransmission</type>
  508. <joint name="left_arm_joint6">
  509. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  510. </joint>
  511. <actuator name="left_arm_joint6_motor">
  512. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  513. </actuator>
  514. </transmission>
  515. <gazebo reference="left_arm_joint7">
  516. <!-- Needed for ODE to output external wrenches on joints -->
  517. <provideFeedback>true</provideFeedback>
  518. </gazebo>
  519. <transmission name="left_arm_joint7_transmission">
  520. <type>transmission_interface/SimpleTransmission</type>
  521. <joint name="left_arm_joint7">
  522. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  523. </joint>
  524. <actuator name="left_arm_joint7_motor">
  525. <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
  526. </actuator>
  527. </transmission>
  528. <gazebo reference="left_arm_finger_joint1">
  529. <!-- Needed for ODE to output external wrenches on joints -->
  530. <provideFeedback>true</provideFeedback>
  531. </gazebo>
  532. <transmission name="left_arm_finger_joint1_transmission">
  533. <type>transmission_interface/SimpleTransmission</type>
  534. <joint name="left_arm_finger_joint1">
  535. <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
  536. </joint>
  537. <actuator name="left_arm_finger_joint1_motor">
  538. <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
  539. </actuator>
  540. </transmission>
  541. <gazebo reference="left_arm_finger_joint2">
  542. <!-- Needed for ODE to output external wrenches on joints -->
  543. <provideFeedback>true</provideFeedback>
  544. </gazebo>
  545. <transmission name="left_arm_finger_joint2_transmission">
  546. <type>transmission_interface/SimpleTransmission</type>
  547. <joint name="left_arm_finger_joint2">
  548. <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
  549. </joint>
  550. <actuator name="left_arm_finger_joint2_motor">
  551. <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
  552. </actuator>
  553. </transmission>
  554. <!-- load ros_control plugin -->
  555. <gazebo>
  556. <plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control"/>
  557. <robotNamespace>/left_arm</robotNamespace>
  558. </gazebo>
  559. </robot>

Moveit setup assitant的配置

详细的配置介绍和过程参考官方教程:MoveIt Setup Assistant — moveit_tutorials Noetic documentation

        这里我贴上我的配置过程,进行了自碰撞矩阵、规划组、姿态、末端执行器的配置,关于虚拟关节和被动关节以及控制器的环节跳过即可。

自碰撞矩阵,按照默认情况生成即可

规划组分为arm和hand 两个组,arm组名我这里是:left_arm添加如图下所示的joint,hand是:left_hand,添加如图下所示的links

这里我还配置了几个pose,主要方便后期的编程,各个pose包含的关节值:

ready:{0.0, -0.785, 0.0, -2.356, 0.0, 1.571, 0.785}.

open:0.035

close:0.0

 最后就是定义的末端执行器

 完成后会得到一个 我命名为 left_arm_moveit_config的功能包

在工作空间下重新 catkin build 并 source

通过命令 roslaunch left_arm_moveit_config demo.launch能够运行,并且能够通过rviz对及机械臂进行规划则没有问题。

controller的配置

首先是joint_state_controller,主要作用是发布机器人的关节状态和TF变换

在panda_dual_arms/config 下创建 joint_state_controller.yaml

  1. joint_state_controller:
  2. type: joint_state_controller/JointStateController
  3. publish_rate: 50

然后是trajectory_controller,Moveit完成运动规划后输出接口是一个命名为FollowJointTrajectory的action,其中包含一系列规划好的路径点轨迹,Trajectory Controller的作用就是将这些信息转化成Gzebo中机器人需要输入的joint位置。

在panda_dual_arms/config trajectory_controller.yaml

  1. left_arm_trajectory_controller:
  2. type: "position_controllers/JointTrajectoryController"
  3. joints:
  4. - left_arm_joint1
  5. - left_arm_joint2
  6. - left_arm_joint3
  7. - left_arm_joint4
  8. - left_arm_joint5
  9. - left_arm_joint6
  10. - left_arm_joint7
  11. constraints:
  12. goal_time: 0.6
  13. stopped_velocity_tolerance: 0.05
  14. left_arm_joint1: {trajectory: 0.1, goal: 0.1}
  15. left_arm_joint2: {trajectory: 0.1, goal: 0.1}
  16. left_arm_joint3: {trajectory: 0.1, goal: 0.1}
  17. left_arm_joint4: {trajectory: 0.1, goal: 0.1}
  18. left_arm_joint5: {trajectory: 0.1, goal: 0.1}
  19. left_arm_joint6: {trajectory: 0.1, goal: 0.1}
  20. left_arm_joint7: {trajectory: 0.1, goal: 0.1}
  21. stop_trajectory_duration: 0.5
  22. state_publish_rate: 25
  23. action_monitor_rate: 10
  24. #notice that the grippers joint2 mimics joint1
  25. #this is why it is not listed under the hand controllers
  26. left_hand_controller:
  27. type: "effort_controllers/JointTrajectoryController"
  28. joints:
  29. - left_arm_finger_joint1
  30. gains:
  31. left_arm_finger_joint1: {p: 50.0, d: 1.0, i: 0.01, i_clamp: 1.0}

launch文件的编写

launch文件的个部分内容都有注释,主要就是启动gazebo,启动moveit,启动上面的controller,启动rviz

  1. <?xml version="1.0"?>
  2. <launch>
  3. <!-- Run the main MoveIt executable with trajectory execution -->
  4. <include file="$(find left_arm_moveit_config)/launch/move_group.launch">
  5. <arg name="allow_trajectory_execution" value="true" />
  6. <arg name="moveit_controller_manager" value="ros_control" />
  7. <arg name="fake_execution_type" value="interpolate" />
  8. <arg name="info" value="true" />
  9. <arg name="debug" value="false" />
  10. <arg name="pipeline" value="ompl" />
  11. <arg name="load_robot_description" value="true" />
  12. </include>
  13. <!-- Launch empty Gazebo world -->
  14. <include file="$(find gazebo_ros)/launch/empty_world.launch">
  15. <arg name="use_sim_time" value="true" />
  16. <arg name="gui" value="true" />
  17. <arg name="paused" value="false" />
  18. <arg name="debug" value="false" />
  19. </include>
  20. <param name="robot_description" command="$(find xacro)/xacro '$(find panda_dual_arms)/robot_description/left_arm.urdf'" />
  21. <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -param robot_description -model left_arm" />
  22. <!-- Robot state publisher -->
  23. <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
  24. <param name="publish_frequency" type="double" value="50.0" />
  25. <param name="tf_prefix" type="string" value="" />
  26. </node>
  27. <!-- Joint state controller -->
  28. <rosparam file="$(find panda_dual_arms)/config/left_arm_joint_state_controller.yaml" command="load" />
  29. <node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner" args="joint_state_controller" respawn="false" output="screen" />
  30. <!-- Joint trajectory controller -->
  31. <rosparam file="$(find panda_dual_arms)/config/left_arm_trajectory_controller.yaml" command="load" />
  32. <node name="arms_trajectory_controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="left_arm_trajectory_controller left_hand_controller" />
  33. <!-- Start moveit_rviz with the motion planning plugin -->
  34. <include file="$(find left_arm_moveit_config)/launch/moveit_rviz.launch">
  35. <arg name="rviz_config" value="$(find left_arm_moveit_config)/launch/moveit.rviz" />
  36. </include>
  37. </launch>

参考:Multiple Robot Arms — moveit_tutorials Noetic documentation

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/703761
推荐阅读
相关标签
  

闽ICP备14008679号