ros-industrial / ros2_canopen

CANopen driver framework for ROS2
https://ros-industrial.github.io/ros2_canopen/manual/rolling/
140 stars 60 forks source link

Getting Could not find requested resource in ament index, when launching the package #108

Closed jonaskonig closed 1 year ago

jonaskonig commented 1 year ago

Describe the bug After launching the package with the ros2 launch command. It fails and dies with the message: [device_container_node-1] what(): Could not find requested resource in ament index I don't know what resource it couldn't find, so I'm kind of lost. Maybe someone has a hint here.

Logs

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [launch.user]: /home/noah/ros2_ws/install/roboter_drive_controll/share/roboter_drive_controll/config/main_bus/bus.yml
[INFO] [launch.user]: /home/noah/ros2_ws/install/roboter_drive_controll/share/roboter_drive_controll/config/main_bus/master.dcf
[INFO] [launch.user]: /home/noah/ros2_ws/install/roboter_drive_controll/share/roboter_drive_controll/config/main_bus/master.bin
[INFO] [launch.user]: can0
[INFO] [device_container_node-1]: process started with pid [15974]
[device_container_node-1] [INFO] [1683721653.440090002] [device_container_node]: Starting Device Container with:
[device_container_node-1] [INFO] [1683721653.440153933] [device_container_node]:     master_config /home/noah/ros2_ws/install/roboter_drive_controll/share/roboter_drive_controll/config/main_bus/master.dcf
[device_container_node-1] [INFO] [1683721653.440160098] [device_container_node]:     bus_config /home/noah/ros2_ws/install/roboter_drive_controll/share/roboter_drive_controll/config/main_bus/bus.yml
[device_container_node-1] [INFO] [1683721653.440164503] [device_container_node]:     can_interface_name can0
[device_container_node-1] [INFO] [1683721653.440822825] [device_container_node]: Loading Master Configuration.
[device_container_node-1] terminate called after throwing an instance of 'rclcpp_components::ComponentManagerException'
[device_container_node-1]   what():  Could not find requested resource in ament index
[ERROR] [device_container_node-1]: process has died [pid 15974, exit code -6, cmd '/home/noah/ros2_ws/install/canopen_core/lib/canopen_core/device_container_node --ros-args -r __node:=device_container_node -r __ns:=/ --params-file /tmp/launch_params_r4u96630 --params-file /tmp/launch_params_dsyeh5b7 --params-file /tmp/launch_params_qb9wwsy9 --params-file /tmp/launch_params_lf8gt0ml'].

Setup:

hellantos commented 1 year ago

@jonaskonig this occurs usually if you did not source the workspace.

jonaskonig commented 1 year ago

@ipa-cmh ok, that is a hint. I compiled my package with colcon build, and after it finished, I linked the source via install/setup.sh. Is that what you mean? If so, what did I do wrong?

hellantos commented 1 year ago

@jonaskonig the error message you get means, that the component manager could not find the component (driver or master_driver) specified in the bus.yml. The device_container uses ROS2's ament index to find the components.

Reason 1: This can be the case if the workspace was not correctly sourced and device_container consequently does not know about the components in your workspace. Reason 2: Could be that in your bus.yml driver and package name for one device do not match with a ros component existing on your system.

If you can launch canopen_tests proxy_setup.launch.py, then it is probably reason 2 and a typo in bus.yml. Check in canopen_tests/config folder to find some examples.

jonaskonig commented 1 year ago

Thank you! I had a typo in my config, and this was the issue.