Robotics StackExchange | Archived questions

calling service with ros::ServiceClient

I posted the code and the error that i see when i do rosmake. someone can halp me for detecting the error?

#include <ros/ros.h>
#include "gazebo_msgs/SetModelState.h"

...

ros::ServiceClient client = n.serviceClient<gazebo_msgs::SetModelState>("/gazebo/set_model_state");
        gazebo_msgs::SetModelState setmodelstate;
        gazebo_msgs::ModelState modelstate;
        setmodelstate.request.model_state = modelstate;

        if (client.call(setmodelstate))
        {
            ROS_INFO("BRILLIANT!!!");
        }
        else
        {
            ROS_ERROR("Failed to call service ");
        }

Asked by Maurizio88 on 2012-02-09 02:32:46 UTC

Comments

I don't see your rosmake error. Can you post the entire source file? We'll need to see everything to debug.

Asked by Mac on 2012-02-23 09:08:23 UTC

Also the console output of the compile error is useful.

Asked by tfoote on 2012-03-21 16:28:17 UTC

Answers