MoveBaseClient::sendGoal Defining Custom Callbacks
Hi All,
Not sure where I an going wring here - byt the compiler isn't happy. Basically I want to add the callbacks to the MoveBaseClient sendGoal() method so that I can monitor progress.
Code is basically this:
Callbacks:
void goalCompletePlanCallBack(const actionlib::SimpleClientGoalState &state,
const move_base_msgs::MoveBaseActionResultConstPtr &result)
{
ROS_INFO("Goal Plan Complete");
}
void goalActiveCallBack()
{
ROS_INFO("Planning Goal Active");
}
void goalFeedbackCallback(const move_base_msgs::MoveBaseFeedbackConstPtr &feedback)
{
}
then in the code I call:
...
move_base_msgs::MoveBaseGoal goal;
ac.sendGoal(goal, &goalCompletePlanCallBack, &goalActiveCallBack, &goalFeedbackCallback);
...
But the compiler just errors. What is the the correct way to call this?
Many Thanks
Mark
Asked by MarkyMark2012 on 2020-05-05 05:33:52 UTC
Answers
So I found a work around.
After calling sendGoal() I've not got this little while loop
while (navigationState == actionlib::SimpleClientGoalState::ACTIVE ||
navigationState == actionlib::SimpleClientGoalState::PENDING)
{
navigationState = ac.getState();
ROS_DEBUG("Navigation State: %s", navigationState.toString().c_str());
sleep(1);
if (cmdString == "HOME")
{
ac.cancelGoal();
}
}
Basically checking for incoming messages/commands and cancelling the goal when I need
This might be of use to someone ;-)
Mark
Asked by MarkyMark2012 on 2020-05-10 14:24:20 UTC
Comments