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

How to make a single URDF file for UR5

asked 2021-10-10 16:23:05 -0500

umar_anjum gravatar image

updated 2021-10-11 03:36:58 -0500

Hope all of you out there are fine.

I have been working on ros for the simulation of UR5 to pick and place objects using vision. I asked before what should I have to do someone told me to have a ur5 urdf with camera as first step(you can see my previous question for reference). I have worked on the urdf but I could not make a single file for it as the UR5 have multiple urdf/dae files and I dont know where to put the camera plugin to. Questions I like to be answered.

  1. Can I make a single URDF/dae file for UR5? if yes how?
  2. How can I add a camera to my urdf in case of multi or single urdf file?
  3. How can I attach a launch file to the new urdf file? If I make one. Also I want to attach a python file with camera to detect objects.

Any help on any of the above questions are appreciated.Thanks

I am using Ubuntu 20.04.2 LTS and ROS noetic version. I have rospy(python for ros), gazebo and Rviz installed also.

edit retag flag offensive close merge delete

Comments

Ubuntu 16.04 and ROS noetic do not quite add up, as noetic is targeted for Ubuntu 20.04

fexner gravatar image fexner  ( 2021-10-11 01:50:37 -0500 )edit

My mistake I have 20.04 LTS not 16.04.2

umar_anjum gravatar image umar_anjum  ( 2021-10-11 03:37:48 -0500 )edit

That's what I was assuming which is what I based my answer on.

fexner gravatar image fexner  ( 2021-10-11 12:35:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-11 02:09:54 -0500

fexner gravatar image

Have a look at the convenience macro file in the melodic-devel-staging branch.

This you can expand to add your own camera as shown in the gazebo tutorials

You will end up with something like this:

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro" name="ur5_robot">

  <!-- Add plain robot -->
  <xacro:include filename="$(find ur_description)/urdf/inc/ur5_macro.xacro"/>
  <xacro:ur5_robot prefix="" />

  <joint name="camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="${camera_link} 0 ${height3 - axel_offset*2}" rpy="0 0 0"/>
    <parent link="tool0"/>
    <child link="camera_link"/>
  </joint>

  <!-- Camera -->
  <link name="camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>
  <!-- camera -->
  <gazebo reference="camera_link">
    <sensor type="camera" name="camera1">
      <update_rate>30.0</update_rate>
      <camera name="head">
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1]. -->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>rrbot/camera1</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

</robot>

With this you can create your custom launch file to launch your setup in gazebo similar to this and add loading the description similar to here (with skipping all the parameters as you used the specific ur5 macro already.

Note: I didn't test the above and you will have to do some figuring out in the launch files to make this work, but I think this should give you the necessary hints.

edit flag offensive delete link more

Comments

I tried this code and made a launch file but it didn't work, I tried looking how to make launch file, followed instructions still error. ros could recognize it as a launch file and not the package it was in. I made a new catkin package put this file in as launch file ran catkin_make still couldn't recognize as launch file

umar_anjum gravatar image umar_anjum  ( 2021-10-17 04:47:10 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-10-10 16:23:05 -0500

Seen: 538 times

Last updated: Oct 17 '21