Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lfr_state_machine.h 969B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <lfr.h>
  5. #include <lfr_socket.h>
  6. #include <uart_communication.h>
  7. #include "lfr_state_interface.h"
  8. #include "lfr_states.h"
  9. class LFR_StateMachine
  10. {
  11. LFR_IState* currentState;
  12. const int thresholdBinary = 140;
  13. const int videoHeight = 720;
  14. const int videoWidth = 1280;
  15. const int gaussKernelSize = 11;
  16. const double maxSpeed = 0.20;
  17. std::mutex mutex;
  18. LFR autonomousMode;
  19. LFR_UART uartCommunicator;
  20. LFR_Socket socket;
  21. std::mutex imgMutex;
  22. Mat image;
  23. vector<string> split (string s, string delimiter) const;
  24. void sanitize (string& s) const;
  25. bool checkStringValidity (const std::vector<std::string>& s) const;
  26. void parseString(string s);
  27. public:
  28. void enterAutonomous();
  29. void exitAutonomous();
  30. LFR_StateMachine();
  31. inline LFR_IState* getCurrentState() const {return currentState;}
  32. void setState(LFR_IState& newState);
  33. };