ROS2 Troubleshooting - norlab-ulaval/Norlab_wiki GitHub Wiki
Some errors happens frequently with ROS 2. Here are a few ways to solve some errors
I often got the following error when I built packages that contains custom messages definitions :
Traceback (most recent call last):
File "/opt/ros/humble/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 8, in <module>
from rosidl_generator_py import generate_py
ImportError: cannot import name 'generate_py'
In the package's CMakeLists.txt
, comment the following line:
find_package(rosidl_default_generators REQUIRED)
# find_package(rosidl_default_generators REQUIRED)
Here is a list of Python dependencies that are understood by rosdep
https://github.com/ros/rosdistro/blob/master/rosdep/python.yaml
There is an article about rosbags in ROS 2 here
To enable coloured ROS 2 logs in your terminal, set export RCUTILS_COLORIZED_OUTPUT=1
(or put it in your .bashrc to get it each time you boot!)
No topics are listed on a remote device despite the correct ROS_DOMAIN_ID
being set. This only happens for topics published by nodes started by a service.
Adding a 10-second delay to the startup script seems to solve the issue. However, a better solution is desired, understanding better what's happening under the hood with startup services.
After booting, the startup service launches correctly, and the topics can be listed locally (or through ssh).
If the service is restarted manually with sudo systemctl restart startup-script.service
, the topics stop being visible locally and occasionally start to appear remotely.
(node that the reason why this works is not yet fully understood)
- Place this .xml dds configuration into ~/.ros/fastdds.xml
- Add these two lines to the .bashrc file after sourcing ros setup files:
export FASTRTPS_DEFAULT_PROFILES_FILE=~/.ros/fastdds.xml export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
- Reboot