Download third-party/unitree_rl_lab/deploy/include/FSM/BaseState.h from hk239/v2d: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/datasets/hk239/v2d/resolve/main/third-party/unitree_rl_lab/deploy/include/FSM/BaseState.h
- Command line
-
hf download hf://datasets/hk239/v2d/third-party/unitree_rl_lab/deploy/include/FSM/BaseState.h
-
curl -L -o BaseState.h https://huggingface.co/datasets/hk239/v2d/resolve/main/third-party/unitree_rl_lab/deploy/include/FSM/BaseState.h
1.78 kB
| // Copyright (c) 2025, Unitree Robotics Co., Ltd. | |
| // All rights reserved. | |
| inline boost::bimap<int, std::string> FSMStringMap; | |
| class BaseState | |
| { | |
| public: | |
| BaseState(int state, std::string state_string) : state_(state) | |
| { | |
| FSMStringMap.insert({state, state_string}); | |
| } | |
| virtual void enter() {} | |
| virtual void pre_run() {} | |
| virtual void run() {} | |
| virtual void post_run() {} | |
| virtual void exit() {} | |
| std::string getStateString() { return FSMStringMap.left.at(state_); } | |
| int getState() {return state_; } | |
| bool isState(int state) { return state_ == state; } | |
| std::vector<std::pair<std::function<bool()>, int>> registered_checks; | |
| private: | |
| int state_; | |
| }; | |
| using FsmFactory = std::function<std::shared_ptr<BaseState>(int, std::string)>; | |
| using FsmMap = std::unordered_map<std::string, FsmFactory>; | |
| inline FsmMap& getFsmMap() { | |
| static FsmMap fsmMap; | |
| return fsmMap; | |
| } | |