|
| 1 | +<?xml version="1.0"?> |
| 2 | +<robot name="$(arg mav_name)" xmlns:xacro="http://ros.org/wiki/xacro"> |
| 3 | + <xacro:include filename="$(find rotors_description)/urdf/component_snippets.xacro" /> |
| 4 | + |
| 5 | + <link name="rgbd_camera/base_link"> |
| 6 | + <collision> |
| 7 | + <origin xyz="0 -0.0175 0" rpy="0 0 0" /> |
| 8 | + <geometry> |
| 9 | + <box size="0.04 0.04 0.02" /> |
| 10 | + </geometry> |
| 11 | + </collision> |
| 12 | + <visual> |
| 13 | + <origin xyz="0 0 0" rpy="0 0 0" /> |
| 14 | + <geometry> |
| 15 | + <box size="0.04 0.04 0.02"/> |
| 16 | + </geometry> |
| 17 | + <material name="black" /> |
| 18 | + </visual> |
| 19 | + </link> |
| 20 | + |
| 21 | +<link name="rgbd_camera/base_link_gazebo"/> |
| 22 | + |
| 23 | +<joint name="rgbd_camera/base_link_gazebo_joint" type="fixed"> |
| 24 | + <origin xyz="0 0 0" rpy="${pi/2} ${-pi/2} 0" /> |
| 25 | + <parent link="rgbd_camera/base_link"/> |
| 26 | + <child link="rgbd_camera/base_link_gazebo"/> |
| 27 | + |
| 28 | +</joint> |
| 29 | + |
| 30 | + |
| 31 | +<!-- Define Macro to add a depth camera using noisy depth plugin --> |
| 32 | + <xacro:macro name="rgbd_sensor_depth_macro" |
| 33 | + params="namespace parent_link camera_suffix frame_rate width height fov max_range min_range baseline *origin"> |
| 34 | + <link name="${namespace}/camera_${camera_suffix}_link"> |
| 35 | + <collision> |
| 36 | + <origin xyz="0 0 0" rpy="0 0 0" /> |
| 37 | + <geometry> |
| 38 | + <cylinder length="0.01" radius="0.007" /> |
| 39 | + </geometry> |
| 40 | + </collision> |
| 41 | + <inertial> |
| 42 | + <mass value="1e-5" /> |
| 43 | + <origin xyz="0 0 0" rpy="0 0 0" /> |
| 44 | + <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" /> |
| 45 | + </inertial> |
| 46 | + </link> |
| 47 | + <joint name="${namespace}/camera_${camera_suffix}_joint" type="fixed"> |
| 48 | + <xacro:insert_block name="origin" /> |
| 49 | + <parent link="${parent_link}" /> |
| 50 | + <child link="${namespace}/camera_${camera_suffix}_link" /> |
| 51 | + <limit upper="0" lower="0" effort="0" velocity="0" /> |
| 52 | + </joint> |
| 53 | + |
| 54 | + <link name="${namespace}/camera_${camera_suffix}_optical_center_link" /> |
| 55 | + <joint name="${namespace}/camera_${camera_suffix}_optical_center_joint" type="fixed"> |
| 56 | + <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}" /> |
| 57 | + <parent link="${namespace}/camera_${camera_suffix}_link" /> |
| 58 | + <child link="${namespace}/camera_${camera_suffix}_optical_center_link" /> |
| 59 | + <limit upper="0" lower="0" effort="0" velocity="0" /> |
| 60 | + </joint> |
| 61 | + |
| 62 | + <!-- Call rgb sensor macro--> |
| 63 | + |
| 64 | + <gazebo reference="${namespace}/camera_${camera_suffix}_link"> |
| 65 | + <sensor type="depth" name="${namespace}_camera_${camera_suffix}"> |
| 66 | + <always_on>true</always_on> |
| 67 | + <update_rate>${frame_rate}</update_rate> |
| 68 | + <camera> |
| 69 | + <horizontal_fov>${fov}</horizontal_fov> |
| 70 | + <image> |
| 71 | + <format>L8</format> |
| 72 | + <width>${width}</width> |
| 73 | + <height>${height}</height> |
| 74 | + </image> |
| 75 | + <clip> |
| 76 | + <near>${min_range}</near> |
| 77 | + <far>${max_range}</far> |
| 78 | + </clip> |
| 79 | + </camera> |
| 80 | + <plugin name="${namespace}_camera_${camera_suffix}" filename="librotors_gazebo_noisydepth_plugin.so"> |
| 81 | + <robotNamespace>${namespace}</robotNamespace> |
| 82 | + <alwaysOn>true</alwaysOn> |
| 83 | + <baseline>${baseline}</baseline> |
| 84 | + <updateRate>${frame_rate}</updateRate> |
| 85 | + <cameraName>camera_${camera_suffix}</cameraName> |
| 86 | + <horizontal_fov>${fov}</horizontal_fov> |
| 87 | + <depthNoiseModelName>PMD</depthNoiseModelName> |
| 88 | + <depthNoiseMinDist>0.1</depthNoiseMinDist> |
| 89 | + <depthNoiseMaxDist>6.0</depthNoiseMaxDist> |
| 90 | + |
| 91 | + <imageTopicName>camera/image_raw</imageTopicName> |
| 92 | + <cameraInfoTopicName>camera/camera_info</cameraInfoTopicName> |
| 93 | + <depthImageTopicName>depth/image_raw</depthImageTopicName> |
| 94 | + <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName> |
| 95 | + <pointCloudTopicName>depth/points</pointCloudTopicName> |
| 96 | + <frameName>camera_${camera_suffix}_optical_center_link</frameName> |
| 97 | + <distortionK1>0.0</distortionK1> |
| 98 | + <distortionK2>0.0</distortionK2> |
| 99 | + <distortionK3>0.0</distortionK3> |
| 100 | + <distortionT1>0.0</distortionT1> |
| 101 | + <distortionT2>0.0</distortionT2> |
| 102 | + </plugin> |
| 103 | + </sensor> |
| 104 | + |
| 105 | + <sensor type="camera" name="${namespace}_camera_${camera_suffix}"> |
| 106 | + <update_rate>${frame_rate}</update_rate> |
| 107 | + <camera name="intensity"> |
| 108 | + <horizontal_fov>${fov}</horizontal_fov> |
| 109 | + <image> |
| 110 | + <width>${width}</width> |
| 111 | + <height>${height}</height> |
| 112 | + <format>L8</format> |
| 113 | + </image> |
| 114 | + <clip> |
| 115 | + <near>0.01</near> |
| 116 | + <far>100.0</far> |
| 117 | + </clip> |
| 118 | + <noise> |
| 119 | + <type>gaussian</type> |
| 120 | + <!-- Noise is sampled independently per pixel on each frame. |
| 121 | + That pixel's noise value is added to each of its color |
| 122 | + channels, which at that point lie in the range [0,1]. --> |
| 123 | + <mean>0.07</mean> |
| 124 | + <stddev>0.0</stddev> |
| 125 | + </noise> |
| 126 | + </camera> |
| 127 | + <plugin name="${namespace}_camera_${camera_suffix}_controller" filename="libgazebo_ros_camera.so"> |
| 128 | + <robotNamespace>${namespace}</robotNamespace> |
| 129 | + <alwaysOn>true</alwaysOn> |
| 130 | + <updateRate>${frame_rate}</updateRate> |
| 131 | + <cameraName>camera_${camera_suffix}</cameraName> |
| 132 | + <imageTopicName>intensity/image_raw</imageTopicName> |
| 133 | + <cameraInfoTopicName>intensity/camera_info</cameraInfoTopicName> |
| 134 | + <frameName>camera_${camera_suffix}_optical_center_link</frameName> |
| 135 | + <hackBaseline>0.0</hackBaseline> |
| 136 | + <distortionK1>0.0</distortionK1> |
| 137 | + <distortionK2>0.0</distortionK2> |
| 138 | + <distortionK3>0.0</distortionK3> |
| 139 | + <distortionT1>0.0</distortionT1> |
| 140 | + <distortionT2>0.0</distortionT2> |
| 141 | + </plugin> |
| 142 | +</sensor> |
| 143 | + </gazebo> |
| 144 | + |
| 145 | + </xacro:macro> |
| 146 | + |
| 147 | + <xacro:rgbd_sensor_depth_macro |
| 148 | + namespace="${namespace}/rgbd" parent_link="rgbd_camera/base_link_gazebo" |
| 149 | + camera_suffix="depth" |
| 150 | + frame_rate="5.0" |
| 151 | + fov = "1.59174" |
| 152 | + baseline = "0.05" |
| 153 | + width = "352" |
| 154 | + height = "287" |
| 155 | + max_range="7.0" |
| 156 | + min_range="0.05"> |
| 157 | + <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> |
| 158 | + </xacro:rgbd_sensor_depth_macro> |
| 159 | + |
| 160 | +</robot> |
0 commit comments