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

name 'joint' is not defined (Xacro)

asked 2021-10-09 20:33:54 -0600

kidpaul gravatar image

updated 2021-10-10 12:24:04 -0600

I'm basically trying to run a robot self filter package (https://github.com/blodow/realtime_ur...) with a robot urdf.xacro file (https://github.com/ToyotaResearchInst...).

This is the launch file I changed to run the filter with the specific urdf.xacro:

<launch>
  <!-- args -->
  <arg name="robot" default="hsrb4s"/>

  <node pkg="realtime_urdf_filter" type="realtime_urdf_filter" name="$(anon realtime_urdf_filter)" output="screen"> 
   <remap from="~input_depth" to="/hsrb/head_rgbd_sensor/depth_registered/image_rect_raw"/>
   <remap from="~output_depth" to="/hsrb/head_rgbd_sensor/depth_registered_filtered/image_rect" />
   <remap from="~output_mask" to="/urdf_filtered_mask" />

   <rosparam command="load" file="$(find realtime_urdf_filter)/launch/filter_parameters.yaml"/>
  </node>

 <!-- Load an example URDF -->
 <param name="robot_description" command="$(find xacro)/xacro '$(find realtime_urdf_filter)/robots/$(arg robot).urdf.xacro'"/>
 <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
 <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

</launch>

I also changed the name of the package in the original xarco files so that it fits to the robot self filter package. And when I ran this launch file, I get the following error:

name 'joint' is not defined
when evaluating expression 'joint'
when processing file: /home/user/catkin_ws/src/realtime_urdf_filter/urdf/common.xacro
included from: /home/user/catkin_ws/src/realtime_urdf_filter/robots/hsrb4s.urdf.xacro
RLException: Invalid <param> tag: Cannot load command parameter [robot_description]: command [['/opt/ros/noetic/lib/xacro/xacro', '/home/user/catkin_ws/src/realtime_urdf_filter/robots/hsrb4s.urdf.xacro']] returned with code [2]. 
Param xml is <param name="robot_description" command="$(find xacro)/xacro '$(find realtime_urdf_filter)/robots/$(arg robot).urdf.xacro'"/>
The traceback for the exception was written to the log file

This is the file which the error message is directing:

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

  <xacro:arg name="implicit_damping" default="false" />

  <xacro:property name="pi" value="3.14159265359"/>

  <macro name="hsrb_position_joint_transmission" params="joint reduction">
     <transmission name="${joint}_transmission">
       <type>transmission_interface/SimpleTransmission</type>
       <joint name="${joint}">
         <hardwareInterface>PositionJointInterface</hardwareInterface>
       </joint>
       <actuator name="${joint}_actuator">
         <hardwareInterface>PositionJointInterface</hardwareInterface>
         <mechanicalReduction>${reduction}</mechanicalReduction>
       </actuator>
     </transmission>
  </macro>

  <macro name="hsrb_effort_joint_transmission" params="joint reduction">
     <transmission name="${joint}_transmission">
       <type>transmission_interface/SimpleTransmission</type>
       <joint name="${joint}">
         <hardwareInterface>EffortJointInterface</hardwareInterface>
       </joint>
       <actuator name="${joint}_actuator">
         <hardwareInterface>EffortJointInterface</hardwareInterface>
         <mechanicalReduction>${reduction}</mechanicalReduction>
       </actuator>
     </transmission>
  </macro>

  <macro name="hsrb_velocity_joint_transmission" params="joint reduction">
      <transmission name="${prefix}_transmission">
          <type>transmission_interface/SimpleTransmission</type>
          <joint name="${joint}">
            <hardwareInterface>VelocityJointInterface</hardwareInterface>
          </joint>
          <actuator name="${joint}_actuator">
              <hardwareInterface>VelocityJointInterface</hardwareInterface>
              <mechanicalReduction>${reduction}</mechanicalReduction>
          </actuator>
      </transmission>
  </macro>
.......etc
</robot>

Can somebody help me understand what the error is indicating and how to tweak things to resolve this issue?

I wonder whether version matters here since I'm using Noetic while the robot description was generated several years ago.

edit retag flag offensive close merge delete

Comments

Yes to your last question. I worked on this as a hobby: https://github.com/robogeekcanada/noe...

You can get some ideas how it is addressed. My suggestion is to start commenting sections of the urdf or launch file to see where is the issue.

osilva gravatar image osilva  ( 2021-10-10 13:08:00 -0600 )edit

I'm going to guess that the problem is how the macro is called i.e. the joint="xyz" parameter is missing. All xacro files I've read use a tag name of xacro:macro (not simply macro), but maybe both forms are still supported. The xacro syntax is described here.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-10-11 06:39:34 -0600 )edit

Thank you for the valuable comments! I figured out why I'm having the current problem. It's basically because I was missing some files (.urdf & .obj.urdf). Somehow those files disappear after I did catkin_make.

kidpaul gravatar image kidpaul  ( 2021-10-11 12:30:48 -0600 )edit

@kidpaul it's ok to provide your own answer to your question.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-10-11 13:57:52 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-11 15:46:51 -0600

kidpaul gravatar image

I figured out why I'm having the current problem. It's basically because I was missing some files (.urdf & .obj.urdf). Somehow those files disappear after I did catkin_make.

Add:

The hsr_description package doesn't have mesh files to construct the urdf. The mesh files are in the different ripo: https://github.com/ToyotaResearchInst...

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-10-09 20:33:54 -0600

Seen: 965 times

Last updated: Oct 11 '21