-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simulation support for RGB and stereo cameras (#78)
- Loading branch information
Showing
6 changed files
with
156 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,94 @@ | ||
<?xml version="1.0"?> | ||
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="robot"> | ||
|
||
<plugin filename="ignition-gazebo-sensors-system" name="ignition::gazebo::systems::Sensors"> | ||
<render_engine>ogre2</render_engine> | ||
</plugin> | ||
|
||
<link name="rgb_camera_link"> | ||
<xacro:body mass="0.001" d="0.010" h="0.03" w="0.03"> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
</xacro:body> | ||
<collision> | ||
<geometry> | ||
<box size="0.010 0.03 0.03"/> | ||
</geometry> | ||
</collision> | ||
<robot name="rae" | ||
xmlns:xacro="http://ros.org/wiki/xacro"> | ||
<xacro:macro name="rae_mono_camera" params="camera_name ns enable_depth:='false'"> | ||
|
||
<link name="rae_${camera_name}_sim_camera_optical_frame"> | ||
<xacro:body mass="0.00001" d="0.00001" h="0.000003" w="0.00001"> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
</xacro:body> | ||
</link> | ||
|
||
<joint name="rgb_camera_joint" type="fixed"> | ||
<parent link="base_link" /> | ||
<child link="rgb_camera_link" /> | ||
<origin xyz="0.09 0.0 0.025" rpy="0 0 0" /> | ||
<joint name="rae_${camera_name}_sim_camera_optical_frame_joint" type="fixed"> | ||
<origin xyz="0.0 0.0 0.0" rpy="${pi/2.0} ${-pi/2.0} 0.0" /> | ||
<parent link="rae_${camera_name}_camera_optical_frame" /> | ||
<child link="rae_${camera_name}_sim_camera_optical_frame" /> | ||
</joint> | ||
|
||
<link name="rgb_camera_link_optical_frame"> | ||
<xacro:body mass="0.00001" d="0.0000010" h="0.000003" w="0.00003"> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
</xacro:body> | ||
<xacro:if value="${enable_depth}"> | ||
<xacro:property name="camera_type" value="rgbd_camera" /> | ||
<xacro:property name="topic_postfix" value="" /> | ||
</xacro:if> | ||
<xacro:unless value="${enable_depth}"> | ||
<xacro:property name="camera_type" value="camera" /> | ||
<xacro:property name="topic_postfix" value="/image_raw" /> | ||
</xacro:unless> | ||
|
||
|
||
<gazebo reference="rae_${camera_name}_sim_camera_optical_frame"> | ||
<sensor name="${camera_name}_mono_camera" type="${camera_type}"> | ||
<update_rate>15.0</update_rate> | ||
<topic>${ns}/rae/${camera_name}${topic_postfix}</topic> | ||
<ignition_frame_id>${ns}_rae_${camera_name}_sim_camera_optical_frame</ignition_frame_id> | ||
<camera> | ||
<horizontal_fov>${105.0/180.0*pi}</horizontal_fov> | ||
<image> | ||
<width>640</width> | ||
<height>400</height> | ||
</image> | ||
<clip> | ||
<near>0.2</near> | ||
<far>6.0</far> | ||
</clip> | ||
</camera> | ||
</sensor> | ||
|
||
<plugin filename="ignition-gazebo-sensors-system" name="ignition::gazebo::systems::Sensors"> | ||
<engine>ogre2</engine> | ||
</plugin> | ||
</gazebo> | ||
</xacro:macro> | ||
|
||
<xacro:macro name="rae_rgb_camera" params="camera_name ns"> | ||
<link name="rae_${camera_name}_sim_optical_frame"> | ||
<xacro:body mass="0.00001" d="0.00001" h="0.000003" w="0.00001"> | ||
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /> | ||
</xacro:body> | ||
</link> | ||
|
||
<joint name="rgb_camera_link_optical_frame_joint" type="fixed"> | ||
<origin xyz="0.0051 0 0" rpy="0.0 0.0 0.0" /> | ||
<parent link="rgb_camera_link" /> | ||
<child link="rgb_camera_link_optical_frame" /> | ||
<joint name="rae_${camera_name}_sim_optical_frame_joint" type="fixed"> | ||
<origin xyz="0.0 0.0 0.0" rpy="${pi/2} ${-pi/2} 0.0" /> | ||
<parent link="rae_${camera_name}_camera_optical_frame" /> | ||
<child link="rae_${camera_name}_sim_optical_frame" /> | ||
</joint> | ||
|
||
<gazebo reference="rgb_camera_link_optical_frame"> | ||
<sensor name="rgbd_camera" type="camera"> | ||
<camera> | ||
<horizontal_fov>1.047</horizontal_fov> | ||
<image> | ||
<width>320</width> | ||
<height>240</height> | ||
</image> | ||
<clip> | ||
<near>0.1</near> | ||
<far>100</far> | ||
</clip> | ||
</camera> | ||
<ignition_frame_id>rgb_camera_link_optical_frame</ignition_frame_id> | ||
<always_on>1</always_on> | ||
<update_rate>30</update_rate> | ||
<visualize>true</visualize> | ||
<topic>/camera/image</topic> | ||
</sensor> | ||
<gazebo reference="rae_${camera_name}_sim_optical_frame"> | ||
<sensor name="rae_${camera_name}_camera" type="camera"> | ||
<always_on>true</always_on> | ||
<update_rate>30.0</update_rate> | ||
<topic>${ns}/rae/rgb/image_raw</topic> | ||
<ignition_frame_id>${ns}/rae_${camera_name}_sim_optical_frame</ignition_frame_id> | ||
<camera> | ||
<horizontal_fov>${127.0/180.0*pi}</horizontal_fov> | ||
<image> | ||
<width>720</width> | ||
<height>480</height> | ||
</image> | ||
<clip> | ||
<near>0.1</near> | ||
<far>100</far> | ||
</clip> | ||
<noise> | ||
<type>gaussian</type> | ||
<mean>0.0</mean> | ||
<stddev>0.007</stddev> | ||
</noise> | ||
</camera> | ||
</sensor> | ||
|
||
<plugin filename="ignition-gazebo-sensors-system" name="ignition::gazebo::systems::Sensors"> | ||
<engine>ogre2</engine> | ||
</plugin> | ||
</gazebo> | ||
</robot> | ||
</xacro:macro> | ||
</robot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.