Quick Tutorial
#include <assert.h>#define HFSM2_ENABLE_PLANS#include <hfsm2/machine.hpp>struct Context {
bool powerOn;
};using Config = hfsm2::Config::ContextT<Context>;using M = hfsm2::MachineT<Config>;#define S(s) struct s
using FSM = M::PeerRoot<
S(Off), // initial top-level state
M::Composite<S(On), // sub-machine region with a head state (On) and and 3 sub-states
S(Red), // initial sub-state of the region
S(Yellow),
S(Green)
>,
S(Done)
>;
#undef SSee Also
Last updated