Adding Intel Camera To Robot End-Effector
Hello All,
I am using ROS Melodic and Gazebo 9.13.
I am trying to visualise a 6 DOF robot (like the UR5) with the Intel Depthsense camera attached to the end-effector.
My problem: I can't seem to attach the camera to the wrist3link of the robot
Can you point out what is wrong with the way I am adding the camera to the robot's link?
What I tried:
the launch file:
<node name="spawn_ur5" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot -z 0.1" respawn="false" output="screen" />
<!-- Add the Intel realsense to the UR5 End Effector -->
<param name="realsense2_camera" command="$(find xacro)/xacro '$(find camera)/urdf/ur5realsense.xacro' use_nominal_extrinsics:=true" />
<!-- push camera to gazebo -->
<node name="spawn_camera" pkg="gazebo_ros" type="spawn_model" args="-urdf -param realsense2_camera -model camera -x 1 -y 1 -z 0" respawn="false" output="screen" />
the wroking(?) xacro:
<robot name="realsense2_camera" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro" />
<link name="base_link" />
<sensor_d435 parent="base_link">
<origin xyz="0 0 0" rpy="0 0 0"/>
</sensor_d435>
</robot>
the xacro that fails:
<?xml version="1.0"?>
<robot name="realsense2_camera" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro" />
<link name="camera_link" />
<sensor_d435 parent="camera_link">
<origin xyz="0 0 0" rpy="0 0 0"/>
</sensor_d435>
<joint name="camerajoint" type="fixed">
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<parent link="wrist_3_link"/>
<child link="camera_link"/>
<axis xyz="0.0 0.0 0.0"/>
<limit lower="0.0" upper="0.0" effort="0.0" velocity="0.0"/>
</joint>
</robot>
links
Thank you.
Iyantiram
Asked by Iyantiram on 2020-04-30 17:37:22 UTC
Answers
You are only creating the camera links with the sensor_d435 macro, not the sensor itself. To add a camera sensor, you need this.
Here is how the urdf would look like:
<robot name="realsense2_camera" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro" />
<sensor_d435 parent="wrist_3_link">
<origin xyz="0 0 0" rpy="0 0 0"/>
</sensor_d435>
<gazebo reference="camera_link">
<sensor name="camera" type="camera">
...
</sensor>
</gazebo>
</robot>
Asked by nlamprian on 2020-05-01 00:24:55 UTC
Comments
nlamprian,
Thank you for the comment.
I will follow up on what you said.
However, I am confused why the xacro I labeled working actually renders the camera without the additional "gazebo" tags.
Asked by Iyantiram on 2020-05-01 11:07:22 UTC
You urdf is broken. There are two camera_link links, one created by you and one by the macro. Secondly, in the working urdf, you see the camera, but that doesn't mean there is an actual sensor attached to it. Lastly, the camera urdf will have to be part of the arm urdf, and in the launch file, you will only spawn the arm model. Otherwise, you have two independent models, i.e. the camera is not attached to the arm.
Asked by nlamprian on 2020-05-01 12:24:36 UTC
Thanks to nlamprian, I was able to fix these errors.
Just in case someone else is searching for how to attach just the camera (actual sensor is addressed in the link).
Here is the xacro (say test.xacro )that works for attaching the Intel D435 to the tool of UR5:
<robot name="robot_description"
xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find ur5_description)/urdf/ur5_joint_limited_robot.urdf.xacro" />
<!-- CAMERA -->
<xacro:include filename="$(find realsense2_description)/urdf/_d435.urdf.xacro"/>
<xacro:arg name="use_nominal_extrinsics" default="True" />
<sensor_d435 parent="tool0">
<origin xyz="0 0 0" rpy="0 0 0"/>
</sensor_d435>
</robot>
Also what helped me was these steps:
xacro test.xacro > temp.urdf
check_urdf temp.urdf
That showed that I had inadvertently picked the wrong name for a link earlier.
Hope my mistakes help someone :)
Iyantiram
Asked by Iyantiram on 2020-05-01 13:12:17 UTC
Comments
Do you have the full working example anywhere by any chance? If you make a public repo you will get much love from all over :)
Asked by silverhand on 2021-01-21 22:56:53 UTC
I am also wondering if you can provide any extra information on this, as I am trying to do something very similar with a Kuka Youbot?
Asked by sevenPillars on 2021-05-12 10:08:06 UTC
Comments