Ask Your Question

Combining different urdf-files (xarco) e.g. mount camera on robot

asked 2019-03-17 08:48:07 -0500

steradiant gravatar image

updated 2019-03-17 13:11:22 -0500

jayess gravatar image

Hello, I'm working with the kuka-lwr-ros package and I want to add a camera at the top of the robot. I managed to do this when I directly edited the original kuka_lwr.urdf.xarco file like shown in this tutorial:

For better use, I want to have different files for the sensors and actuators (like camera, gripper and so on). I to copy the urdf.xarco file from an example of this package and edited this one.

<?xml version="1.0"?>
<robot xmlns:xacro="" name="single_lwr_robot">

  <!-- Include all models -->
  <xacro:include filename="$(find lwr_description)/model/kuka_lwr.urdf.xacro"/>
  <xacro:include filename="$(find kuka-lwr-gripper)/robot/my_camera.urdf.xacro"/>

  <!-- using the models -->
  <xacro:kuka_lwr name="lwr">
    <origin xyz="0 0 0" rpy="0 0 0"/>

    <origin xyz="0 0 0" rpy="0 0 0"/>


The last part (xarco:my_camera ..., and the include of my_camera.urdf.xarco) is my additions. The my_camera.urdf.xarco looks like follows:

<?xml version="1.0"?>
<robot name="my_camera" xmlns:xacro="">

  <xacro:property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->

  <!-- URDF model with default base_link (world) 
  <xacro:macro name="camera" params="name base_link:=world *origin"> -->
  <xacro:macro name="my_camera">

  <!-- height of link_7 is 0.03 -->
  <joint name="camera_joint" type="fixed">
    <!-- <axis xyz="0 0 0" /> -->
    <origin xyz="0 0 0.01" rpy="0 0 0"/>
    <parent link="kuka_lwr_7_link"/>
    <child link="camera_link"/>

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

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

      <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" />

      <!-- camera -->
      <gazebo reference="camera_link">
        <sensor type="camera" name="camera1">
          <camera name="head">
          <!-- 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]. -->
          <plugin name="camera_controller" filename="">



When I launch the launch file with the urdf.xarco from above, I geht the following error:

Unused block "origin" None None
when instantiating macro: my_camera (/home/.../rv_ws/src/kuka-lwr-gripper/robot/kuka-lwr-gripper ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-19 05:45:28 -0500

fvd gravatar image

updated 2019-03-19 05:46:07 -0500

You hand in an origin block to the macro, but you commented out the original macro definition that calls for the origin block:

<xacro:macro name="camera" params="name base_link:=world *origin">

Either you should remove the origin block from the file where you call your macro, so it looks like this:

<xacro:my_camera />

Or you remove your custom macro definition, uncomment the original definition quoted above, and call your macro with the parameters it requests:

<xacro:camera base_link="kuka_lwr_7_link">
  <origin xyz="0 0 .01" rpy="0 0 0"/>
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-03-17 08:48:07 -0500

Seen: 1,058 times

Last updated: Mar 19 '19