Gazebo file plugin - URDF connection
Hi
I am trying to make my urdf code cleaner, in this way I have seen some ROS users that use xacro and also put the plugins structure outside the URDF model. Well in this case my robot is not so big, so I will not create a xacro...however I would like to create a .gazebo file to put my plugins (because I am using several cameras and a diff-drive plugin). However I am using an example of a guy which used xacro to model his robot...So my link .gazebo file and .urdf file is not being linked, and the plugins are not appearing in my simulation....I did not found any tutorial that explains me how to connect the .gazebo file with urdf. Can someone help me? My .gazebo file is below:
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- camera -->
<gazebo reference="camera_link">
<sensor name="camera" type="depth">
<update_rate>20</update_rate>
<camera>
<horizontal_fov>1.047198</horizontal_fov>
<image>
<width>3000</width>
<height>2800</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.05</near>
<far>8</far>
</clip>
</camera>
<plugin name="camera_link_controller" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<updateRate>1.0</updateRate>
<cameraName>camera</cameraName>
<imageTopicName>/camera/rgb/image_raw</imageTopicName>
<cameraInfoTopicName>/camera/rgb/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera/depth/image_raw</depthImageTopicName>
<depthImageCameraInfoTopicName>/camera/depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>/camera/depth/points</pointCloudTopicName>
<frameName>camera_rgb_optical_frame</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0.00000001</distortionK1>
<distortionK2>0.00000001</distortionK2>
<distortionK3>0.00000001</distortionK3>
<distortionT1>0.00000001</distortionT1>
<distortionT2>0.00000001</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
<!-- camera 2-->
<gazebo reference="camera2_link">
<sensor name="camera2" type="depth">
<update_rate>20</update_rate>
<camera>
<horizontal_fov>1.447198</horizontal_fov>
<image>
<width>640</width>
<height>480</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.05</near>
<far>3</far>
</clip>
</camera>
<plugin name="camera2_link_controller" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<updateRate>1.0</updateRate>
<cameraName>camera2</cameraName>
<imageTopicName>/camera2/rgb/image_raw</imageTopicName>
<cameraInfoTopicName>/camera2/rgb/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera2/depth/image_raw</depthImageTopicName>
<depthImageCameraInfoTopicName>/camera2/depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>/camera2/depth/points</pointCloudTopicName>
<frameName>camera2_rgb_optical_frame</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0.00000001</distortionK1>
<distortionK2>0.00000001</distortionK2>
<distortionK3>0.00000001</distortionK3>
<distortionT1>0.00000001</distortionT1>
<distortionT2>0.00000001</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
<!-- camera 3 -->
<gazebo reference="camera3_link">
<sensor name="camera3" type="depth">
<update_rate>20</update_rate>
<camera>
<horizontal_fov>1.047198</horizontal_fov>
<image>
<width>640</width>
<height>480</height>
<format>R8G8B8</format>
</image>
<clip>
<near>0.05</near>
<far>3</far>
</clip>
</camera>
<plugin name="camera3_link_controller" filename="libgazebo_ros_openni_kinect.so">
<baseline>0.2</baseline>
<alwaysOn>true</alwaysOn>
<updateRate>1.0</updateRate>
<cameraName>camera3</cameraName>
<imageTopicName>/camera3/rgb/image_raw</imageTopicName>
<cameraInfoTopicName>/camera3/rgb/camera_info</cameraInfoTopicName>
<depthImageTopicName>/camera3/depth/image_raw</depthImageTopicName>
<depthImageCameraInfoTopicName>/camera3/depth/camera_info</depthImageCameraInfoTopicName>
<pointCloudTopicName>/camera3/depth/points</pointCloudTopicName>
<frameName>camera3_rgb_optical_frame</frameName>
<pointCloudCutoff>0.5</pointCloudCutoff>
<pointCloudCutoffMax>3.0</pointCloudCutoffMax>
<distortionK1>0.00000001</distortionK1>
<distortionK2>0.00000001</distortionK2>
<distortionK3>0.00000001</distortionK3>
<distortionT1>0.00000001</distortionT1>
<distortionT2>0.00000001</distortionT2>
<CxPrime>0</CxPrime>
<Cx>0</Cx>
<Cy>0</Cy>
<focalLength>0</focalLength>
<hackBaseline>0</hackBaseline>
</plugin>
</sensor>
</gazebo>
So what should I add, remove or change?
Thanks in advance!
Asked by Vini71 on 2020-02-01 02:01:04 UTC
Answers
You need to spawn the URDF file and after that your plugins/Robot models will be loaded into Gazebo simulator.
for instance in the launch file a robot attached with sensors can be initialized with ;
<group if="$(arg load_robot_model)">
<param name="robot_description"
command="$(find xacro)/xacro --inorder $(find your_package)/urdf/robot.xacro" />
</group>
<!-- push robot_description to factory and spawn robot in gazebo -->
<node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model"
output="screen" respawn="false"
args="-urdf
-param robot_description
-model your_robot
-x 0
-y 0
-z 0"
/>
Asked by Fetullah Atas on 2020-02-09 23:05:21 UTC
Comments