|
| 1 | +Mesh Filter with UR5 and Kinect |
| 2 | +=============================== |
| 3 | + |
| 4 | +MoveIt's mesh filter functionality removes your robot's geometry from a point cloud! If your robot's arm is in your depth sensor's view, the points associated with the arm are subtracted from the point cloud. |
| 5 | + |
| 6 | +This is accomplished by giving the original point cloud, the robot's transforms (``\tf``) and the robot's URDF as inputs. |
| 7 | +The filter then publishes a modified point cloud which does not contain the points that overlaps with the current robot state. |
| 8 | + |
| 9 | +.. image:: MeshFilter.gif |
| 10 | + |
| 11 | +Getting Started |
| 12 | +--------------- |
| 13 | + |
| 14 | +* Follow the instructions for :moveit_website:`installing MoveIt<install>` |
| 15 | + first if you have not already done that. |
| 16 | + |
| 17 | +* Clone the `Universal Robot package <https://github.com/ros-industrial/universal_robot>`_ to your workspace for Melodic. Remember to rebuild your workspace after cloning. |
| 18 | + |
| 19 | +* Install `Gazebo <http://gazebosim.org/tutorials?tut=install_ubuntu&cat=install>`_. You need to install ros-${ROS_DISTRO}-gazebo-plugins too. |
| 20 | + |
| 21 | + |
| 22 | +Running the Demo |
| 23 | +----------------- |
| 24 | + |
| 25 | +Roslaunch the launch file to run the code directly from moveit_tutorials: :: |
| 26 | + |
| 27 | + roslaunch moveit_tutorials mesh_filter.launch |
| 28 | + |
| 29 | +The above command opens a UR5 arm with Kinect sensor on Gazebo and Rviz |
| 30 | + |
| 31 | +Topic ``/filtered/depth`` produces the modified point cloud with points subtracted that overlaps with the robot state. |
| 32 | + |
| 33 | +.. image:: Filtered_Depth.png |
| 34 | + |
| 35 | +Topic ``/model/depth`` gives the points that overlap with the current robot state |
| 36 | + |
| 37 | +.. image:: Model_Depth.png |
| 38 | + |
| 39 | +Check out the mesh filter code `here <https://github.com/ros-planning/moveit/blob/master/moveit_ros/perception/mesh_filter/src/depth_self_filter_nodelet.cpp>`_ |
| 40 | + |
| 41 | + |
| 42 | +How to add sensor to arm in simulation |
| 43 | +-------------------------------------- |
| 44 | + |
| 45 | +Include sensor plugin in a ``.gazebo`` file. In this tutorial, a kinect sensor plugin is added to ``kinect_camera.gazebo`` :: |
| 46 | + |
| 47 | + <gazebo reference="camera_depth_frame"> |
| 48 | + <sensor name="kinect_camera" type="depth"> |
| 49 | + <update_rate>20</update_rate> |
| 50 | + <camera> |
| 51 | + <horizontal_fov>1.047198</horizontal_fov> |
| 52 | + <image> |
| 53 | + <width>640</width> |
| 54 | + <height>480</height> |
| 55 | + <format>B8G8R8</format> |
| 56 | + </image> |
| 57 | + <clip> |
| 58 | + <near>0.05</near> |
| 59 | + <far>3</far> |
| 60 | + </clip> |
| 61 | + </camera> |
| 62 | + <plugin name="kinect_controller" filename="libgazebo_ros_openni_kinect.so"> |
| 63 | + <baseline>0.1</baseline> |
| 64 | + <alwaysOn>true</alwaysOn> |
| 65 | + <updateRate>10</updateRate> |
| 66 | + <cameraName>camera_ir</cameraName> |
| 67 | + <imageTopicName>/camera/color/image_raw</imageTopicName> |
| 68 | + <cameraInfoTopicName>/camera/color/camera_info</cameraInfoTopicName> |
| 69 | + <depthImageTopicName>/camera/depth/image_raw</depthImageTopicName> |
| 70 | + <depthImageCameraInfoTopicName>/camera/depth/camera_info</depthImageCameraInfoTopicName> |
| 71 | + <pointCloudTopicName>/camera/depth/points</pointCloudTopicName> |
| 72 | + <frameName>camera_depth_optical_frame</frameName> |
| 73 | + <distortion_k1>0.0</distortion_k1> |
| 74 | + <distortion_k2>0.0</distortion_k2> |
| 75 | + <distortion_k3>0.0</distortion_k3> |
| 76 | + <distortion_t1>0.0</distortion_t1> |
| 77 | + <distortion_t2>0.0</distortion_t2> |
| 78 | + <pointCloudCutoff>0.16</pointCloudCutoff> |
| 79 | + <pointCloudCutoffMax>10.0</pointCloudCutoffMax> |
| 80 | + </plugin> |
| 81 | + </sensor> |
| 82 | + </gazebo> |
| 83 | + |
| 84 | + |
| 85 | +Attach sensor to `base urdf <https://github.com/ros-industrial/universal_robot/blob/melodic-devel/ur_description/urdf/ur5.urdf.xacro>`_ of UR5 using links and joints as shown in ``ur5_sensor.urdf.xacro`` :: |
| 86 | + |
| 87 | + <!-- ur5 --> |
| 88 | + <xacro:include filename="$(find ur_description)/urdf/ur5.urdf.xacro" /> |
| 89 | + |
| 90 | + <!-- Attach UR5 to table --> |
| 91 | + <joint name="table_joint" type="fixed"> |
| 92 | + <parent link="table"/> |
| 93 | + <child link="base_link"/> |
| 94 | + </joint> |
| 95 | + |
| 96 | + <!-- Attach Kinect to table --> |
| 97 | + <joint type="fixed" name="table_camera_joint"> |
| 98 | + <origin xyz="0.15 -1 0.1" rpy="0 0 1.57"/> |
| 99 | + <child link="camera_rgb_frame"/> |
| 100 | + <parent link="table"/> |
| 101 | + <axis xyz="0 0 0" rpy="0 0 0"/> |
| 102 | + <limit effort="10000" velocity="1000"/> |
| 103 | + <dynamics damping="1.0" friction="1.0"/> |
| 104 | + </joint> |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | +References |
| 110 | +---------- |
| 111 | +`Understanding ROS Nodelets <https://medium.com/@waleedmansoor/understanding-ros-nodelets-c43a11c8169e>`_ |
0 commit comments