WaitforService error in rosject, part2, ROS in 5 Days C++

I have a problem in the second part of the rosject in the course ROS Basics in 5 Days, C++. I’ve already completed the server part and it works, but I am not able to add the call to the server with the main code (in the launch file the server and the main file are both called).
I added these lines in the main code:
ros::init(argc, argv, “wall_follow_node”);
ros::NodeHandle nh;
//ros::Rate rate(10);

ros::ServiceClient service_findwall_client = nh.serviceClient<rosject_cp_pkg::FindWall>("/find_wall");
rosject_cp_pkg::FindWall srv;
if (service_findwall_client.call(srv)) 
ROS_INFO("Service /find_wall successfully called from client!");
{ ROS_ERROR("Failed to call service /find_wall from client!"); 
return 1;

But every time I got this error:

Why it fails to call the server once it is running? What could it be?
Thanks in advance

You are calling your service on this line. What is the expected response?
You should put some info or error logs in the code to detect what’s happening after you run this line

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