# fsm_pkg **Repository Path**: remidako/fsm_pkg ## Basic Information - **Project Name**: fsm_pkg - **Description**: A ROS package containing a fsm. - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-06-30 - **Last Updated**: 2024-07-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # fsm_pkg #### Description A ROS package containing a fsm which is a name for finite-state machine. #### Getting Started Firstly, create a workspace, clone the repo, and build the workspace. In order to do that, please run: ``` mkdir -p ws/src && cd ws/src git clone https://gitee.com/remidako/ros-pid_pkg.git cd ../.. catkin_make source devel/setup.bash ``` #### Usage 1.Define fsm's state and event. ``` typedef enum{ EVENT_INIT//a certain event //and so on }EVENT_ID; typedef enum{ STATE_INIT//a certain state //and so on }STATE; ``` 2.Define a fsm table. ``` FsmTable ssi_table[]= { {STATE_INIT , EVENT_INIT , NEXT_STATE , act_Init}, //and so on } ``` 3.Define the acting function. For example, define the "act_Init" function in the step 2. 4.Define a fsm_init function and call the FSM_Regist function in it. Then, Define a fsm_run function and call the FSM_EventHandle function in it. 5.Call the fsm_init for fsm initiation and fsm_run to run the finite-state machine.