Git Product home page Git Product logo

Comments (3)

xiaoliangstd avatar xiaoliangstd commented on July 21, 2024 2

你好,我的建议是直接新建一个FSM,在一个专门的FSM状态机里测试您的功能,您这样的写法相当于重写了一个main.cpp了,这是我们不推荐的。您可以参考State_SwingTest.cpp 和 State_SwingTest.h 新建一个类似的用于测试您上述功能的状态机。

from unitree_guide.

Alleneeous avatar Alleneeous commented on July 21, 2024

也就是说重新创建State_x.cpp和State_x.h,添加一个新的状态机模块,设置好启动该状态机的键位,再用jounir_ctrl打开自定义的状态机,这样理解正确吗?

from unitree_guide.

xiaoliangstd avatar xiaoliangstd commented on July 21, 2024

是的,这样做的好处是 您就可以把主要的精力放于想要实现的功能上了,先实现您的功能剩下的事情就好办了。你上述问题没有响应需要参考下
1.
while(running){
ctrlFrame.run();
}
2.
void FSM::run(){
_startTime = getSystemTime();
_ctrlComp->sendRecv();
_ctrlComp->runWaveGen();
_ctrlComp->estimator->run();
if(!checkSafty()){
_ctrlComp->ioInter->setPassive();
}

if(_mode == FSMMode::NORMAL){
    _currentState->run();
    _nextStateName = _currentState->checkChange();
    if(_nextStateName != _currentState->_stateName){
        _mode = FSMMode::CHANGE;
        _nextState = getNextState(_nextStateName);
        std::cout << "Switched from " << _currentState->_stateNameString
                  << " to " << _nextState->_stateNameString << std::endl;
    }
}
else if(_mode == FSMMode::CHANGE){
    _currentState->exit();
    _currentState = _nextState;
    _currentState->enter();
    _mode = FSMMode::NORMAL;
    _currentState->run();
}

absoluteWait(_startTime, (long long)(_ctrlComp->dt * 1000000));

}

FSM Class 相当于一个状态机管理器,管理这FSM文件夹里的状态机。

from unitree_guide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.