1
$\begingroup$

I bought a LiDAR D4 on AliExpress and received a package from the buyer with a driver for ROS2. Unfortunately, I get the following errors when calling colcon build:

colcon build --symlink-install
Starting >>> cspc_lidar
--- stderr: cspc_lidar                             
** WARNING ** io features related to pcap will be disabled
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp: In member function ‘void Point_cloud_optimize::PointCloudFilter(LaserScan*)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:25:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   25 |         for (i0 = 0; i0 < Scan->points.size(); i0++)
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:28:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   28 |                 i1 = i1 < Scan->points.size() ? i1 : i1 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:30:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   30 |                 i2 = i2 < Scan->points.size() ? i2 : i2 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:32:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   32 |                 i3 = i3 < Scan->points.size() ? i3 : i3 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:155:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  155 |         for (i0 = 0; i0 < Scan->points.size(); i0++)
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:158:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  158 |                 i1 = i1 < Scan->points.size() ? i1 : i1 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:160:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  160 |                 i2 = i2 < Scan->points.size() ? i2 : i2 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:162:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  162 |                 i3 = i3 < Scan->points.size() ? i3 : i3 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:164:25: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  164 |                 i4 = i4 < Scan->points.size() ? i4 : i4 - Scan->points.size();
      |                      ~~~^~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp: In member function ‘int Point_cloud_optimize::UltrasonicSimRanging(LaserPoint&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:228:13: warning: unused variable ‘i’ [-Wunused-variable]
  228 |         int i, index;
      |             ^
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:229:15: warning: unused variable ‘tempdep’ [-Wunused-variable]
  229 |         short tempdep;
      |               ^~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:253:1: warning: no return statement in function returning non-void [-Wreturn-type]
  253 | }
      | ^
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp: In member function ‘void Point_cloud_optimize::lidar_blocked_judge(int)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:341:60: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  341 |                 printf("lidar 雷达被严重遮挡百分之七十 %d,%d\n",node_lidar.lidar_block.lidar_zero_count,node_lidar.scan_node_count);
      |                                                           ~^                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                            |                                                       |
      |                                                            int                                                     size_t {aka long unsigned int}
      |                                                           %ld
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp: In member function ‘void Point_cloud_optimize::lidar_blocked_init()’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:404:69: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
  404 |                         if((angle >= 0 && angle < 90)|| angle > 270 && angle <=360){
      |                                                         ~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/point_cloud_optimize.cpp:375:21: warning: unused variable ‘temp’ [-Wunused-variable]
  375 |         float r, d, temp;
      |                     ^~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp: In function ‘void flushSerial()’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:53:24: warning: unused variable ‘bytes_read’ [-Wunused-variable]
   53 |                 size_t bytes_read = node_lidar.serial_port->read_data(buffer, len);
      |                        ^~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp: In function ‘bool lidar_state_judgment()’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:86:45: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
   86 |                 printf("状态异常重新启动 %lld\n",lidar_status_time);
      |                                          ~~~^    ~~~~~~~~~~~~~~~~~
      |                                             |    |
      |                                             |    uint64_t {aka long unsigned int}
      |                                             long long int
      |                                          %ld
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:62:21: warning: unused variable ‘status_judge’ [-Wunused-variable]
   62 |         static bool status_judge = false;     //整体状态判断
      |                     ^~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:65:21: warning: variable ‘lidar_start_flag’ set but not used [-Wunused-but-set-variable]
   65 |         static bool lidar_start_flag = false; //下发雷达启动指令后的雷达反馈标志
      |                     ^~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp: In function ‘int read_forever()’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:200:82: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  200 |                                                         printf("full----- count=%d,time=%lld\n",scan_count,current_times());
      |                                                                                 ~^              ~~~~~~~~~~
      |                                                                                  |              |
      |                                                                                  int            size_t {aka long unsigned int}
      |                                                                                 %ld
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:200:92: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
  200 |                                                         printf("full----- count=%d,time=%lld\n",scan_count,current_times());
      |                                                                                         ~~~^               ~~~~~~~~~~~~~~~
      |                                                                                            |                            |
      |                                                                                            long long int                int64_t {aka long int}
      |                                                                                         %ld
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp: In member function ‘result_t Lidar_Data_Processing::waitSpeedRight(uint8_t, uint64_t)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:94:56: warning: unused parameter ‘cmd’ [-Wunused-parameter]
   94 | result_t Lidar_Data_Processing::waitSpeedRight(uint8_t cmd,uint64_t timeout)
      |                                                ~~~~~~~~^~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp: In member function ‘result_t Lidar_Data_Processing::waitResponseHeader(uint8_t, uint64_t)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:366:28: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘long unsigned int’} [-Wformat=]
  366 |       printf("data**%d,%d,%d\n",check_sum_cal,recvBuffer[remainSize-1],remainSize);
      |                           ~^                                           ~~~~~~~~~~
      |                            |                                           |
      |                            int                                         size_t {aka long unsigned int}
      |                           %ld
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp: In member function ‘result_t Lidar_Data_Processing::waitPackage_coin(node_info*, uint32_t)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:858:9: warning: unused variable ‘k’ [-Wunused-variable]
  858 |     int k;
      |         ^
