0
$\begingroup$

I'm trying to implement the ros2_canopen package for my Motor. So, i installed the package and set up all the configuration stuff. If i started the launch-file, I get following error message:

[device_container_node-1] [INFO] [1704728251.111151277] [device_container_node]: Added /master to executor
[device_container_node-1] terminate called after throwing an instance of 'std::system_error'
[device_container_node-1]   what():  Device: No such file or directory

I'm note sure, which Device is meant. So, I only wanted to implement the CiA Profile 301, in the first step.

options:
 dcf_path: "@BUS_CONFIG_PATH@"
 
master:
 node_id: 1
 driver: "ros2_canopen::MasterDriver"
 package: "canopen_master_driver"
 baudrate: 500
 
nodes:
 node_id: 0x02
 dcf: "eds-file"
 package: "canopen_proxy_driver"
 driver: "ros2_canopen::ProxyDriver"

That's my yaml file for the configuration. Maybe someone has an idea, what could be the reason for this error message. Thanks a lot in advance.

Launchfile:

#!/usr/bin/env python3

import os
from ament_index_python import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource

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

    ld = LaunchDescription()  # Beachten Sie hier den korrigierten Import '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("ros2_canopen_config"),
                "config",
                "motor",
                "master.dcf",
            ),
            "master_bin": os.path.join(
                get_package_share_directory("ros2_canopen_config"),
                "config",
                "motor",
                "master.bin",
            ),
            "bus_config": os.path.join(
                get_package_share_directory("ros2_canopen_config"),
                "config",
                "motor",
                "bus.yml",
            ),
            "can_interface_name": "can0",
        }.items(),

    )

    ld.add_action(device_container)

    return ld

Henne

$\endgroup$
2
  • $\begingroup$ Can you expand your question to contain links to the launch file that you are trying? $\endgroup$
    – mjcarroll
    Jan 8 at 23:23
  • $\begingroup$ Thanks for your answer. Sure, i added my launch file. $\endgroup$
    – H10
    Jan 9 at 10:03

1 Answer 1

0
$\begingroup$

I'm not very familiar with the ros2_canopen framework, but taking a look at the samples, you have the bus.yml configuration file that must be expanded and installed via a cmake macro generate_dcf.

The simple exmaple does that here: https://github.com/ros-industrial/ros2_canopen/blob/7687f3276107d81f52e1f961566942508eb07d85/canopen_tests/CMakeLists.txt#L13C1-L13C21

Once you have verified that the bus.yml is being properly expanded (and it hasn't corrected the issue) it may be worthwhile to run the node under gdb to see where the exception is coming from.

gdb --args /opt/ros/rolling/lib/canopen_core/device_container_node --ros-args \
  --param can_interface_name:=vcan0 \
  --param master_bin:="" \
  --param master_config:="" \
  --param bus_config:=""

Once the node is running under gdb, you should be able to enter at the prompt to catch where the exception is happening and then print the backtrace.

# Instruct the debugger to stop at "throw statements"
(gdb) catch throw
# Start node
(gdb) run
# .... Once exception occurs
# Generate backtrace
(gdb) backtrace
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.