123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- #pragma once
- #include "../common/comm.h"
- #include "../common/notifier.h"
- #include "../common/sensor_socket.h"
- #include <thread>
- #include <mutex>
- class CEgoWindow;
- class CMessageQueue;
- //表示传感器数据
- enum Sensor_Collection
- {
- 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);
- bool _automous = true;
- 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;
- /*
- bool _er_enabling = false;
- bool _er_motoring = false;
- bool _er_gear = false;
- bool _er_turnl = false;
- bool _er_turnr = false;
- bool _F1 = false;
- bool _F2 = false;
- bool _F3 = false;
- bool _F4 = false;
- bool _R1 = false;
- bool _R2 = false;
- bool _R3 = false;
- bool _R4 = false;
- bool _N1 = false;
- bool _N2 = false;
- bool _N3 = false;
- bool _N4 = false;
- bool _keycc = false;
- bool _keyC = false;
- bool _keyR = false;
- bool _switchF = false;
- bool _switchR = false;
- bool _startup=false;
- bool _horn = false; //喇叭
- bool _emergeny=false; //急停
- bool _colddown = false; //冷却
- bool _firewarning = false;
- bool _hyp = false; //液压使能
- bool _flight = false;
- bool _blight = false;
- bool _beamlight = false;
- bool _nearlight = false;
- bool _smalllight = false;
- bool _leftturn = false;
- bool _rightturn = false;
- bool _louver_open = false;
- bool _louver_close = false;
- bool _lock_on_off = false; //锁销
- bool _jar_on_off = false; //敲罐
- bool _park_lift = false;
- bool _chain_lift = false;
- bool _enabling = false;
- bool _emergency = false;
- bool _resume=false;
- int16_t _gear = 1;
- int16_t _accel = 0;
- int16_t _steer = 0;
- int16_t _flip = 0;
- int16_t _armL = 0;
- int16_t _armR = 0;
- */
- cannet_frame frames[8];
- 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;
- };
-
|