123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #pragma once
- #include "../common/comm.h"
- #include "../common/notifier.h"
- #include "../common/sensor_socket.h"
- #include <thread>
- #include <mutex>
- #include <algorithm>
- #include <string>
- #include "EgoClient.h"
- #include "PCANBasic.h"
- class CEgoWindow;
- class CMessageQueue;
- /*
- 舱端车辆控制
- 软件接收下发指令到车端
- */
- enum Sensor_Collection :int32_t
- {
- //发送给下位机的Pcan地址
- Sensor_None = 0x0,
- Sensor_181 = 0x1, //0x181
- Sensor_182 = 0x2, //0x182
- Sensor_183 = 0x4, //0x183
- Sensor_184 = 0x8, //0x184
- //Sensor_All = 0xF
- Sensor_185 = 0x10, //0x185
- Sensor_All = 0x1F
- /*
- Sensor_None = 0x0,
- Sensor_ER = 0x1, //0x181
- Sensor_Steer = 0x2, //0x185
- Sensor_Signal = 0x4, //0x281
- Sensor_Drive = 0x8, //0x381
- Sensor_Arm =0x10 ,//0x481
- //Sensor_Switch=0x20,
- Sensor_All = 0x1F
- */
- };
- enum OpSide
- {
- Empty,
- Arm,
- Bucket
- };
- class CControlSensor
- {
- public:
- CControlSensor(CMessageQueue * window);
- bool Start();
- void Stop();
- void Notify(TPCANMsg& canmsg,uint64_t timestamp);
- void SetEngineRPM(int32_t rpm);
- ControlStatus CheckStatus();
- TPCANStatus SendCANMessage(TPCANMsg* CANMsg);
- private:
- void Run();
- TPCANStatus ReadMessage();
- //TPCANStatus ReadMessageFD();
- void ReadMessages();
- private:
-
- CEgoWindow* _window;
-
- Sensor_Collection _collection;
-
- TPCANHandle _handle=-1;
- bool _isFD;
- std::thread _thread;
- bool _run;
- int16_t _last_speed = 0xF000;
- int64_t _startup = 0;
- int32_t _rpm = 0;
-
- cannet_frame frames[6];
- int32_t _old_steer = 0;
- uint64_t _old_timestamp = 0;
- bool isFront = false;
- bool isSliping = false;
- bool _remote_active = false;
- uint64_t _active_tick = 0;
-
-
-
- };
-
|