Ask Your Question
0

actionlib feedback move_base

asked 2013-07-18 05:25:40 -0500

acp gravatar image

updated 2013-07-18 05:48:20 -0500

Dear all.

I have navigation stack implemented and I can send some goals to the move base.

I just want to cancel a goal before it reaches its position using feedback.

How can I use feedback?

I have use the following code, but it doesnt work.

ac.sendGoal(goal, &feedbackCb);

void Pose_Goal::feedbackCb(const move_baseFeedbackConstPtr& feedback){

ROS_INFO("[X]:%f [Y]:%f",feedback->base_position.pose.position.x, feedback->base_position.pose.position.y);

}

any help I would appreciate it. Thanks in advance

edit retag flag offensive close merge delete

Comments

1

"It doesn't work" is pretty vague. Is it not compiling or is it compiling but not functioning as you intend it to? If it isn't compiling, you should put the error message from the compiler in the question next time. In this case, it looks like you didn't name a type for feedbackX_ and feedbackY_.

tbh gravatar imagetbh ( 2013-07-18 05:41:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-07-18 06:56:47 -0500

tbh gravatar image

updated 2013-07-19 04:25:09 -0500

Have a look at the api. The first function passed into sendGoal is the doneCB and only gets executed when the action server sends a result message. You'll need to use all the arguments instead of relying on the defaults. Something like

ac.sendGoal(goal, &doneCb, &activeCb, &feedbackCb);

EDIT: here's the code you said you used.

ac.sendGoal(goal,boost::bind(&Pose_Goal::doneCb, this, _1, _2), Client::SimpleActiveCallback(),Client::SimpleFeedbackCallback());

void Pose_Goal::feedbackCb(const move_base_msgs::MoveBaseFeedbackConstPtr &feedback){ 
    ROS_INFO("[X]:%f [Y]:%f [W]: %f",feedback->base_position.pose.position.x,feedback->base_position.pose.position.y,feedback->base_position.pose.orientation.w); 
}

You need to pass your feedback function to sendGoal. Client::SimpleFeedbackCallback() is the default, do-nothing feedback callback. Put a reference or boost pointer to your Pose_Goal::feedbackCb instead.

edit flag offensive delete link more

Comments

hi, well I have done the following: ac.sendGoal(goal,boost::bind(&Pose_Goal::doneCb, this, _1, _2), Client::SimpleActiveCallback(),Client::SimpleFeedbackCallback());

acp gravatar imageacp ( 2013-07-19 01:53:26 -0500 )edit

void Pose_Goal::feedbackCb(const move_base_msgs::MoveBaseFeedbackConstPtr &feedback){ ROS_INFO("[X]:%f [Y]:%f [W]: %f",feedback->base_position.pose.position.x,feedback->base_position.pose.position.y,feedback->base_position.pose.orientation.w); }

acp gravatar imageacp ( 2013-07-19 01:53:47 -0500 )edit

But I can not get the position over feedbackCb, just wondering how to get the current position from feedbackCb

acp gravatar imageacp ( 2013-07-19 01:54:31 -0500 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-07-18 05:25:40 -0500

Seen: 2,453 times

Last updated: Jul 19 '13