I created a package and source file in my Ubuntu 20.04 computer. My goal is to visualize dummy sensors and objects in Rviz2. To do that I followed the How to visualize sensor data in ROS2 article. And, when I went to build the package with the command:
colcon build --symlink-installI got this error:
The cmake file I used is the following:
I am using ROS2 foxy distro.
11 Answer
When you have an add_executable command in cmake, it expects the files you list to exist relative to the location of your CMakeLists.txt file. So, for example, your workspace might look something like this:
.
└── my_package ├── CMakeLists.txt ├── include │ └── my_package ├── package.xml └── src └── dolly_follow.cppIt looks like the tutorial you're following just copy & pasted a CMakeLists.txt from the dolly repository, but did not instruct you to actually pull any code from the repository; I would say the problem here is that the tutorial's instructions are unclear.
If you don't intend to actually compile a C++ file named dolly_follow.cpp, you can both remove the add_executable command that refers to it and the later install command that references the add_executable command's target.