ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

actionlib shutdown beacuse of getState()

asked 2020-11-30 20:53:26 -0500

zhazha gravatar image

updated 2020-12-06 21:10:53 -0500

the code is be like:

return this->moveBaseClient->getState();

while moveBaseClient is:

typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> MoveBaseClient;
std::shared_ptr<MoveBaseClient> moveBaseClient;

calling at 20hz and this happened:

robot_decision_node: /opt/ros/kinetic/include/actionlib/managed_list.h:168: const T& actionlib::ManagedList<T>::Handle::getElem() const [with T = boost::shared_ptr<actionlib::CommStateMachine<move_base_msgs::MoveBaseAction_<std::allocator<void> > > >]: Assertion `valid_' failed.

Am i using getState wrong?

i chage the frequency to 10hz, now it works fine.

but it's still a bug?

edit retag flag offensive close merge delete

Comments

1

You should also post the code that sets moveBaseClient.

miura gravatar image miura  ( 2020-12-01 07:56:32 -0500 )edit

hi,i have updated the question with defination of moveBaseClient

zhazha gravatar image zhazha  ( 2020-12-01 19:56:16 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-12-06 05:57:25 -0500

miura gravatar image

You may not be able to create an instance.

MoveBaseClient moveBaseClient("move_base", true); and initialize it with this->moveBaseClient.getState(), which should work.

If it has to be a pointer, it would work with std::shared_ptr<MoveBaseClient> moveBaseClient = new MoveBaseClient("move_base", true);.

edit flag offensive delete link more

Comments

1

i have initialized the pointer like this:

if (!moveBaseClient.get()) { moveBaseClient = std::make_shared<movebaseclient>("/move_base"); }

and i run the node in 10hz,it works fine

zhazha gravatar image zhazha  ( 2020-12-06 19:11:19 -0500 )edit

Congratulations. If you would like, please make a collect. Or, please state your answer.

miura gravatar image miura  ( 2020-12-06 20:10:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-11-30 20:53:26 -0500

Seen: 215 times

Last updated: Dec 06 '20