Service Quiz Humble C++ could not launch service client

Hello, the server and the client run without problems when I run it manually. The bot also does what it is supposed to do. Unfortunately the bot evaluation sees it differently:


If I launch ros2 launch services_quiz, it works fine

There is in general this notice/problem

Compiling only shows warnings, and as I said, I can run it manually and it runs without problems

Hello @katae1 ,

Can you please share here the code of your service client??

#include “rclcpp/rclcpp.hpp”
#include “rclcpp/timer.hpp”
#include “services_quiz_srv/srv/spin.hpp”


using namespace std::chrono_literals;

class ServiceClient : public rclcpp::Node {
rclcpp::Client<services_quiz_srv::srv::Spin>::SharedPtr client_;
rclcpp::TimerBase::SharedPtr timer_;
bool service_done_ = false;

void response_callback(
rclcpp::Client<services_quiz_srv::srv::Spin>::SharedFuture future) {
RCLCPP_INFO(this->get_logger(), “response callback”);
auto status = future.wait_for(1s);
if (status == std::future_status::ready) {
RCLCPP_INFO(this->get_logger(), “Result: success”);
service_done_ = true;
} else {
RCLCPP_INFO(this->get_logger(), “Service In-Progress…”);
RCLCPP_INFO(this->get_logger(), “end response callback”);

ServiceClient() : Node(“rotate_client_node”) {
RCLCPP_INFO(this->get_logger(), “rotate_client launched”);
client_ = this->create_client<services_quiz_srv::srv::Spin>(“rotate”);
while (!client_->wait_for_service(1s)) {
if (!rclcpp::ok()) {
“Client interrupted while waiting for service. Terminating…”);
“Service Unavailable. Waiting for Service…”);
RCLCPP_INFO(this->get_logger(), “service reached”);

void call_service(std::string direction, float angular_velocity, int time) {
RCLCPP_INFO(this->get_logger(), “calling service”);
auto request = std::make_shared<services_quiz_srv::srv::Spin::Request>();
request->direction = direction;
request->angular_velocity = angular_velocity;
request->time = time;

service_done_ = false;
auto result_future = client_->async_send_request(
    request, std::bind(&ServiceClient::response_callback, this,


bool is_service_done() const { return this->service_done_; }

int main(int argc, char *argv) {
rclcpp::init(argc, argv);

auto service_client = std::make_shared();
service_client->call_service(“right”, 0.2, 10);
while (!service_client->is_service_done()) {

return 0;


There is also a new error when I recompile all packages


Here’s the key to the error, your packages are not compiling successfully. Actually, the grader should have stopped at the compilation point (I’ll look into why it didn’t).

Please try this and try to compile again. Let’s see if any error comes up after that.

cd ~/ros2_ws
rm -rf build/ install/ log/
colcon build

Hey, thanks for the help. However, I tried this yesterday a few times, but unfortunately it still does not work:

This compilation failure is happening in your executors_exercises_pkg. You can have a look at that later, but it’s not why your quiz is failing.

Looking more closely at the logs (sorry I didn’t do this earlier!), when you remove those folders and “packages-select” services_quiz and services_quiz_srv, it compiles successfully.

The problem I can see from the logs is that it seems your service client is almost immediately, within 2 seconds. It should wait for the rotate service to complete before exiting, and that should take about 10 seconds!


Any thoughts?

PS: I’m now updating the suggestions of the grader when that step fails, because I see it’s missing the hint about the rotation time.

Hey, I already deleted another package yesterday, which supposedly “failed”. And then the “executors_exercises_pkg” was timed as failed. All these packages worked fine before.

I’ll take a look at the cliet error right away.

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