|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Generic StateDescription: This tutorial show how to implement a generic SMACH State
Tutorial Level: BEGINNER
Next Tutorial: CB State
1 from smach import State
The most general (but often least efficient) way to create a state is to derive from the 'State' base class. You can pretty much do anything you want in the execute method of a state. Know that SMACH comes with a library of useful states that you can use, without having to write a whole custom state.
Some good code practices:
- Do not block in your constructor. If your state needs to wait for another component to come up, do this in a separate thread