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
  roscpp
  trajectory_by_name_srv
)

In package.xml, I also added:

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>trajectory_by_name_srv</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>trajectory_by_name_srv</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>trajectory_by_name_srv</exec_depend>

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?

Best,
Weiheng

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.

Reference