ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Adding a 3D camera to a robot arm(ur5) in URDF for Rviz and Gazebo

asked 2018-08-21 16:45:48 -0500

stevensu1838 gravatar image

Hi all,

I am following boor Mastering ROS for Robotics Programmin and I am trying to add a 3D camera above my UR5 arm in urdf. But after I modified the ur5.urdf.xacro file by adding <xacro:include filename="$(find ur_description)/urdf/sensors/xtion_pro_live.urdf.xacro"/>. Thank you so much!!!!

Please find the details of my problem with this link

edit retag flag offensive close merge delete

Comments

After you modified the file, then what? Your sentence isn't complete. Please make this question complete, too (don't just link to the question on another site)

fvd gravatar image fvd  ( 2018-08-26 22:37:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2018-08-26 23:09:56 -0500

fvd gravatar image

1) If you don't see any camera stream from gazebo, it probably does not know the camera exists.

Does your xacro file define the gazebo sensor somewhere, as described in this tutorial? The macro you are using might not contain this part.

If that is the case, one way to fix it is to include another file in your main URDF file, with content like this:

<?xml version="1.0"?>
<robot>
  <gazebo reference="your_camera_link">
    <sensor type="depth" name="your_camera">       
      <always_on>true</always_on>
      <visualize>true</visualize>             
      <camera>
          <horizontal_fov>1.047</horizontal_fov>
          <image>
              <width>640</width>
              <height>480</height>
              <format>R8G8B8</format>
          </image>
          <depth_camera>

          </depth_camera>
          <clip>
              <near>0.1</near>
              <far>100</far>
          </clip>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_openni_kinect.so">
          <baseline>0.2</baseline>
          <alwaysOn>true</alwaysOn>
              <updateRate>10.0</updateRate>
              <cameraName>your_camera</cameraName>
              <frameName>your_camera_link</frameName>                   
          <imageTopicName>rgb/image_raw</imageTopicName>
          <depthImageTopicName>depth/image_raw</depthImageTopicName>
          <pointCloudTopicName>depth/points</pointCloudTopicName>
          <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>              
          <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName>            
          <pointCloudCutoff>0.4</pointCloudCutoff>                
              <hackBaseline>0.07</hackBaseline>
              <distortionK1>0.0</distortionK1>
              <distortionK2>0.0</distortionK2>
              <distortionK3>0.0</distortionK3>
              <distortionT1>0.0</distortionT1>
              <distortionT2>0.0</distortionT2>
          <CxPrime>0.0</CxPrime>
          <Cx>0.0</Cx>
          <Cy>0.0</Cy>
          <focalLength>0.0</focalLength>
          </plugin>
    </sensor>
  </gazebo>
</robot>

2) You should not change the robot macro file directly, since that is supplied by the robot manufacturer. If you want to attach a camera to the robot, just add the link+joint outside of the macro.

edit flag offensive delete link more

Comments

1

You should not change the robot macro file directly, since that is supplied by the robot manufacturer. If you want to attach a camera to the robot, just add the link+joint outside of the macro.

I cannot upvote this enough ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-27 04:42:41 -0500 )edit

Can anyone explain this part more: "You should not change the robot macro file directly, since that is supplied by the robot manufacturer. If you want to attach a camera to the robot, just add the link+joint outside of the macro." Does this mean having separate files for the models?

Ksen gravatar image Ksen  ( 2018-10-02 01:19:10 -0500 )edit
1

Does this mean having separate files for the models?

@Ksen: yes, that does imply that you'd have separate files for all models involved, plus a top-level file that combines them all (ie: imports and then calls the xacro macros).

gvdhoorn gravatar image gvdhoorn  ( 2018-10-02 02:54:37 -0500 )edit

Thanks a lot!

Ksen gravatar image Ksen  ( 2018-10-02 02:58:15 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-08-21 16:45:48 -0500

Seen: 3,477 times

Last updated: Aug 26 '18