ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Error on calling a rosservice

asked 2018-03-03 12:09:21 -0600

bxl gravatar image

updated 2018-03-03 12:22:21 -0600

Im trying to enable hector_quadrotor motors' on throught code:

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

   ros::NodeHandle nh;

  ros::ServiceClient enable_motors = nh.serviceClient<hector_uav_msgs::EnableMotors>("enable_motors");

  hector_uav_msgs::EnableMotors motors;
  motors.request.enable = true;

  if ({
    ROS_INFO("Motors on");
   ROS_INFO("Motors off");   

However, calling the service always fails (returns 0) and results on the else statement.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-03 15:32:27 -0600

bxl gravatar image

Have to wait for service to become available:


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-03-03 12:09:21 -0600

Seen: 286 times

Last updated: Mar 03 '18