Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error on calling a rosservice

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 (enable_motors.call(motors)){
    ROS_INFO("Motors on");
  }
  else{
   ROS_INFO("Motors off");   
 }

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

Error on calling a rosservice

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 (enable_motors.call(motors)){
    ROS_INFO("Motors on");
  }
  else{
   ROS_INFO("Motors off");   
 }

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