Line-Following-Robot/lfr_states.cpp

52 lines
1008 B
C++
Raw Normal View History

2023-01-16 03:34:25 +01:00
#include "lfr_states.h"
void State::Idle::enter(LFR_StateMachine* stateMachine)
{
}
void State::Idle::exit(LFR_StateMachine* stateMachine)
{
}
LFR_IState& State::Idle::getInstance()
{
static State::Idle singleton;
return singleton;
}
void State::Autonomous::enter(LFR_StateMachine* stateMachine)
{
2023-01-16 06:37:39 +01:00
std::cout << "enter autonomous mode" << std::endl;
stateMachine->enterAutonomous();
2023-01-16 03:34:25 +01:00
}
void State::Autonomous::exit(LFR_StateMachine* stateMachine)
{
2023-01-16 06:37:39 +01:00
std::cout << "exit autonomous mode" << std::endl;
stateMachine->exitAutonomous();
2023-01-16 03:34:25 +01:00
}
LFR_IState& State::Autonomous::getInstance()
{
static State::Autonomous singleton;
return singleton;
}
void State::Manual::enter(LFR_StateMachine* stateMachine)
{
2023-01-16 06:37:39 +01:00
std::cout << "enter manual mode" << std::endl;
2023-01-16 03:34:25 +01:00
}
void State::Manual::exit(LFR_StateMachine* stateMachine)
{
2023-01-16 06:37:39 +01:00
std::cout << "exit manual mode" << std::endl;
2023-01-16 03:34:25 +01:00
}
LFR_IState& State::Manual::getInstance()
{
static State::Manual singleton;
return singleton;
}