Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

actionlib sendgoal arguments

Hi everybody!

I'm following the ROS-I tutorial (http://aeswiki.datasys.swri.edu/rositraining/indigo/Exercises/demo/part4.3), and I get stuck when I have to send a goal to the server using the sendGoal method. Reading the sendGoal reference (http://docs.ros.org/hydro/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#ae6a2e6904495e7c20c59e96af0d86801) I should provide the goal and three callback functions. On line 32, like I wrote, looks it is not correct: Eclipes says "Method 'sendGoal' could not be resolved". What should I do?

Thank you!

  #include <collision_avoidance_pick_and_place/pick_and_place.h>

/*    SET GRIPPER
  Goal:
      - Turn the vacuum gripper on or off.
  Hints:
      - Use the grasp action client to send an grasp request to the grasp server.
      - Confirm that the gripper was successfully opened or closed and exit on error
*/
void collision_avoidance_pick_and_place::PickAndPlace::set_gripper(bool do_grasp)
{
//  ROS_ERROR_STREAM("set_gripper is not implemented yet.  Aborting."); exit(1);

  // task variables
  object_manipulation_msgs::GraspHandPostureExecutionGoal grasp_goal;
  bool success;

  // set the corresponding gripper action in the "grasp_goal" object.
  if (do_grasp)
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::GRASP;
  else
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::RELEASE;

  /* Fill Code:
   * Goal:
   * - Send the grasp goal to the server.
   * Hints:
   * - Use the "sendGoal" method of the grasp client "grasp_action_client_ptr"
   * to make a call to the server.
   */
  /* ========  ENTER CODE HERE ======== */
  grasp_action_client_ptr.sendGoal(grasp_goal.goal, SimpleDoneCallback, SimpleActiveCallback, SimpleFeedbackCallback) ;


  /* Fill Code:
   * Goal:
   * - Confirm that client service call succeeded.
   * Hints:
   * - Use the "waitForResult" method of the client to wait for completion.
   * - Give "waitForResult" a timeout value of 4 seconds
   * - Timeouts in ros can be created using "ros::Duration(4.0f)".
   * - Save returned boolean from waitForResult() in the "success" variable.
   */
  /* ========  ENTER CODE HERE ======== */

  if(success)
  {
    if (do_grasp)
      ROS_INFO_STREAM("Gripper closed");
    else
      ROS_INFO_STREAM("Gripper opened");
  }
  else
  {
    ROS_ERROR_STREAM("Gripper failure");
    exit(1);
  }
}

actionlib sendgoal arguments

Hi everybody!

I'm following the ROS-I tutorial (http://aeswiki.datasys.swri.edu/rositraining/indigo/Exercises/demo/part4.3), and I get stuck when I have to send a goal to the server using the sendGoal method. Reading the sendGoal reference (http://docs.ros.org/hydro/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#ae6a2e6904495e7c20c59e96af0d86801) I should provide the goal and three callback functions. On line 32, like where I wrote, looks it is not correct: insert the callback functions as indicated in the reference, Eclipes says "Method 'sendGoal' could not be resolved". What should I do?

Thank you!

  #include <collision_avoidance_pick_and_place/pick_and_place.h>

/*    SET GRIPPER
  Goal:
      - Turn the vacuum gripper on or off.
  Hints:
      - Use the grasp action client to send an grasp request to the grasp server.
      - Confirm that the gripper was successfully opened or closed and exit on error
*/
void collision_avoidance_pick_and_place::PickAndPlace::set_gripper(bool do_grasp)
{
//  ROS_ERROR_STREAM("set_gripper is not implemented yet.  Aborting."); exit(1);

  // task variables
  object_manipulation_msgs::GraspHandPostureExecutionGoal grasp_goal;
  bool success;

  // set the corresponding gripper action in the "grasp_goal" object.
  if (do_grasp)
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::GRASP;
  else
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::RELEASE;

  /* Fill Code:
   * Goal:
   * - Send the grasp goal to the server.
   * Hints:
   * - Use the "sendGoal" method of the grasp client "grasp_action_client_ptr"
   * to make a call to the server.
   */
  /* ========  ENTER CODE HERE ======== */
  grasp_action_client_ptr.sendGoal(grasp_goal.goal, SimpleDoneCallback, SimpleActiveCallback, SimpleFeedbackCallback) ;


  /* Fill Code:
   * Goal:
   * - Confirm that client service call succeeded.
   * Hints:
   * - Use the "waitForResult" method of the client to wait for completion.
   * - Give "waitForResult" a timeout value of 4 seconds
   * - Timeouts in ros can be created using "ros::Duration(4.0f)".
   * - Save returned boolean from waitForResult() in the "success" variable.
   */
  /* ========  ENTER CODE HERE ======== */

  if(success)
  {
    if (do_grasp)
      ROS_INFO_STREAM("Gripper closed");
    else
      ROS_INFO_STREAM("Gripper opened");
  }
  else
  {
    ROS_ERROR_STREAM("Gripper failure");
    exit(1);
  }
}

actionlib sendgoal arguments

Hi everybody!

I'm following the ROS-I tutorial (http://aeswiki.datasys.swri.edu/rositraining/indigo/Exercises/demo/part4.3), and I get stuck when I have to send a goal to the server using the sendGoal method. Reading the sendGoal reference (http://docs.ros.org/hydro/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#ae6a2e6904495e7c20c59e96af0d86801) I should provide the goal and three callback functions. On

Do I have to manually define those callback functions?

However in line 32, where I I tried to insert the those callback functions funcs as indicated in the reference, Eclipes reference but Eclipse says "Method 'sendGoal' could not be resolved". What should I do?

Thank you!

  #include <collision_avoidance_pick_and_place/pick_and_place.h>

/*    SET GRIPPER
  Goal:
      - Turn the vacuum gripper on or off.
  Hints:
      - Use the grasp action client to send an grasp request to the grasp server.
      - Confirm that the gripper was successfully opened or closed and exit on error
*/
void collision_avoidance_pick_and_place::PickAndPlace::set_gripper(bool do_grasp)
{
//  ROS_ERROR_STREAM("set_gripper is not implemented yet.  Aborting."); exit(1);

  // task variables
  object_manipulation_msgs::GraspHandPostureExecutionGoal grasp_goal;
  bool success;

  // set the corresponding gripper action in the "grasp_goal" object.
  if (do_grasp)
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::GRASP;
  else
    grasp_goal.goal = object_manipulation_msgs::GraspHandPostureExecutionGoal::RELEASE;

  /* Fill Code:
   * Goal:
   * - Send the grasp goal to the server.
   * Hints:
   * - Use the "sendGoal" method of the grasp client "grasp_action_client_ptr"
   * to make a call to the server.
   */
  /* ========  ENTER CODE HERE ======== */
  grasp_action_client_ptr.sendGoal(grasp_goal.goal, SimpleDoneCallback, SimpleActiveCallback, SimpleFeedbackCallback) ;


  /* Fill Code:
   * Goal:
   * - Confirm that client service call succeeded.
   * Hints:
   * - Use the "waitForResult" method of the client to wait for completion.
   * - Give "waitForResult" a timeout value of 4 seconds
   * - Timeouts in ros can be created using "ros::Duration(4.0f)".
   * - Save returned boolean from waitForResult() in the "success" variable.
   */
  /* ========  ENTER CODE HERE ======== */

  if(success)
  {
    if (do_grasp)
      ROS_INFO_STREAM("Gripper closed");
    else
      ROS_INFO_STREAM("Gripper opened");
  }
  else
  {
    ROS_ERROR_STREAM("Gripper failure");
    exit(1);
  }
}