当前位置:   article > 正文

ZD550搭载Mid360激光雷达Gazebo仿真平台搭建记录_gazebo mid360

gazebo mid360

1. 首先对ZD550SoliWorks文件转出stl格式文件,进行Blender软件导入,完成1000:1比例的缩小。

这里注意,对无人机的位置进行调整,让其中心在质心位置的同时,让质心在坐标轴原点0.2m高度处,保证后续对其碰撞区域设置方便。

2.通过Blender软件将上述文件导出为dae文件,进一步参考PX4官方仿真平台的iris模型,对本ZD550平台进行sdf文件编写:https://github.com/PX4/PX4-Autopilot.git

3.具体仿真出来的模型如图。

sdf文件如下:

  1. <sdf version='1.6'>
  2. <model name='Z550'>
  3. <link name='base_link'>
  4. <pose frame=''>0 0 0 0 -0 0</pose>
  5. <inertial>
  6. <pose frame=''>0 0 0 0 -0 0</pose>
  7. <mass>1.5</mass>
  8. <inertia>
  9. <ixx>0.029125</ixx>
  10. <ixy>0</ixy>
  11. <ixz>0</ixz>
  12. <iyy>0.029125</iyy>
  13. <iyz>0</iyz>
  14. <izz>0.055225</izz>
  15. </inertia>
  16. </inertial>
  17. <collision name='base_link_inertia_collision_4'>
  18. <pose frame=''>0 0 0 0 -0 0</pose>
  19. <geometry>
  20. <box>
  21. <size>0.47 0.47 0.005</size>
  22. </box>
  23. </geometry>
  24. <surface>
  25. <contact>
  26. <ode>
  27. <min_depth>0.001</min_depth>
  28. <max_vel>0</max_vel>
  29. </ode>
  30. </contact>
  31. <friction>
  32. <ode/>
  33. </friction>
  34. </surface>
  35. </collision>
  36. <visual name='base_link_inertia_visual_4'>
  37. <pose frame=''>0 0 0 0 -0 0</pose>
  38. <geometry>
  39. <mesh>
  40. <scale>1 1 1</scale>
  41. <uri>model://Z550/meshes/ZD550_motors_amend.dae</uri>
  42. </mesh>
  43. </geometry>
  44. <material>
  45. <script>
  46. <name>Gazebo/DarkGrey</name>
  47. <uri>file://media/materials/scripts/gazebo.material</uri>
  48. </script>
  49. </material>
  50. </visual>
  51. <gravity>1</gravity>
  52. <velocity_decay/>
  53. </link>
  54. <link name='/imu_link'>
  55. <pose frame=''>0 0 0 0 -0 0</pose>
  56. <inertial>
  57. <pose frame=''>0 0 0 0 -0 0</pose>
  58. <mass>0.015</mass>
  59. <inertia>
  60. <ixx>1e-05</ixx>
  61. <ixy>0</ixy>
  62. <ixz>0</ixz>
  63. <iyy>1e-05</iyy>
  64. <iyz>0</iyz>
  65. <izz>1e-05</izz>
  66. </inertia>
  67. </inertial>
  68. </link>
  69. <joint name='/imu_joint' type='revolute'>
  70. <child>/imu_link</child>
  71. <parent>base_link</parent>
  72. <axis>
  73. <xyz>1 0 0</xyz>
  74. <limit>
  75. <lower>0</lower>
  76. <upper>0</upper>
  77. <effort>0</effort>
  78. <velocity>0</velocity>
  79. </limit>
  80. <dynamics>
  81. <spring_reference>0</spring_reference>
  82. <spring_stiffness>0</spring_stiffness>
  83. </dynamics>
  84. <use_parent_model_frame>0</use_parent_model_frame>
  85. </axis>
  86. </joint>
  87. <link name='rotor_0'>
  88. <pose frame=''>0.2 -0.2 0.34 0 -0 0</pose>
  89. <inertial>
  90. <pose frame=''>0 0 0 0 -0 0</pose>
  91. <mass>0.005</mass>
  92. <inertia>
  93. <ixx>9.75e-07</ixx>
  94. <ixy>0</ixy>
  95. <ixz>0</ixz>
  96. <iyy>0.000273104</iyy>
  97. <iyz>0</iyz>
  98. <izz>0.000274004</izz>
  99. </inertia>
  100. </inertial>
  101. <collision name='rotor_0_collision'>
  102. <pose frame=''>0 0 0 0 -0 0</pose>
  103. <geometry>
  104. <cylinder>
  105. <length>0.005</length>
  106. <radius>0.128</radius>
  107. </cylinder>
  108. </geometry>
  109. <surface>
  110. <contact>
  111. <ode/>
  112. </contact>
  113. <friction>
  114. <ode/>
  115. </friction>
  116. </surface>
  117. </collision>
  118. <visual name='rotor_0_visual'>
  119. <pose frame=''>0 0 0 0 -0 0</pose>
  120. <geometry>
  121. <mesh>
  122. <scale>1 1 1</scale>
  123. <uri>model://rotors_description/meshes/iris_prop_ccw.dae</uri>
  124. </mesh>
  125. </geometry>
  126. <material>
  127. <script>
  128. <name>Gazebo/Blue</name>
  129. <uri>file://media/materials/scripts/gazebo.material</uri>
  130. </script>
  131. </material>
  132. </visual>
  133. <gravity>1</gravity>
  134. <velocity_decay/>
  135. </link>
  136. <joint name='rotor_0_joint' type='revolute'>
  137. <child>rotor_0</child>
  138. <parent>base_link</parent>
  139. <axis>
  140. <xyz>0 0 1</xyz>
  141. <limit>
  142. <lower>-1e+16</lower>
  143. <upper>1e+16</upper>
  144. </limit>
  145. <dynamics>
  146. <spring_reference>0</spring_reference>
  147. <spring_stiffness>0</spring_stiffness>
  148. </dynamics>
  149. <use_parent_model_frame>0</use_parent_model_frame>
  150. </axis>
  151. </joint>
  152. <link name='rotor_1'>
  153. <pose frame=''>-0.2 0.2 0.34 0 -0 0</pose>
  154. <inertial>
  155. <pose frame=''>0 0 0 0 -0 0</pose>
  156. <mass>0.005</mass>
  157. <inertia>
  158. <ixx>9.75e-07</ixx>
  159. <ixy>0</ixy>
  160. <ixz>0</ixz>
  161. <iyy>0.000273104</iyy>
  162. <iyz>0</iyz>
  163. <izz>0.000274004</izz>
  164. </inertia>
  165. </inertial>
  166. <collision name='rotor_1_collision'>
  167. <pose frame=''>0 0 0 0 -0 0</pose>
  168. <geometry>
  169. <cylinder>
  170. <length>0.005</length>
  171. <radius>0.128</radius>
  172. </cylinder>
  173. </geometry>
  174. <surface>
  175. <contact>
  176. <ode/>
  177. </contact>
  178. <friction>
  179. <ode/>
  180. </friction>
  181. </surface>
  182. </collision>
  183. <visual name='rotor_1_visual'>
  184. <pose frame=''>0 0 0 0 -0 0</pose>
  185. <geometry>
  186. <mesh>
  187. <scale>1 1 1</scale>
  188. <uri>model://rotors_description/meshes/iris_prop_ccw.dae</uri>
  189. </mesh>
  190. </geometry>
  191. <material>
  192. <script>
  193. <name>Gazebo/DarkGrey</name>
  194. <uri>file://media/materials/scripts/gazebo.material</uri>
  195. </script>
  196. </material>
  197. </visual>
  198. <gravity>1</gravity>
  199. <velocity_decay/>
  200. </link>
  201. <joint name='rotor_1_joint' type='revolute'>
  202. <child>rotor_1</child>
  203. <parent>base_link</parent>
  204. <axis>
  205. <xyz>0 0 1</xyz>
  206. <limit>
  207. <lower>-1e+16</lower>
  208. <upper>1e+16</upper>
  209. </limit>
  210. <dynamics>
  211. <spring_reference>0</spring_reference>
  212. <spring_stiffness>0</spring_stiffness>
  213. </dynamics>
  214. <use_parent_model_frame>0</use_parent_model_frame>
  215. </axis>
  216. </joint>
  217. <link name='rotor_2'>
  218. <pose frame=''>0.2 0.2 0.34 0 -0 0</pose>
  219. <inertial>
  220. <pose frame=''>0 0 0 0 -0 0</pose>
  221. <mass>0.005</mass>
  222. <inertia>
  223. <ixx>9.75e-07</ixx>
  224. <ixy>0</ixy>
  225. <ixz>0</ixz>
  226. <iyy>0.000273104</iyy>
  227. <iyz>0</iyz>
  228. <izz>0.000274004</izz>
  229. </inertia>
  230. </inertial>
  231. <collision name='rotor_2_collision'>
  232. <pose frame=''>0 0 0 0 -0 0</pose>
  233. <geometry>
  234. <cylinder>
  235. <length>0.005</length>
  236. <radius>0.128</radius>
  237. </cylinder>
  238. </geometry>
  239. <surface>
  240. <contact>
  241. <ode/>
  242. </contact>
  243. <friction>
  244. <ode/>
  245. </friction>
  246. </surface>
  247. </collision>
  248. <visual name='rotor_2_visual'>
  249. <pose frame=''>0 0 0 0 -0 0</pose>
  250. <geometry>
  251. <mesh>
  252. <scale>1 1 1</scale>
  253. <uri>model://rotors_description/meshes/iris_prop_cw.dae</uri>
  254. </mesh>
  255. </geometry>
  256. <material>
  257. <script>
  258. <name>Gazebo/Blue</name>
  259. <uri>file://media/materials/scripts/gazebo.material</uri>
  260. </script>
  261. </material>
  262. </visual>
  263. <gravity>1</gravity>
  264. <velocity_decay/>
  265. </link>
  266. <joint name='rotor_2_joint' type='revolute'>
  267. <child>rotor_2</child>
  268. <parent>base_link</parent>
  269. <axis>
  270. <xyz>0 0 1</xyz>
  271. <limit>
  272. <lower>-1e+16</lower>
  273. <upper>1e+16</upper>
  274. </limit>
  275. <dynamics>
  276. <spring_reference>0</spring_reference>
  277. <spring_stiffness>0</spring_stiffness>
  278. </dynamics>
  279. <use_parent_model_frame>0</use_parent_model_frame>
  280. </axis>
  281. </joint>
  282. <link name='rotor_3'>
  283. <pose frame=''>-0.2 -0.2 0.34 0 -0 0</pose>
  284. <inertial>
  285. <pose frame=''>0 0 0 0 -0 0</pose>
  286. <mass>0.005</mass>
  287. <inertia>
  288. <ixx>9.75e-07</ixx>
  289. <ixy>0</ixy>
  290. <ixz>0</ixz>
  291. <iyy>0.000273104</iyy>
  292. <iyz>0</iyz>
  293. <izz>0.000274004</izz>
  294. </inertia>
  295. </inertial>
  296. <collision name='rotor_3_collision'>
  297. <pose frame=''>0 0 0 0 -0 0</pose>
  298. <geometry>
  299. <cylinder>
  300. <length>0.005</length>
  301. <radius>0.128</radius>
  302. </cylinder>
  303. </geometry>
  304. <surface>
  305. <contact>
  306. <ode/>
  307. </contact>
  308. <friction>
  309. <ode/>
  310. </friction>
  311. </surface>
  312. </collision>
  313. <visual name='rotor_3_visual'>
  314. <pose frame=''>0 0 0 0 -0 0</pose>
  315. <geometry>
  316. <mesh>
  317. <scale>1 1 1</scale>
  318. <uri>model://rotors_description/meshes/iris_prop_cw.dae</uri>
  319. </mesh>
  320. </geometry>
  321. <material>
  322. <script>
  323. <name>Gazebo/DarkGrey</name>
  324. <uri>file://media/materials/scripts/gazebo.material</uri>
  325. </script>
  326. </material>
  327. </visual>
  328. <gravity>1</gravity>
  329. <velocity_decay/>
  330. </link>
  331. <joint name='rotor_3_joint' type='revolute'>
  332. <child>rotor_3</child>
  333. <parent>base_link</parent>
  334. <axis>
  335. <xyz>0 0 1</xyz>
  336. <limit>
  337. <lower>-1e+16</lower>
  338. <upper>1e+16</upper>
  339. </limit>
  340. <dynamics>
  341. <spring_reference>0</spring_reference>
  342. <spring_stiffness>0</spring_stiffness>
  343. </dynamics>
  344. <use_parent_model_frame>0</use_parent_model_frame>
  345. </axis>
  346. </joint>
  347. <plugin name='rosbag' filename='libgazebo_multirotor_base_plugin.so'>
  348. <robotNamespace/>
  349. <linkName>base_link</linkName>
  350. <rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
  351. </plugin>
  352. <plugin name='front_right_motor_model' filename='libgazebo_motor_model.so'>
  353. <robotNamespace/>
  354. <jointName>rotor_0_joint</jointName>
  355. <linkName>rotor_0</linkName>
  356. <turningDirection>ccw</turningDirection>
  357. <timeConstantUp>0.0125</timeConstantUp>
  358. <timeConstantDown>0.025</timeConstantDown>
  359. <maxRotVelocity>1100</maxRotVelocity>
  360. <motorConstant>8.54858e-06</motorConstant>
  361. <momentConstant>0.06</momentConstant>
  362. <commandSubTopic>/gazebo/command/motor_speed</commandSubTopic>
  363. <motorNumber>0</motorNumber>
  364. <rotorDragCoefficient>0.000175</rotorDragCoefficient>
  365. <rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
  366. <motorSpeedPubTopic>/motor_speed/0</motorSpeedPubTopic>
  367. <rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
  368. </plugin>
  369. <plugin name='back_left_motor_model' filename='libgazebo_motor_model.so'>
  370. <robotNamespace/>
  371. <jointName>rotor_1_joint</jointName>
  372. <linkName>rotor_1</linkName>
  373. <turningDirection>ccw</turningDirection>
  374. <timeConstantUp>0.0125</timeConstantUp>
  375. <timeConstantDown>0.025</timeConstantDown>
  376. <maxRotVelocity>1100</maxRotVelocity>
  377. <motorConstant>8.54858e-06</motorConstant>
  378. <momentConstant>0.06</momentConstant>
  379. <commandSubTopic>/gazebo/command/motor_speed</commandSubTopic>
  380. <motorNumber>1</motorNumber>
  381. <rotorDragCoefficient>0.000175</rotorDragCoefficient>
  382. <rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
  383. <motorSpeedPubTopic>/motor_speed/1</motorSpeedPubTopic>
  384. <rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
  385. </plugin>
  386. <plugin name='front_left_motor_model' filename='libgazebo_motor_model.so'>
  387. <robotNamespace/>
  388. <jointName>rotor_2_joint</jointName>
  389. <linkName>rotor_2</linkName>
  390. <turningDirection>cw</turningDirection>
  391. <timeConstantUp>0.0125</timeConstantUp>
  392. <timeConstantDown>0.025</timeConstantDown>
  393. <maxRotVelocity>1100</maxRotVelocity>
  394. <motorConstant>8.54858e-06</motorConstant>
  395. <momentConstant>0.06</momentConstant>
  396. <commandSubTopic>/gazebo/command/motor_speed</commandSubTopic>
  397. <motorNumber>2</motorNumber>
  398. <rotorDragCoefficient>0.000175</rotorDragCoefficient>
  399. <rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
  400. <motorSpeedPubTopic>/motor_speed/2</motorSpeedPubTopic>
  401. <rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
  402. </plugin>
  403. <plugin name='back_right_motor_model' filename='libgazebo_motor_model.so'>
  404. <robotNamespace/>
  405. <jointName>rotor_3_joint</jointName>
  406. <linkName>rotor_3</linkName>
  407. <turningDirection>cw</turningDirection>
  408. <timeConstantUp>0.0125</timeConstantUp>
  409. <timeConstantDown>0.025</timeConstantDown>
  410. <maxRotVelocity>1100</maxRotVelocity>
  411. <motorConstant>8.54858e-06</motorConstant>
  412. <momentConstant>0.06</momentConstant>
  413. <commandSubTopic>/gazebo/command/motor_speed</commandSubTopic>
  414. <motorNumber>3</motorNumber>
  415. <rotorDragCoefficient>0.000175</rotorDragCoefficient>
  416. <rollingMomentCoefficient>1e-06</rollingMomentCoefficient>
  417. <motorSpeedPubTopic>/motor_speed/3</motorSpeedPubTopic>
  418. <rotorVelocitySlowdownSim>10</rotorVelocitySlowdownSim>
  419. </plugin>
  420. <plugin name='gps_plugin' filename='libgazebo_gps_plugin.so'>
  421. <robotNamespace/>
  422. <gpsNoise>1</gpsNoise>
  423. </plugin>
  424. <plugin name='magnetometer_plugin' filename='libgazebo_magnetometer_plugin.so'>
  425. <robotNamespace/>
  426. <pubRate>100</pubRate>
  427. <noiseDensity>0.0004</noiseDensity>
  428. <randomWalk>6.4e-06</randomWalk>
  429. <biasCorrelationTime>600</biasCorrelationTime>
  430. <magTopic>/mag</magTopic>
  431. </plugin>
  432. <plugin name='barometer_plugin' filename='libgazebo_barometer_plugin.so'>
  433. <robotNamespace/>
  434. <pubRate>50</pubRate>
  435. <baroTopic>/baro</baroTopic>
  436. </plugin>
  437. <plugin name='mavlink_interface' filename='libgazebo_mavlink_interface.so'>
  438. <robotNamespace/>
  439. <imuSubTopic>/imu</imuSubTopic>
  440. <gpsSubTopic>/gps</gpsSubTopic>
  441. <magSubTopic>/mag</magSubTopic>
  442. <baroSubTopic>/baro</baroSubTopic>
  443. <mavlink_addr>INADDR_ANY</mavlink_addr>
  444. <mavlink_udp_port>14560</mavlink_udp_port>
  445. <mavlink_tcp_port>4560</mavlink_tcp_port>
  446. <serialEnabled>0</serialEnabled>
  447. <serialDevice>/dev/ttyACM0</serialDevice>
  448. <baudRate>921600</baudRate>
  449. <qgc_addr>INADDR_ANY</qgc_addr>
  450. <qgc_udp_port>14550</qgc_udp_port>
  451. <sdk_addr>INADDR_ANY</sdk_addr>
  452. <sdk_udp_port>14540</sdk_udp_port>
  453. <hil_mode>0</hil_mode>
  454. <hil_state_level>0</hil_state_level>
  455. <vehicle_is_tailsitter>0</vehicle_is_tailsitter>
  456. <send_vision_estimation>1</send_vision_estimation>
  457. <send_odometry>0</send_odometry>
  458. <enable_lockstep>1</enable_lockstep>
  459. <use_tcp>1</use_tcp>
  460. <motorSpeedCommandPubTopic>/gazebo/command/motor_speed</motorSpeedCommandPubTopic>
  461. <control_channels>
  462. <channel name='rotor1'>
  463. <input_index>0</input_index>
  464. <input_offset>0</input_offset>
  465. <input_scaling>1000</input_scaling>
  466. <zero_position_disarmed>0</zero_position_disarmed>
  467. <zero_position_armed>100</zero_position_armed>
  468. <joint_control_type>velocity</joint_control_type>
  469. </channel>
  470. <channel name='rotor2'>
  471. <input_index>1</input_index>
  472. <input_offset>0</input_offset>
  473. <input_scaling>1000</input_scaling>
  474. <zero_position_disarmed>0</zero_position_disarmed>
  475. <zero_position_armed>100</zero_position_armed>
  476. <joint_control_type>velocity</joint_control_type>
  477. </channel>
  478. <channel name='rotor3'>
  479. <input_index>2</input_index>
  480. <input_offset>0</input_offset>
  481. <input_scaling>1000</input_scaling>
  482. <zero_position_disarmed>0</zero_position_disarmed>
  483. <zero_position_armed>100</zero_position_armed>
  484. <joint_control_type>velocity</joint_control_type>
  485. </channel>
  486. <channel name='rotor4'>
  487. <input_index>3</input_index>
  488. <input_offset>0</input_offset>
  489. <input_scaling>1000</input_scaling>
  490. <zero_position_disarmed>0</zero_position_disarmed>
  491. <zero_position_armed>100</zero_position_armed>
  492. <joint_control_type>velocity</joint_control_type>
  493. </channel>
  494. <channel name='rotor5'>
  495. <input_index>4</input_index>
  496. <input_offset>1</input_offset>
  497. <input_scaling>324.6</input_scaling>
  498. <zero_position_disarmed>0</zero_position_disarmed>
  499. <zero_position_armed>0</zero_position_armed>
  500. <joint_control_type>velocity</joint_control_type>
  501. <joint_control_pid>
  502. <p>0.1</p>
  503. <i>0</i>
  504. <d>0</d>
  505. <iMax>0.0</iMax>
  506. <iMin>0.0</iMin>
  507. <cmdMax>2</cmdMax>
  508. <cmdMin>-2</cmdMin>
  509. </joint_control_pid>
  510. <joint_name>zephyr_delta_wing::propeller_joint</joint_name>
  511. </channel>
  512. <channel name='rotor6'>
  513. <input_index>5</input_index>
  514. <input_offset>0</input_offset>
  515. <input_scaling>0.524</input_scaling>
  516. <zero_position_disarmed>0</zero_position_disarmed>
  517. <zero_position_armed>0</zero_position_armed>
  518. <joint_control_type>position</joint_control_type>
  519. <joint_name>zephyr_delta_wing::flap_left_joint</joint_name>
  520. <joint_control_pid>
  521. <p>10.0</p>
  522. <i>0</i>
  523. <d>0</d>
  524. <iMax>0</iMax>
  525. <iMin>0</iMin>
  526. <cmdMax>20</cmdMax>
  527. <cmdMin>-20</cmdMin>
  528. </joint_control_pid>
  529. </channel>
  530. <channel name='rotor7'>
  531. <input_index>6</input_index>
  532. <input_offset>0</input_offset>
  533. <input_scaling>0.524</input_scaling>
  534. <zero_position_disarmed>0</zero_position_disarmed>
  535. <zero_position_armed>0</zero_position_armed>
  536. <joint_control_type>position</joint_control_type>
  537. <joint_name>zephyr_delta_wing::flap_right_joint</joint_name>
  538. <joint_control_pid>
  539. <p>10.0</p>
  540. <i>0</i>
  541. <d>0</d>
  542. <iMax>0</iMax>
  543. <iMin>0</iMin>
  544. <cmdMax>20</cmdMax>
  545. <cmdMin>-20</cmdMin>
  546. </joint_control_pid>
  547. </channel>
  548. <channel name='rotor8'>
  549. <input_index>7</input_index>
  550. <input_offset>0</input_offset>
  551. <input_scaling>0.524</input_scaling>
  552. <zero_position_disarmed>0</zero_position_disarmed>
  553. <zero_position_armed>0</zero_position_armed>
  554. <joint_control_type>position</joint_control_type>
  555. </channel>
  556. </control_channels>
  557. </plugin>
  558. <static>0</static>
  559. <plugin name='rotors_gazebo_imu_plugin' filename='libgazebo_imu_plugin.so'>
  560. <robotNamespace/>
  561. <linkName>/imu_link</linkName>
  562. <imuTopic>/imu</imuTopic>
  563. <gyroscopeNoiseDensity>0.00018665</gyroscopeNoiseDensity>
  564. <gyroscopeRandomWalk>3.8785e-05</gyroscopeRandomWalk>
  565. <gyroscopeBiasCorrelationTime>1000.0</gyroscopeBiasCorrelationTime>
  566. <gyroscopeTurnOnBiasSigma>0.0087</gyroscopeTurnOnBiasSigma>
  567. <accelerometerNoiseDensity>0.00186</accelerometerNoiseDensity>
  568. <accelerometerRandomWalk>0.006</accelerometerRandomWalk>
  569. <accelerometerBiasCorrelationTime>300.0</accelerometerBiasCorrelationTime>
  570. <accelerometerTurnOnBiasSigma>0.196</accelerometerTurnOnBiasSigma>
  571. </plugin>
  572. </model>
  573. </sdf>

