actionlib sendgoal arguments
Hi everybody!
I'm following the ROS-I tutorial ( http://aeswiki.datasys.swri.edu/rosit... ), 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/actionl... ) I should provide the goal and three callback functions.
Do I have to manually define those callback functions?
However in line 32, I tried to insert those callback funcs as indicated in the 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);
}
}
You have a thing named
grasp_action_client_ptr
, which is probably a pointer, but you're trying to use the dot operator on it. Perhaps you want the deference->
instead?Thank you for your comment!. I changed the operator like you said, and now
sendGoal
is recognized, but I get "Invalid arguments" error. It seems that it doesn't recognize the callback functions. I don't care of the callback fcns, but if I don't put them in the sendGoal I get the error as well.The API docs you link to show defaults for the callbacks, so I don't think you need to provide those arguments. It looks like you're following a tutorial that is mostly pre-filled code, so I'd recommend that you read the examples again.