Exercise 5.1: 'trajectory_by_name_srv/TrajByName.h' file not found

Hi all,

I encountered an error when compiling the code for Exercise 5.1: The 'trajectory_by_name_srv/TrajByName.h' file not found.

I followed all the instructions in Exercise 5.1 and added in CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS

In package.xml, I also added:


I also tried this to show the ros service msg:

user:/home/simulations/public_sim_ws/devel/lib$ rossrv show trajectory_by_name_srv/TrajByName
string traj_name
bool success
string status_message

Could anyone help me check this problem, please?


If modifying CMakeLists.txt and package.xml files doesn’t work, try recreating the package. Back up important code, remove the current package and then recreate it.

cd ~/catkin_ws/src
catkin_create_pkg service_client_pkg roscpp trajectory_by_name_srv
cd ~/catkin_ws
rm -rf build/ devel/   # so that all references to the former package can be removed

Then run catkin_make when you are ready. Please ensure you delete the former package and not just rename it.