1 Star 0 Fork 1

ld_robot/hfsm2_test

forked from Alex/hfsm2_test 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
penguin_fsm.cpp 911 Bytes
一键复制 编辑 原始数据 按行查看 历史
sczhou 提交于 2022-08-03 17:04 +08:00 . feat hfsm2 all done
/**
* @file penguin_fsm.cpp
* @author your name (you@domain.com)
* @brief
* @version 0.1
* @date 2022-08-03
*
* @copyright Copyright (c) 2022
*
*/
#include "penguin_fsm.h"
#include "penguin.h"
void Eatting::react(const Doudou&, FullControl& f) noexcept {
// 获取penguin对象,并调用其方法
f.context()->a();
// 状态流转
f.changeTo<BeatDoudou>();
}
void Sleep::react(const Sunrise&, FullControl& f) noexcept {
f.context()->a();
// 状态流转
f.changeTo<Eatting>();
}
void BeatDoudou::react(const Sunset&, FullControl& f) noexcept {
f.context()->a();
// 状态流转
f.changeTo<Sleep>();
}
void FSM_Logger::recordTransition(Context& ctx, const StateID origin,
const TransitionType,
const StateID target) noexcept {
std::cout << stateName(origin) << " -> " << stateName(target) << "\n";
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ld_robot/hfsm2_test.git
git@gitee.com:ld_robot/hfsm2_test.git
ld_robot
hfsm2_test
hfsm2_test
master

搜索帮助