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

[Docker] missing packages when using `ros2 launch`

asked 2021-07-19 17:14:40 -0500

fampinheiro gravatar image

I'm expanding https://github.com/Livox-SDK/livox_ro... and adding a Dockerfile do colcon build and use ros2 launch. I'm trying to cross-compile livox using the instruction from https://github.com/Livox-SDK/Livox-SD....

The Dockerfile content is as follows:

FROM ros:foxy-ros-base

RUN apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ros-foxy-pcl-conversions

WORKDIR /ws_livox

COPY livox_ros2_driver src/ 
COPY livox_lidar_config.json src/livox_ros2_driver/config/livox_lidar_config.json

SHELL ["/bin/bash", "-c"]
RUN . /ros_entrypoint.sh && \
  colcon build --parallel-workers 1 --cmake-args -DCMAKE_CXX_FLAGS="--param ggc-min-expand=20"

CMD . /ros_entrypoint.sh && . install/setup.bash && \
  ros2 launch src/livox_ros2_driver/launch/livox_lidar_launch.py

Building and running this throws the following error:

Task exception was never retrieved
future: <Task finished name='Task-2' coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:274> exception=PackageNotFoundError("package 'livox_ros2_driver' not found, searching: ['/ws_livox/install/livox_sdk_vendor', '/opt/ros/foxy']")>
Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/packages.py", line 49, in get_package_prefix
    content, package_prefix = get_resource('packages', package_name)
  File "/opt/ros/foxy/lib/python3.8/site-packages/ament_index_python/resources.py", line 48, in get_resource
    raise LookupError(
LookupError: Could not find the resource 'livox_ros2_driver' of type 'packages'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 276, in _process_one_event
    await self.__process_event(next_event)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py", line 296, in __process_event
    visit_all_entities_and_collect_futures(entity, self.__context))
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
    futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
  [Previous line repeated 1 more time]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
    sub_entities = entity.visit(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py", line 108, in visit
    return self.execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py", line 426, in execute
    ret = super().execute(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 823, in execute
    self.__expand_substitutions(context)
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in __expand_substitutions
    cmd = [perform_substitutions(context, x) for x in self.__cmd]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py", line 668, in <listcomp>
    cmd = [perform_substitutions(context, x) for x in self.__cmd]
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in perform_substitutions
    return ''.join([context.perform_substitution(sub) for sub in subs])
  File "/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py", line 26, in <listcomp>
    return ''.join([context.perform_substitution(sub) for sub in subs])
  File ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-24 00:40:43 -0500

ruffsl gravatar image

A few things:

  • No need to source the entrypoint in the CMD directive
    • You are building from an official ROS docker image
    • thus the existing entrypoint will already source ros setup before executing the CMD
    • you should instead modify the entrypoint to source your workspace's setup script
    • e.g. https://github.com/ros-planning/navig...
  • I wouldn't recomend sourceing the entrypoint from the RUN directive
  • no need to change the default shell from sh/dash to bash
    • when sourcing setup scripts using the sh dot . syntax as demoed in examples above
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-07-19 16:54:11 -0500

Seen: 1,091 times

Last updated: Jul 24 '21