-
Notifications
You must be signed in to change notification settings - Fork 9
Feature: implement state machine shutdown #412
Conversation
…t-march/march into feature/PM-133-implement-shutdown
march_state_machine/src/march_state_machine/states/idle_state.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please implement an ugly solution to kill Gazebo
Don't forget to install
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice for the Gazebo exit solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lekker gewerkt!
You should probably update the tutorial https://project-march.github.io/tutorials/doc/development/add_a_new_gait.html
You should also look through all the <gait_name>_sm.py files for 'preempted' -> 'preempted' transitions. They should go to failed.
march_state_machine/src/march_state_machine/states/safety_state.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except for the few comments Roel placed the request looks good to me.
from march_state_machine.ControlFlow import control_flow | ||
from feedback_action_state import FeedbackActionState | ||
from march_shared_resources.msg import GaitNameAction, GaitNameGoal | ||
from march_state_machine.control_flow import control_flow | ||
|
||
|
||
class StoppableState(FeedbackActionState): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this class should have a similar implementation of control_flow to the one in IdleState. This will also allow the removal of some unused methods in control_flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is a bit different in implementation since it inherits from SimpleActionState
, which implements preemption for itself, so it is not possible to use the same kind of implementation.
dcb876b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful work sir!
Closes PM-61
Description
This PR fixes the preemption of the statemachine correctly when shutting down ROS. When ROS is shutdown, the state machine will preempt the current states and shutdown gracefully by going to the
SHUTDOWN
state. The concurrentSafetyState
has now been implemented as asmach_ros.MonitorState
, which will preempt the state machine when something is published on/march/error
. Then the state machine will go toERROR
, which is currently not implemented and automatically goes toSHUTDOWN
. In the future this can be used for any error handling to return toHEALTHY
. The state machine is now also capable of preempting theWAIT FOR GAIT SERVER
state. Furthermore, theIdleState
is now implemented with callbacks fromcontrol_flow
, which made it easier to preempt it.tl;dr No more errors when pressing ctrl-c 🙆♂️
Changes
SafetyState
asMonitorState
IdleState
ShutdownState