how to build and debug ROS2 nodes with clion and docker
Hi, Currently, I'm using docker as my ROS2 environment(using the official humble image file). I want to use the clion debugger to debug my code. How can I configure the Clion so it will use Colcon and compile the code with the docker? also for debugging On my ubuntu machine, the ROS2 is not installed
I tried to use the docker Toolchain (as here:https://www.jetbrains.com/help/clion/clion-toolchains-in-docker.html#sample-dockerfile ) combine with this tutorial:https://www.jetbrains.com/help/clion/ros2-tutorial.html
what am I missing?
Asked by os on 2022-05-29 16:09:48 UTC
Comments
I can't speak exactly to this, but I use clion daily to debug native (not inside docker) ros2 nodes and plugins. For debugging outside docker, the trick is 1) ensure that you start clion from a terminal that has all the ros2 stuff sourced and 2) ensure that any libraries your node links to is the version of that library that clion has built, otherwise it won't recognize it as something it can debug through. An easy way to ensure #2 that I've found is to use colcon to build things as normal, then change the libraries in question inside install/lib (assuming merge install) to symbolic links pointing to the lib inside the clion build folder.
Hope that at least helps answer some of your questions.
Asked by ChuiV on 2022-05-31 20:55:12 UTC
I've been running into some issues getting headers to sync properly in CLion when using the docker toolchain. https://youtrack.jetbrains.com/issue/CPP-29747/Certain-ROS2-package-headers-missing-from-Intellisense-when-using-a-Docker-toolchain
I can build, run, and debug individual packages but get bad intellisense. It sounds like you want to be able to build, run, and debug individual packages with the entire workspace open, which I have not had any real luck doing.
Asked by maspe36 on 2022-07-07 10:22:44 UTC