quadruped_ros2_control/controllers/unitree_guide_controller/src/FSM/StateFixedStand.cpp

29 lines
651 B
C++
Raw Normal View History

//
// Created by biao on 24-9-10.
//
#include <unitree_guide_controller/FSM/StateFixedStand.h>
StateFixedStand::StateFixedStand(CtrlComponent ctrlComp): FSMState(
FSMStateName::FIXEDSTAND, "fixed stand", std::move(ctrlComp)) {
}
void StateFixedStand::enter() {
2024-09-11 14:01:07 +08:00
for (int i = 0; i < 12; i++) {
ctrlComp_.joint_position_command_interface_[i].get().set_value(start_pos_[i]);
}
}
void StateFixedStand::run() {
}
void StateFixedStand::exit() {
}
FSMStateName StateFixedStand::checkChange() {
2024-09-11 14:01:07 +08:00
if (ctrlComp_.control_inputs_.get().command == 1) {
return FSMStateName::PASSIVE;
}
return FSMStateName::FIXEDSTAND;
}