Robotics StackExchange | Archived questions

Camera and Control of UR5

Hi all. I am using Ros1 Kinetic on Ubuntu 16.04LTS, gazebo7 and rviz 1.12.17, I am simulating Universal robot UR5 but there are problems one of them is the robot is shakey and 2nd is I cant controll the robot I want to simulate and add a camera to it.

the following is my launch file:

<?xml version="1.0"?>
<launch>
  <arg name="gui" default="True" />

  <param name="robot_description" command="$(find xacro)/xacro --inorder $(find ur5_description)/urdf/ur5_robotiq85_gripper.urdf.xacro" />

  <!-- Adding camera in rviz -->
  <group ns="camera1">
    <node pkg="tf" type="static_transform_publisher" name="camera_broadcaster"
      args="-15 0 15 1.57 3.14 1.1 map camera1 10" />
    <node name="camera_info" pkg="rostopic" type="rostopic"
      args="pub camera_info sensor_msgs/CameraInfo
     '{header: {seq: 0, stamp: {secs: 0, nsecs: 0}, frame_id: 'camera1'},
      height: 480, width: 640, distortion_model: 'plumb_bob',
      D: [0],
      K: [500.0, 0.0, 320, 0.0, 500.0, 240.0, 0.0, 0.0, 1.0],
      R: [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
      P: [500.0, 0.0, 320, 0.0, 0.0, 500, 240, 0.0, 0.0, 0.0, 1.0, 0.0],
      binning_x: 0, binning_y: 0,
      roi: {x_offset: 0, y_offset: 0, height: 480, width: 640, do_rectify: false}}' -r 2"
      output="screen"/>
  </group>

<!--Gazebo empty world launch file-->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="debug" value="false" />
        <arg name="gui" value="true" />
        <arg name="paused" value="false"/>
        <arg name="use_sim_time" value="false"/>
        <arg name="headless" value="false"/>
        <arg name="verbose" value="true"/>
  </include>

  <!-- Start your own node for the joint_state_publisher.py in scripts folder -->

  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>

  <node name="spawn_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model UR5 -verbose" output="screen"/>

  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find ur5_description)/config/ur5.rviz" required="true" />


</launch>

and this is my ur5robotiq85gripper.urdf.xacro file

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

  <xacro:include filename="$(find ur5_description)/urdf/ur5_joint_limited_robot.urdf.xacro" />
  <xacro:include filename="$(find robotiq_description)/urdf/robotiq_85_gripper.urdf.xacro" />
  <xacro:property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->
  <xacro:property name="height3" value="0.05" /> <!-- height3 - axel_offset*2 -->
  <xacro:property name="axel_offset" value="0.05" /> <!-- height3 - axel_offset*2 -->


  <!-- Robotiq Coupler -->
  <!--  + Height added by the coupler: 8mm -->
  <!--  + Reference frame: at the middle (4mm) -->
  <link name="robotiq_coupler">
    <visual>
      <geometry>
        <mesh filename="package://robotiq_description/meshes/robotiq_85_coupler.stl" />
      </geometry>
      <material name="flat_black"/>
    </visual>
    <collision>
      <geometry>
        <mesh filename="package://robotiq_description/meshes/robotiq_85_coupler.stl" />
      </geometry>
    </collision>
    <inertial>
      <origin xyz="2.073e-05   1.45286e-03  -1.1049e-03" rpy="0 0 0" />
      <mass value="0.168" />
      <inertia ixx="6.69695624e-05" ixy="5.21511788e-09" ixz="-2.74383009e-08" 
               iyy="7.85088161e-05" iyz="5.41105193e-07" izz="1.41819717e-04"/>
    </inertial>
  </link>

  <joint name="robotiq_coupler_joint" type="fixed">
    <origin xyz="0 0 0.004" rpy="0 0 ${-pi/2.0}" />
    <parent link="tool0"/>
    <child link="robotiq_coupler"/>
  </joint>
  <gazebo reference="robotiq_coupler">
    <mu1>0.9</mu1>
    <mu2>0.9</mu2>
    <material>Gazebo/FlatBlack</material>
  </gazebo>

  <!-- Equivalent to the OpenRAVE manipulator denso_robotiq_85_gripper -->
  <!-- <link name="denso_robotiq_85_gripper" /> -->
  <!-- <joint name="manipulator_dummy_joint" type="fixed"> -->
  <!--   <origin xyz="0 0 0.1441" rpy="0 0 0" /> -->
  <!--   <parent link="robotiq_coupler"/> -->
  <!--   <child link="denso_robotiq_85_gripper"/> -->
  <!-- </joint> -->

  <!-- Attach the robotiq 85 gripper -->
  <xacro:robotiq_85_gripper prefix="" parent="robotiq_coupler" >
    <origin xyz="0 0 0.004" rpy="0 ${-pi/2} ${pi}"/>
  </xacro:robotiq_85_gripper> 

  <!-- Gazebo FT sensor plugin -->
  <gazebo reference="wrist_3_joint">
    <provideFeedback>true</provideFeedback>
  </gazebo>
  <gazebo>
    <plugin name="ft_sensor_plugin" filename="libgazebo_ros_ft_sensor.so">
      <updateRate>250.0</updateRate>
      <topicName>ft_sensor/raw</topicName>
      <gaussianNoise>0.0</gaussianNoise>
      <jointName>wrist_3_joint</jointName>
    </plugin>
  </gazebo>

  <!-- Gazebo grasping plugin -->
  <gazebo>
    <gripper name="gazebo_gripper">
      <grasp_check>
        <attach_steps>2</attach_steps>    <!-- default: 20 -->
        <detach_steps>2</detach_steps>    <!-- default: 40 -->
        <min_contact_count>3</min_contact_count>
      </grasp_check>
      <gripper_link>robotiq_85_left_finger_tip_link</gripper_link>
      <gripper_link>robotiq_85_right_finger_tip_link</gripper_link>
      <palm_link>robotiq_85_base_link</palm_link>
    </gripper>
  </gazebo>

  <!-- Gazebo Camera Plugin -->
  <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="link3"/>-->
    <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>

</robot>

please advise I cant see the camera out put in rviz nor can I control the robot.

Asked by umar_anjum on 2022-03-14 05:01:48 UTC

Comments

When looking up a topic, e.g. in the rostopic list, is the topic of camera images flowing?

Asked by miura on 2023-02-26 00:23:18 UTC

Answers

Does your model in the ur5_description package includes the gazebo plugin inside? The Gazebo plugin would bridge the simulation to ROS, and without it, you would not be able to control the UR5. You can take a look at the ros_control tutorial here under the Gazebo (Classic) Documentation.

(Not sure if you are using the universal_robot package, there is a directory (ur_gazebo), which probably launches the UR5 arm in gazebo. You can take a look at how it's done.)

As for adding a camera in Gazebo, you would need to create another model of the camera & attach it to the UR5, there's a similar tutorial here.

Hope this helps.

Asked by photon on 2023-02-26 05:01:45 UTC

Comments