Ask Your Question

Using SMACH to monitor robot battery level

asked 2013-10-21 07:00:52 -0600

Pi Robot gravatar image

I'm wondering if anyone knows how to program the following simple scenario using SMACH.

The robot monitors its battery level on a topic called /battery_level using a SMACH MonitorState which is part of the state machine SM_MONITOR_BATTERY. In the meantime, the robot navigates around a series of waypoints in succession using a state machine SM_NAV_WAYPOINTS.

I want the overall state machine to behave as follows: If the battery level falls below a threshold (SM_MONITOR_BATTERY returns 'invalid'), SM_MONITOR_BATTERY transitions to another state called RECHARGE that moves the robot to the docking station (NAV_DOCKING_STATION) and recharges the robot. In the meantime, the SM_NAV_WAYPOINT machine is paused or terminated until the battery is recharged (SM_MONITOR_BATTERY returns 'valid').

I can make both the recharging behavior and the waypoint navigation behavior work on their own but I have only a vague idea how they can be combined using the Concurrence container. I've tried for days to get the right syntax and I have failed.

Any help would be greatly appreciated.


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-10-22 06:57:13 -0600

lindzey gravatar image

This sounds similar to something I had to do last year - I posted a simplified version of my final state machine here.

However, I assume that you already found that, and it hasn't helped. You might get better answers if you post what you've tried so far about and ask what's wrong with it.

edit flag offensive delete link more


Hi Linzey--I think this is exactly what I need so many thanks! You're right--I did read your Wiki page some time ago but forgot where it was until now.

Pi Robot gravatar image Pi Robot  ( 2013-10-22 12:48:42 -0600 )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



Asked: 2013-10-21 07:00:52 -0600

Seen: 531 times

Last updated: Oct 22 '13