Exercise 5.1 Ros Services: Clients - ERROR: cannot launch node of type

When I try to launch the service client node, I get an error as mentioned below.

I have already tried to add execution persmistions for the c++ node file by this command in terminal:
user:~/catkin_ws/src/service_client_pkg/src$ chmod 777 simple_service_client.cpp

Still same error.

I made sure of launching the Start_service.launch in another terminal and it launched fine everytime, but the client file is having issues.

CMAKELISTS:
cmake_minimum_required(VERSION 3.0.2)
project(service_client_pkg)

find_package(catkin REQUIRED COMPONENTS
roscpp
trajectory_by_name_srv
)

catkin_package(
)

include_directories(

${catkin_INCLUDE_DIRS}
)

add_executable(simple_service_client src/simple_service_client.cpp)

add_dependencies(simple_service_client ${simple_service_client_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

target_link_libraries(simple_service_client
${catkin_LIBRARIES}
)

Package.xml

<?xml version="1.0"?> service_client_pkg 0.0.0 The service_client_pkg package

user

TODO

<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>

Hello @mchauhan,

what is the output of running:
cd ~/catkin_ws
and then
catkin_make
does the package compile without errors?

After compiling did you source the workspace, like this:
source devel/setup.bash

Do you get the same error after compiling, sourcing and then launching the service client?

If so, what is the content of the launch file for the service client?

Please add these additional details that will help me to understand what might be causing this issue.

Cheers,

Roberto

hello @rzegers

I just repeated the process to well explain it well.
It seems weird when i do catkin_make, the ws compiles way too quickly, so i have doubts that client node doesn’t compile at all.

Answers to your questions-
what is the output of running:
cd ~/catkin_ws
image

does the package compile without errors? - Yes the project compiles with no errors. The error is only when i launch client node. Source setup.bash after catkin_make (in all terminals).

Here I launch the Service (service provider node) start_launch.launch

Once I know it is waiting for a service to call it , I call the service by launching the client node in a new terminal with Service running in first terminal as shown below:

Here is the launch file:

By the way thanks for taking time and helping me out. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.