ControlSensor.h 886 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include <thread>
  3. #include "../common/sensor_socket.h"
  4. class CThreadWindow;
  5. enum Sensor_Collection:int32_t
  6. {
  7. Sensor_None = 0x0,
  8. Sensor_Task = 0x1,
  9. Sensor_Left = 0x2,
  10. Sensor_Right = 0x4,
  11. Sensor_All = 0x7
  12. };
  13. enum OpSide
  14. {
  15. Empty,
  16. Arm,
  17. Bucket
  18. };
  19. class CControlSensor
  20. {
  21. public:
  22. CControlSensor(CThreadWindow* dlg);
  23. void Start();
  24. void Stop();
  25. void Notify(int8_t* buffer, int32_t size);
  26. void SetSensorSocket(SensorSocket<CControlSensor>* can);
  27. private:
  28. bool OnSignal(int8_t* data);
  29. bool OnLeftJoyStick(int8_t* data);
  30. bool OnRightJoyStick(int8_t * data);
  31. private:
  32. std::thread _thread;
  33. bool _run;
  34. CThreadWindow* _window;
  35. int32_t _steer;
  36. int32_t _arm;
  37. int32_t _bucket;
  38. int32_t _brake;
  39. int32_t _throttle;
  40. Sensor_Collection _collection;
  41. bool _bootstrap;
  42. bool _startup;
  43. bool _emergeny; //¼±Í£
  44. bool _resume;
  45. RemoNet::Gears _gear;
  46. OpSide _side;
  47. };