ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Error in writing a Client for RGB-Dslam

asked 2013-04-21 23:22:28 -0600

Karan gravatar image

updated 2014-01-28 17:16:17 -0600

ngrennan gravatar image

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 (
    ROS_INFO("Capturing a frame");
    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..?


@Felix Endres
Had to edit the line to this

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


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

And it works fine.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-21 23:59:01 -0600

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

edit flag offensive delete link more

Question Tools


Asked: 2013-04-21 23:22:28 -0600

Seen: 262 times

Last updated: Apr 22 '13