ros-industrial / ros2_canopen

CANopen driver framework for ROS2

Home Page:https://ros-industrial.github.io/ros2_canopen/manual/rolling/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build of configuration package fails

hildeesch opened this issue · comments

Describe the question
I am trying to build a configuration package according to the instructions. However, I keep getting the same build error, which I do not understand. Does anyone know what might cause this?
Some extra content: in the end I intend to use the package to communicate with a Nanotec controller using a USB-Can converter.

Logs
bus.yml file:

options:
  dcf_path: "ros2_canopen/install/config_package/share/config_package/config/gpl_bus"

master:
  node_id: 1
  package: "canopen_master_driver"
  driver: "ros2_canopen::MasterDriver"

defaults:
  dcf: "CL4-E-1-12.eds"

Launch file:

def generate_launch_description():
      """Generate launch description with multiple components."""
      path_file = os.path.dirname(__file__)

      ld = launch.LaunchDescription()


      device_container = IncludeLaunchDescription(
          PythonLaunchDescriptionSource(
              [
                  os.path.join(get_package_share_directory("canopen_core"), "launch"),
                  "/canopen.launch.py",
              ]
          ),
          launch_arguments={
              "master_config": os.path.join(
                  get_package_share_directory("config_package"),
                  "config",
                  "gpl_bus",
                  "master.dcf",
              ),
              "master_bin": os.path.join(
                  get_package_share_directory("config_package"),
                  "config",
                  "gpl_bus",
                  "master.bin",
              ),
              "bus_config": os.path.join(
                  get_package_share_directory("config_package"),
                  "config",
                  "gpl_bus",
                  "bus.yml",
              ),
              "can_interface_name": "can0",
          }.items(),

      )

      ld.add_action(device_container)

      return ld

CMakeFile:

cmake_minimum_required(VERSION 3.8)
project(config_package)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(canopen_core REQUIRED)
find_package(canopen_interfaces REQUIRED)
find_package(canopen_base_driver REQUIRED)
find_package(canopen_proxy_driver REQUIRED)
find_package(lely_core_libraries REQUIRED)


cogen_dcf(gpl_bus)

install(DIRECTORY
  launch/
  DESTINATION share/${PROJECT_NAME}/launch/
)

install(DIRECTORY
  launch_tests/
  DESTINATION share/${PROJECT_NAME}/launch_tests/
)


if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

package.xml file:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>config_package</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="h.esch@starnustech.com">starnus</maintainer>
  <license>TODO: License declaration</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>canopen</depend>
  <depend>lely_core_libraries</depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Build failed report:

Starting >>> config_package
--- stderr: config_package
sed: can't read /home/starnus/starnus/starnus_robot_sim/starnus_robot/src/ros2_canopen/config_package/build/config_package/config/gpl_bus/preprocessed_bus.yml: No such file or directory
gmake[2]: *** [CMakeFiles/gpl_bus.dir/build.make:74: gpl_bus] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/gpl_bus.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< config_package [1.73s, exited with code 2]

Summary: 0 packages finished [1.96s]
  1 package failed: config_package
  1 package had stderr output: config_package

Setup:

  • Device: HP Victus
  • ROS-Distro: Humble

Help is much appreciated!

In the end, I was able to solve it by using another launch file and rebuilding from scratch. I think it may have been a sourcing issue.