完成这一过程中间,本来是设计了一套桨叶的,但使用该桨叶仿真时,需要对系统的PID参数重新调整,否则起飞过程飘忽不定。 

4. 通过到Mid360官网(Downloads - Mid-360 激光雷达 - Livox)下载模型文件,按照上述步骤导出dae文件,注意Mid360的坐标系。

5. 根据肖昆大佬的xtdrone文档进行Mid360的插件布置,三维固态激光SLAM(livox) · 语雀

 主要的参考还包括:GitHub - Luchuanzhao/Livox_simulation_customMsg: Livox simulation for Ubuntu18 and Gazebo 9, and can import 3 Ros messages: PointCloud, PointCloud2 and CustomMsg, they can be used in A-LOAM, Fast-LIO and so on.

配置好的Mid360sdf文件为:

  1. <sdf version='1.6'>
  2. <model name='Mid360'>
  3. <link name='livox_base'>
  4. <pose frame=''>0 0 0 0 -0 0</pose>
  5. <inertial>
  6. <pose frame=''>0 0 0 0 -0 0</pose>
  7. <mass>0.2</mass>
  8. <inertia>
  9. <ixx>0.02</ixx>
  10. <ixy>0</ixy>
  11. <ixz>0</ixz>
  12. <iyy>0.02</iyy>
  13. <iyz>0</iyz>
  14. <izz>0.02</izz>
  15. </inertia>
  16. </inertial>
  17. <collision name='livox_base_collision'>
  18. <pose frame=''>0 0 0 0 -0 0</pose>
  19. <geometry>
  20. <mesh>
  21. <scale>1 1 1</scale>
  22. <uri>model://livox_mid40/meshes/livox_mid40.dae</uri>
  23. </mesh>
  24. </geometry>
  25. </collision>
  26. <visual name='livox_base_visual'>
  27. <pose frame=''>0 0 0 0 -0 0</pose>
  28. <geometry>
  29. <mesh>
  30. <scale>1 1 1</scale>
  31. <uri>model://livox_mid40/meshes/mid360_rules.dae</uri>
  32. </mesh>
  33. </geometry>
  34. </visual>
  35. <gravity>1</gravity>
  36. <velocity_decay/>
  37. <sensor name='laser_livox' type='ray'>
  38. <visualize>1</visualize>
  39. <update_rate>10</update_rate>
  40. <always_on>1</always_on>
  41. <plugin name='gazebo_ros_laser_controller' filename='liblivox_laser_simulation.so'>
  42. <ray>
  43. <scan>
  44. <horizontal>
  45. <samples>100</samples>
  46. <resolution>1</resolution>
  47. <min_angle>-0.614355377778</min_angle>
  48. <max_angle>0.614355377778</max_angle>
  49. </horizontal>
  50. <vertical>
  51. <samples>50</samples>
  52. <resolution>1</resolution>
  53. <min_angle>-0.673696522222</min_angle>
  54. <max_angle>0.673696522222</max_angle>
  55. </vertical>
  56. </scan>
  57. <range>
  58. <min>0.1</min>
  59. <max>200.0</max>
  60. <resolution>0.002</resolution>
  61. </range>
  62. <noise>
  63. <type>gaussian</type>
  64. <mean>0.0</mean>
  65. <stddev>0.01</stddev>
  66. </noise>
  67. </ray>
  68. <visualize>1</visualize>
  69. <samples>10000</samples>
  70. <downsample>1</downsample>
  71. <csv_file_name>/home/ywb/PX4_Files/PX4_Firmware/Tools/sitl_gazebo/models/livox_mid40/scan_mode/mid360.csv</csv_file_name>
  72. <ros_topic>/scan</ros_topic>
  73. </plugin>
  74. <pose frame=''>0 0 0 0 -0 0</pose>
  75. </sensor>
  76. </link>
  77. </model>
  78. </sdf>

 (1)刚开始打算按照XTdrone给出的Livox文件进行修改,将自己的dae文件放置进去,将碰撞模型和可视化模型均改为mid360.dae,仿真发现会出现卡顿的情况,目前还没有解决。暂时是使用了文档中提到的livox_mid40.dae作为碰撞参考,可视化部分还是使用mid360.dae文件。