In file included from /home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp:12:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.h: In constructor ‘Serial_Port::Serial_Port(const string&, uint32_t, Timeout, bytesize_t, parity_t, stopbits_t, flowcontrol_t)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.h:102:14: warning: ‘Serial_Port::bytesize_’ will be initialized after [-Wreorder]
  102 |   bytesize_t bytesize_;       // Size of the bytes
      |              ^~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.h:101:12: warning:   ‘parity_t Serial_Port::parity_’ [-Wreorder]
  101 |   parity_t parity_;           // Parity
      |            ^~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp:31:1: warning:   when initialized here [-Wreorder]
   31 | Serial_Port::Serial_Port(const string &port, uint32_t baudrate, Timeout timeout,
      | ^~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:758:11: warning: variable ‘AngleCorrectForDistance’ set but not used [-Wunused-but-set-variable]
  758 |   int32_t AngleCorrectForDistance = 0;
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:760:11: warning: unused variable ‘package_type’ [-Wunused-variable]
  760 |   uint8_t package_type = 0;
      |           ^~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:762:12: warning: unused variable ‘start’ [-Wunused-variable]
  762 |   uint16_t start;
      |            ^~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_data_processing.cpp:763:12: warning: unused variable ‘stop’ [-Wunused-variable]
  763 |   uint16_t stop;
      |            ^~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp: In member function ‘bool Serial_Port::setBaudrate(long unsigned int)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp:578:11: warning: unused variable ‘new_baud’ [-Wunused-variable]
  578 |   speed_t new_baud = static_cast<speed_t>(baudrate);
      |           ^~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp: In member function ‘bool Serial_Port::setCustomBaudRate(long unsigned int)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/serial_port.cpp:571:1: warning: control reaches end of non-void function [-Wreturn-type]
  571 | }
      | ^
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp: At global scope:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/node_lidar.cpp:62:21: warning: ‘status_judge’ defined but not used [-Wunused-variable]
   62 |         static bool status_judge = false;     //整体状态判断
      |                     ^~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘void pcloud_build_by_scan(LaserScan&, pcloud_t&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:44:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<LaserPoint>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   44 |   for (int i = 0; i < outscan.points.size(); i++)
      |                   ~~^~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:46:11: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘point_t’ {aka ‘struct _point_’}; use assignment or value-initialization instead [-Wclass-memaccess]
   46 |     memset(&point, 0, sizeof(point_t));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:8:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.h:52:16: note: ‘point_t’ {aka ‘struct _point_’} declared here
   52 | typedef struct _point_
      |                ^~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘int find_index(point_t, pcloud_t&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:105:9: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘point_t’ {aka ‘struct _point_’}; use assignment or value-initialization instead [-Wclass-memaccess]
  105 |   memset(&point_min, 0, sizeof(point_t));
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:8:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.h:52:16: note: ‘point_t’ {aka ‘struct _point_’} declared here
   52 | typedef struct _point_
      |                ^~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:124:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  124 |   if (point_min.index > pcloud.data.size())
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘bool intersect(LineSegment, LineSegment, Vector2D&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:167:10: warning: unused variable ‘cross1’ [-Wunused-variable]
  167 |   double cross1 = position1.x * direction1.y - position1.y * direction1.x;
      |          ^~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘double pointToLineDist(point_t, double, double)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:439:10: warning: unused variable ‘y0’ [-Wunused-variable]
  439 |   double y0 = k * x0 + b;
      |          ^~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘bool line_judgment(std::vector<_point_>, point_t)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:462:19: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  462 |   if (line.size() <= reference)
      |       ~~~~~~~~~~~~^~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:467:19: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  467 |   if (line.size() <= reference)
      |       ~~~~~~~~~~~~^~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:471:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  471 |     for (int i = 1; i < line.size() - 1; i++)
      |                     ~~^~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘void fitting_line(pcloud_t&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:542:25: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  542 |         if (line.size() >= calibration_params.line_judgment_point_num)
      |             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:560:63: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  560 |         if(point.index == point_last_one.index && line.size() >= calibration_params.line_judgment_point_num)
      |                                                   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:571:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  571 |   if(point_record2.index < pcloud.data.size()
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:572:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  572 |   &&  point_last_one.index < pcloud.data.size()
      |       ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:573:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  573 |   &&  point_record1.index < pcloud.data.size())
      |       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:597:28: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  597 |     if (line_append.size() >= calibration_params.line_judgment_point_num)
      |         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:606:29: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  606 |             if (line.size() >= calibration_params.line_judgment_point_num)
      |                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:617:68: warning: comparison of integer expressions of different signedness: ‘std::vector<_point_>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
  617 |           if(point.index == point_append_last.index && line.size() >= calibration_params.line_judgment_point_num)
      |                                                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:632:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::vector<_point_> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  632 |     for (int i = 0; i < lines.size() - 1; i++)
      |                     ~~^~~~~~~~~~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp: In function ‘void lidar_calibration(LaserScan&)’:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:662:11: warning: ‘void* memset(void*, int, size_t)’ clearing an object of type ‘struct LaserPoint’ with no trivial copy-assignment; use assignment or value-initialization instead [-Wclass-memaccess]
  662 |     memset(&outscan_point, 0, sizeof(LaserPoint));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.h:4,
                 from /home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/calibration.cpp:8:
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/sdk/lidar_information.h:210:8: note: ‘struct LaserPoint’ declared here
  210 | struct LaserPoint
      |        ^~~~~~~~~~
/home/przemek/ldlidar_ros_ws/src/cspc_lidar_sdk_ros2_D4_1110/src/node_lidar_ros.cpp:11:10: fatal error: pcl_conversions/pcl_conversions.h: Nie ma takiego pliku ani katalogu
   11 | #include <pcl_conversions/pcl_conversions.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/cspc_lidar.dir/build.make:174: CMakeFiles/cspc_lidar.dir/src/node_lidar_ros.cpp.o] Błąd 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/cspc_lidar.dir/all] Błąd 2
gmake: *** [Makefile:146: all] Błąd 2
---
Failed   <<< cspc_lidar [5.17s, exited with code 2]

Summary: 0 packages finished [5.45s]
  1 package failed: cspc_lidar
  1 package had stderr output: cspc_lidar

As far as I can see the biggest one is missing pcl_conversions/pcl_conversions.h. In my case, the ros-humble-pcl-conversions and libpcl-dev are installed and up to date. I also tried adding the following line to CMakeLists.txt: set(PCL_DIR "/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake")

leading directly to PCL Conversions, but it didn't change anything. This is my CMakeLists.txt file:

cmake_minimum_required(VERSION 3.5)

project(cspc_lidar)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

set(PCL_DIR "/usr/lib/x86_64-linux-gnu/cmake/pcl/PCLConfig.cmake")

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(PCL 1.12 REQUIRED)
#find_package(rosidl_default_generators REQUIRED)

include_directories(
  ${PROJECT_SOURCE_DIR}/include/cspc_lidar
  ${PROJECT_SOURCE_DIR}/sdk
  ${PCL_INCLUDE_DIRS}
)

link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})


add_executable(cspc_lidar sdk/mtime.cpp sdk/node_lidar.cpp sdk/serial_port.cpp sdk/timer.cpp sdk/lidar_data_processing.cpp sdk/point_cloud_optimize.cpp sdk/calibration.cpp src/node_lidar_ros.cpp)

ament_target_dependencies(cspc_lidar
  "rclcpp"
  "sensor_msgs"
  "visualization_msgs"
  "geometry_msgs"
)

install(TARGETS
  cspc_lidar
  DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY launch params
  DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package()

I don't know what to do anymore, I would appreciate your help

$\endgroup$

1 Answer 1

0
$\begingroup$

from your CMakeLists.txt I can see that there's nofind_package(pcl_conversions) This also needs to be set as a dependency for your executable. Like so:

ament_target_dependencies(cspc_lidar
  rclcpp
  sensor_msgs
  visualization_msgs
  geometry_msgs
  pcl_conversions
)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.