Closed M1chaelM closed 3 years ago
Continuing to document this issue:
Running the xacro command directly fails in the docker image whenever the argument vrx_sensors_enabled:=true
is included. This argument indirectly sets camera_enabled
to true, which triggers the error. A simpler test is:
/opt/ros/noetic/lib/xacro/xacro /home/username/vrx_ws/src/vrx/wamv_gazebo/urdf/wamv_gazebo.urdf.xacro camera_enabled:=true
This works fine on the host, and fails in the Docker container with a similar error:
unknown macro name: xacro:wamv_camera
when processing file: /home/username/vrx_ws/src/vrx/wamv_gazebo/urdf/wamv_gazebo.urdf.xacro
It seems that this error occurs for all the files in the ~/vrx_ws/src/vrx/wamv_gazebo/urdf/sensors/
directory.
sensors
directory are included by macros.xacro
.macros.xacro
is included by wamv_gazebo.xacro
at line 6 when the wamv_gazebo
macro is invoked.wamv_gazebo.xacro
is included in wamv_gazebo.urdf.xacro
at line 36.wamv_gazebo
macro is called at different points in the file depending on the thruster configuration.Directly including the macros from the sensors
directory in wamv_gazebo.urdf.xacro
resolves the issue. So does including the macros.xacro
file explicitly by adding the line
<xacro:include filename="$(find wamv_gazebo)/urdf/macros.xacro"/>
The problem seems to be that when the include
directive is given with the wamv_gazebo
macro, xacro
can't find the macros defined in the included files.
Changing the default value of vrx_sensors_enabled
to true
in wamv_gazebo.urdf.xacro
, i.e.
<xacro:arg name="vrx_sensors_enabled" default="true" />
causes the build to fail in the Docker image and succeed on the host.
The contents of wamv_gazebo.xacro
are:
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<!-- Macro to create a WAM-V with dyanmics plugins and a customizeable thruster layout -->
<xacro:macro name="wamv_gazebo" params="thruster_layout">
<!-- Include macros for dynamics plugins -->
<xacro:include filename="$(find wamv_gazebo)/urdf/macros.xacro" />
<!-- Defines the base vehicle -->
<xacro:include filename="$(find wamv_description)/urdf/wamv_base.urdf.xacro" />
<!-- Thruster Layout -->
<xacro:include filename="${thruster_layout}"/>
<!-- Attach hydrodynamics plugin -->
<xacro:usv_dynamics_gazebo name="wamv_dynamics_plugin"/>
</xacro:macro>
</robot>
Changing to the following resolves the problem:
<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
<!-- Include macros for dynamics plugins -->
<xacro:include filename="$(find wamv_gazebo)/urdf/macros.xacro" />
<!-- Macro to create a WAM-V with dyanmics plugins and a customizeable thruster layout -->
<xacro:macro name="wamv_gazebo" params="thruster_layout">
<!-- Defines the base vehicle -->
<xacro:include filename="$(find wamv_description)/urdf/wamv_base.urdf.xacro" />
<!-- Thruster Layout -->
<xacro:include filename="${thruster_layout}"/>
<!-- Attach hydrodynamics plugin -->
<xacro:usv_dynamics_gazebo name="wamv_dynamics_plugin"/>
</xacro:macro>
</robot>
I'm not sure yet why this is the case and why the original works on one system but not the other.
It appears that the ROS GPG Key Expiration Incident was causing package updates on the host to fail, so these were not as up to date as the packages installed on the Docker image. I have now updated them and I'm seeing the same error on both the Docker image and the host. Something in this update appears to have changed the behavior of how include files work. A full list of the packages updated (including a few not related to the ROS problem) is below, but the update to ros-noetic-xacro
seems potentially relevant. The changelog for this package has not been updated since October 2020, but I think this may be related to PR 272, which addresses this issue.
macros.xacro
as shown above fixes this problem.List of upgraded packages (just in case someone finds a mistake in my reasoning above):
apt
apt-transport-https
apt-utils
bluez
bluez-cups
bluez-obexd
libapt-pkg6.0
libbluetooth3
libgupnp-1.2-0
linux-base
python3-rosdep
python3-rosdep-modules
ros-noetic-controller-interface
ros-noetic-controller-manager
ros-noetic-controller-manager-msgs
ros-noetic-desktop
ros-noetic-desktop-full
ros-noetic-diff-drive-controller
ros-noetic-effort-controllers
ros-noetic-forward-command-controller
ros-noetic-gazebo-ros-control
ros-noetic-geodesy
ros-noetic-geographic-info
ros-noetic-geographic-msgs
ros-noetic-hardware-interface
ros-noetic-hector-gazebo-plugins
ros-noetic-joint-limits-interface
ros-noetic-joint-state-controller
ros-noetic-joy
ros-noetic-librviz-tutorial
ros-noetic-position-controllers
ros-noetic-robot
ros-noetic-robot-localization
ros-noetic-rqt-robot-plugins
ros-noetic-rqt-rviz
ros-noetic-rviz
ros-noetic-rviz-plugin-tutorials
ros-noetic-rviz-python-tutorial
ros-noetic-simulators
ros-noetic-teleop-twist-joy
ros-noetic-transmission-interface
ros-noetic-urdf-sim-tutorial
ros-noetic-urdf-tutorial
ros-noetic-velodyne-description
ros-noetic-velodyne-simulator
ros-noetic-visualization-tutorials
ros-noetic-viz
ros-noetic-xacro
Resolved with PR #255.
Attempting to launch VRX with:
fails with the following error:
This same command succeeds in launching gazebo on the host using the host-based install instructions, even without rebuilding vrx. Maybe there is a missing dependency in the container?