control_sensor.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #pragma once
  2. #include "../common/comm.h"
  3. #include "../common/notifier.h"
  4. #include "../common/sensor_socket.h"
  5. #include <thread>
  6. #include <mutex>
  7. class CEgoWindow;
  8. class CMessageQueue;
  9. enum Sensor_Collection :int32_t
  10. {
  11. Sensor_None = 0x0,
  12. Sensor_Task = 0x1,
  13. Sensor_Left = 0x2,
  14. Sensor_Right = 0x4,
  15. Sensor_All = 0x7
  16. };
  17. enum OpSide
  18. {
  19. Empty,
  20. Arm,
  21. Bucket
  22. };
  23. class CControlSensor//:public ICanNotify
  24. {
  25. public:
  26. CControlSensor(CMessageQueue * window);
  27. void Start();
  28. void Stop();
  29. void Notify(int8_t* buffer, int32_t size);
  30. void SetSensorSocket(SensorSocket<CControlSensor>* can);
  31. ControlStatus CheckStatus();
  32. void OnBootstrapd(bool ret);
  33. void OnStartupd(bool ret);
  34. private:
  35. bool OnSignal(int8_t* data);
  36. bool OnLeftJoyStick(int8_t* data);
  37. bool OnRightJoyStick(int8_t* data);
  38. private:
  39. CEgoWindow* _window;
  40. int32_t _steer;
  41. int32_t _arm;
  42. int32_t _bucket;
  43. int32_t _brake;
  44. int32_t _throttle;
  45. Sensor_Collection _collection;
  46. volatile bool _bootstrap = false;
  47. volatile bool _bootstrapd = false;
  48. volatile bool _oping = false;
  49. volatile bool _startup = false;
  50. volatile bool _startupd = false;
  51. volatile bool _emergenyd = false; //¼±Í£
  52. volatile bool _resume = false;
  53. volatile bool _resumed = false;
  54. RemoNet::Gears _gear =RemoNet::Gears::N;
  55. //OpSide _side;
  56. bool _front_on;
  57. bool _back_on;
  58. bool _wiper_on;
  59. //bool _reseted = true;
  60. bool _emergency = false;
  61. };