c2_uart_driver.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef C2_UART_DRIVER_H_
  2. #define C2_UART_DRIVER_H_
  3. #include <free_lidar/lidar_struct.h>
  4. #include <free_lidar/lidar_driver.h>
  5. #include <serial/serial.h>
  6. #include <string>
  7. #include <deque>
  8. #include <stdint.h>
  9. #define C2_UART_ROS_VER "2.00.00.008"
  10. const uint32_t baudrate[3] = {460800, 921600, 1500000};
  11. namespace free_optics{
  12. class C2UartDriver : public LidarDriver
  13. {
  14. public:
  15. C2UartDriver();
  16. ~C2UartDriver();
  17. bool connect(const std::string portname);
  18. void disconnect();
  19. bool getBaudrate();
  20. bool getDeviceState(uint8_t &state);
  21. bool getDeviceName(std::string &name);
  22. bool getFirmwareVersion(uint32_t &version);
  23. bool getSerialNumber(uint32_t &sn);
  24. bool login(uint8_t &state);
  25. bool getScanAngle(int32_t &start_angle, int32_t &stop_angle);
  26. bool setScanAngle(int32_t start_angle, int32_t stop_angle);
  27. bool setScanConfig(uint16_t frequency, uint16_t resolution);
  28. bool getMeasureRange(float &range_min, float &range_max);
  29. bool getScanData(uint8_t state);
  30. bool scanDataReceiver();
  31. private:
  32. serial::Serial sp_;
  33. };
  34. }
  35. #endif