(2)当时启动gazebo,仿真的mid360模型文件存在,但并没有点云数据,通过查看终端,发现是 mid360插件不能找到mid360.csv文件,然后最后通过写入绝对路径的方法成功仿真出点云数据,这里将PX4官方提供的velodyne的点云和mid360仿真的点云做了个大致对比,整体效果还行。

Velodyne:

Mid360:

6. 最后将Mid360固定到ZD550平台上,最后的ZD550_Mid360平台sdf文件:

  1. <?xml version="1.0"?>
  2. <sdf version="1.6">
  3. <model name="Z550_Mid360_down">
  4. <include>
  5. <uri>model://Z550</uri>
  6. </include>
  7. <include>
  8. <uri>model://Mid360</uri>
  9. <pose>0 0 0.155 3.1415926 0 0</pose>
  10. </include>
  11. <joint name="3Dlidar_joint" type="revolute">
  12. <child>Mid360::livox_base</child>
  13. <parent>Z550::base_link</parent>
  14. <axis>
  15. <xyz>0 0 1</xyz>
  16. <limit>
  17. <upper>0</upper>
  18. <lower>0</lower>
  19. </limit>
  20. </axis>
  21. </joint>
  22. </model>
  23. </sdf>

 最终的仿真效果如下

上述文件地址:https://download.csdn.net/download/weixin_52814031/88541781?spm=1001.2014.3001.5503

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

闽ICP备14008679号