Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged sm_mode_state_behavior_1 at Robotics Stack Exchange
Package Summary
| Version | 3.1.0 |
| License | Apache-2.0 |
| Build type | AMENT_CMAKE |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/robosoft-ai/SMACC2.git |
| VCS Type | git |
| VCS Version | jazzy |
| Last Updated | 2026-06-10 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Brett Aldrich
Authors
sm_mode_state_behavior_1
Demonstrates a client behavior defined at the mode state level, persisting across all
inner superstate and leaf state transitions. The key insight: a behavior (here,
CbDefaultKeyboardBehavior) owned by a parent state is created once when that parent
enters and destroyed only when that parent exits — it survives every inner transition.
This machine also illustrates the correct solution to the double-event problem: if leaf
states each had their own CbDefaultKeyboardBehavior, every keypress would generate two
identical events (one per active behavior instance). By placing keyboard behavior
exclusively in MsRunning, every keypress generates exactly one event regardless of which
inner state is active.
What it demonstrates
-
CbDefaultKeyboardBehaviorinOrKeyboardis declared inMsRunning::staticConfigure(). - Leaf states (
StPhaseA/B/C,StPhaseX/Y) have onlyCbTimerCountdownOnce— no keyboard behavior. -
EvKeyPressNreactions in leaf states fire in response to events generated byMsRunning’s behavior — the event source and the reacting state are at different hierarchy levels. -
EvKeyPressFreactions inSsPhase1/SsPhase2switch between superstates;MsRunning’s keyboard behavior remains active throughout.
State hierarchy
SmModeStateBehavior1
├── OrTimer (ClRos2Timer)
└── OrKeyboard (ClKeyboard)
MsRunning ← mode state; owns CbDefaultKeyboardBehavior in OrKeyboard
│ (keyboard behavior persists for the entire machine lifetime)
│
├── SsPhase1 (initial superstate)
│ │ Reacts: EvKeyPressF → SsPhase2
│ │
│ ├── StPhaseA (initial) 3s timer
│ ├── StPhaseB 3s timer
│ └── StPhaseC 3s timer
│ (A → B → C → A cycle via timer or 'n')
│
└── SsPhase2
│ Reacts: EvKeyPressF → SsPhase1
│
├── StPhaseX (initial) 5s timer
└── StPhaseY 5s timer
(X → Y → X cycle via timer or 'n')
Build
cd /home/brettpac/workspaces/isaac_ros-dev
colcon build --packages-select sm_mode_state_behavior_1
source install/setup.bash
Launch
ros2 launch sm_mode_state_behavior_1 sm_mode_state_behavior_1.launch.py
This opens two konsole terminals: the state machine node and the keyboard server.
Keyboard controls
| Key | Effect | Handled by |
|---|---|---|
n |
Advance to the next leaf state within the current superstate | Leaf state reaction (event from MsRunning’s behavior) |
f |
Switch between SsPhase1 and SsPhase2 | SsPhase1 or SsPhase2 reaction (event from MsRunning’s behavior) |
| (timer) | Auto-advance to next leaf state (3s in Phase1, 5s in Phase2) | Leaf state reaction |
Send keystrokes via ROS 2 topic (if not using the konsole keyboard server):
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 110" --once # n — next leaf state
ros2 topic pub /keyboard_unicode std_msgs/msg/UInt16 "data: 102" --once # f — switch superstate
Example walkthroughs
Manual leaf state cycling in SsPhase1
Start → MsRunning/SsPhase1/StPhaseA
→ press n → StPhaseB
→ press n → StPhaseC
→ press n → StPhaseA (back to start of cycle)
Switch to SsPhase2 and cycle there
(in SsPhase1/StPhaseB)
→ press f → SsPhase2/StPhaseX (SsPhase2 always re-enters at StPhaseX)
→ press n → StPhaseY
→ press n → StPhaseX
Switch back to SsPhase1
```
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_cmake | |
| cl_ros2_timer | |
| cl_keyboard | |
| smacc2 | |
| rclcpp |
System Dependencies
| Name |
|---|
| xterm |