yujinrobot / kobuki

Software for iClebo Kobuki
kobuki.yujinrobot.com
222 stars 176 forks source link

fix racing condition for docking action server #363

Closed v4hn closed 8 years ago

v4hn commented 8 years ago

Murphy's Law for demos in robotics: Never did it happen before, never will it happen again (at least not during testing), but right in the middle of the demo the turtlebot fails to dock with the error message

Unintended Case: ActionService is active, but DockDrive is not enabled..

As nobody considered this could happen, there was no error handling in the demo and the rest of the setup assumed the turtle docked...

Leaving aside the background story:

The action server callbacks and the syncCb (for sensor updates) are processed in different threads. So with a lot of luck the goal is accepted, but docking is not activated yet (https://github.com/yujinrobot/kobuki/blob/indigo/kobuki_auto_docking/src/auto_docking_ros.cpp#L84) and syncCb notices that the action server is active, but docking is not enabled (yet) (https://github.com/yujinrobot/kobuki/blob/indigo/kobuki_auto_docking/src/auto_docking_ros.cpp#L148).

@Jntzko for reference

stonier commented 8 years ago

LGTM

stonier commented 8 years ago

Cherried across to kinetic, and released as indigo v0.6.7 and kinetic v0.7.1

v4hn commented 8 years ago

Thanks!