Gazebo使用笔记(2) —— SDF建模及传感器噪声的添加(以激光雷达为例)

文章目录

  • 1. 传感器
  • 2. 关节测试
  • 3. 模型外观
  • 4. 传感器噪声


<sdf version="1.5">
	<world name="default">
		
		
		<include>
			<uri>model://sunuri>
		include>
		
		
		<include>
		  <uri>model://ground_planeuri>
		include>
		
		
		<model name="velodyne_hdl-32">
		  
		  <link name="base">

			
			<pose>0 0 0.029335 0 0 0pose>
		    <inertial>
		      <mass>1.2mass>
		      <inertia>
				<ixx>0.001087473ixx>
				<iyy>0.001087473iyy>
				<izz>0.001092437izz>
				<ixy>0ixy>
				<ixz>0ixz>
				<iyz>0iyz>
		      inertia>
		    inertial>

			<collision name="base_collision">
			  <geometry>
				<cylinder>
				  
				  <radius>.04267radius>
				  <length>.05867length>
				cylinder>
			  geometry>
			collision>

			
			<visual name="base_visual">
			  <geometry>
				<cylinder>
				  <radius>.04267radius>
				  <length>.05867length>
				cylinder>
			  geometry>
			visual>
		  link>

		  
		  <link name="top">

			
			<pose>0 0 0.095455 0 0 0pose>
		   <inertial>
			 <mass>0.1mass>
			 <inertia>
			   <ixx>0.000090623ixx>
			   <iyy>0.000090623iyy>
			   <izz>0.000091036izz>
			   <ixy>0ixy>
			   <ixz>0ixz>
			   <iyz>0iyz>
			 inertia>
		   inertial>

			<collision name="top_collision">
			  <geometry>
				<cylinder>
				  
				  <radius>0.04267radius>
				  <length>0.07357length>
				cylinder>
			  geometry>
			collision>

			
			<visual name="top_visual">
			  <geometry>
				<cylinder>
				  <radius>0.04267radius>
				  <length>0.07357length>
				cylinder>
			  geometry>
			visual>




			
			<sensor type="ray" name="sensor">

			  
			  <pose>0 0 -0.004645 1.5707 0 0pose>

			  
			  <visualize>truevisualize>

			  
			  <update_rate>30update_rate>
				<ray>
				  
				  <scan>

					
					<horizontal>
					  
					  <samples>32samples>

					  
					  <resolution>1resolution>

					  
					  <min_angle>-0.53529248min_angle>

					  
					  <max_angle>0.18622663max_angle>
					horizontal>
				  scan>

				  
				  <range>

					
					<min>0.05min>

					
					<max>70max>

					
					<resolution>0.02resolution>
				  range>
				ray>
			sensor>

		  link>


			
			<joint type="revolute" name="joint">

			  
			  <pose>0 0 -0.036785 0 0 0pose>

			  
			  <parent>baseparent>

			  
			  <child>topchild>

			  
			  <axis>

				
				<xyz>0 0 1xyz>

				
				<limit>

				  
				  <lower>-10000000000000000lower>
				  <upper>10000000000000000upper>
				limit>
			  axis>
			joint>

		model>

	world>
sdf>

1. 传感器

传感器的添加,以激光传感器velodynelidar为例,gazebo中的激光传感器可以发出一个或多个光束,这些光束会产生距离以及可能的强度数据。

sdf文件中,该传感器由两个部分组成,定义波束的布局和数量,限定一个单独的束的性质

中包含两个块。组件定义在水平平面中发出的光线,该组件定义在垂直平面中发出的光线。

2. 关节测试

打开右面板可设置力、位置、速度等参数,单击开始方针即可看到效果。

右面板的打开:点击右侧竖着的.....,并向左拖动,即可打开默认隐藏的右面板!

Ctrl+R复原world环境

3. 模型外观

需要的工具:freecadblender

sudo apt-get install freecad
sudo apt-get install blender

具体设置参考这儿:http://gazebosim.org/tutorials?cat=guided_i&tut=guided_i2

最终效果如下:
Gazebo使用笔记(2) —— SDF建模及传感器噪声的添加(以激光雷达为例)_第1张图片

4. 传感器噪声

内置高斯噪声~

Ctrl+T打开topic visualization
Gazebo使用笔记(2) —— SDF建模及传感器噪声的添加(以激光雷达为例)_第2张图片
的子标签中添加如下代码:

    <noise>
      
      <type>gaussiantype>
      <mean>0.0mean>
      <stddev>0.1stddev>
    noise>

通过即可修改噪声幅度。

重新加载,发现信号不在圆滑!
Gazebo使用笔记(2) —— SDF建模及传感器噪声的添加(以激光雷达为例)_第3张图片


参考文献:

  • http://gazebosim.org/tutorials
  • 3.https://blog.csdn.net/weixin_41045354/article/details/104281283

你可能感兴趣的:(▶,机器人仿真,▶,机器人操作系统ROS/ROS2)