0
$\begingroup$

Rosanswers logo

I am currently working on a project which requires me to use the RGB-D slam without a GUI. So i have to use the ros service calls for the various operations to be done by the node.

Now since the rgbdslam has to be used in sync with other nodes i can't always use the terminal to make rosservice commands.

So instead i am writing a client for the Rgbd-slam service. Here's the code which produces an error. Whenever i run the node below the service is not called and there is an error as in the ELSE loop.

  ros::init(argc, argv, "rgbdslam_client");
  ros::NodeHandle n;
  ros::ServiceClient client = n.serviceClient<rgbdslam::rgbdslam_ros_ui>("rgbdslam_ros_ui");
  rgbdslam::rgbdslam_ros_ui srv;
    srv.request.command = "frame";


  if (client.call(srv))
  {
    ROS_INFO("Capturing a frame");
  }
  else
  {
    ROS_ERROR("Failed to call service Rgbdslam frame capture ");
    return 1;
  }

  return 0;

But when i use the Rosservice call command in the other terminal it works fine.

What could be a possible solution to the above problem..?

--edit--

@Felix Endres
Had to edit the line to this

ros::ServiceClient client = n.serviceClient<rgbdslam::rgbdslam_ros_ui>("/rgbdslam/ros_ui");

from

ros::ServiceClient client = n.serviceClient<rgbdslam::rgbdslam_ros_ui>("rgbdslam_ros_ui");

And it works fine.


Originally posted by Karan on ROS Answers with karma: 263 on 2013-04-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This could be a namespace problem. You use "rgbdslam_ros_ui" for the client. The service name is "/rgbdslam/ros_ui".


Originally posted by Felix Endres with karma: 6468 on 2013-04-21

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.