Ask Your Question

Auto Dock when battery is low keep getting called

asked 2021-06-07 09:13:47 -0600

xkaraman gravatar image

updated 2021-06-07 09:15:40 -0600

Hello there all,

I am trying to implement my own action server robot_action_server with various goals on Turtlebot 2 with python. One of them is to move the robot close to dock station with move_base server and then call the dock_drive_action server.

My class say robotController spins up this robot_action_server and a SimpleActionClient of appropriate type in order to call it if need.

Now, I am trying to make Turtlebot 2 auto dock when laptop battery or its own battery pass a certain threshold. In order to do that, i instantiated an ApproximateTimeSynchronizer for both batteries. I do simple checks for received battery levels and if is not already charging or already on way to charge, i call a function that calls the robot_action_server charge goal. The charge goal, first moves the robot to a close point and the call the dock_drive_action server. All good so far. Move_base and auto_dock work great and finish successfully.

However, when the robot docks, the next ApproximateTimeSynchronizer callback show that turtlebot_battery is still not on charger state and repeats the whole procedure again.

edit retag flag offensive close merge delete


I think the problem is that the synchronzier callback process old messages after the action has completed. How is it possible to overcome this problem?

xkaraman gravatar image xkaraman  ( 2021-06-07 09:38:45 -0600 )edit

Sorry for off-context; 1) Are you making your own auto-dock solution, or are you customizing existing tools e.g. 2) Is it possible to see your work at a public space (e.g.

130s gravatar image 130s  ( 2021-06-08 05:14:17 -0600 )edit
  1. No, i am not making my own auto-dock solution. I am using the already implemented ros action server provided by kobuki_auto_dock.
  2. Unfortunately, it's not on a public space.

I have already answered this question, but thanks for trying to help! :)

xkaraman gravatar image xkaraman  ( 2021-06-08 08:37:00 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-08 04:19:01 -0600

xkaraman gravatar image

Indeed, that was the problem. In order to solve it, ApproximateTimeSynchronizer queue_size argument was not enough. Instead i had to initialize my message_filters.Subscribers queue_size argument with 1 or 2 to only process the last or last two messages.

I wonder if ApproximateTimeSynchronizer queue size is even necessary at this point.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2021-06-07 09:13:47 -0600

Seen: 39 times

Last updated: Jun 08 '21