sm_data_sharing_1

Demonstrates sharing data across multiple states and clients using a state-machine-scoped component on a local client.

README

State Machine Diagram

sm_data_sharing_1

Description

Demonstrates sharing data across multiple states using a state-machine-scoped component. A local client (ClData) hosts a CpMissionData component that holds initialPosition and targetPosition fields. Client behaviors in each state call requiresComponent(missionData_) to obtain a pointer to the component — the framework searches all orthogonals and clients globally, so any behavior can access any component regardless of which orthogonal or client owns it. CbStoreData1 stores the initial position, CbStoreData2 stores the target position, and CbProcessData reads both, computes the Euclidean distance, logs the result, and resets the data for the next cycle.

Build Instructions

First, source your ros2 installation.

source /opt/ros/jazzy/setup.bash

Before you build, make sure you’ve installed all the dependencies…

rosdep install --ignore-src --from-paths src -y -r

Then build with colcon build…

colcon build

Operating Instructions

After you build, remember to source the workspace...
source install/setup.bash

And then run the launch file…

ros2 launch sm_data_sharing_1 sm_data_sharing_1.launch.py

Viewer Instructions

If you have the SMACC2 Runtime Analyzer installed then type...
ros2 run smacc2_rta smacc2_rta

If you don’t have the SMACC2 Runtime Analyzer click here.