ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

When trying to catkin_make the catkin_ws folder i get the following output:

asked 2022-05-24 02:08:02 -0500

achrjabo27 gravatar image

updated 2022-05-25 01:33:54 -0500

Joe28965 gravatar image

The error:

[ 33%] Building CXX object rplidar_ros/CMakeFiles/rplidarNode.dir/sdk/src/rplidar_driver.cpp.o
[ 33%] Built target rplidarNodeClient
/home/ubuntu/catkin_ws/src/rplidar_ros/sdk/src/rplidar_driver.cpp: In member function ‘virtual u_result rp::standalone::rplidar::RPlidarDriverImplCommon::grabScanData(rplidar_response_measurement_node_t*, size_t&, _u32)’:
/home/ubuntu/catkin_ws/src/rplidar_ros/sdk/src/rplidar_driver.cpp:1704:26: error: narrowing conversion of ‘rp::hal::Event::EVENT_TIMEOUT’ from ‘int’ to ‘long unsigned int’ [-Wnarrowing]
 1704 |     case rp::hal::Event::EVENT_TIMEOUT:
      |                          ^~~~~~~~~~~~~
/home/ubuntu/catkin_ws/src/rplidar_ros/sdk/src/rplidar_driver.cpp: In member function ‘virtual u_result rp::standalone::rplidar::RPlidarDriverImplCommon::grabScanDataHq(rplidar_response_measurement_node_hq_t*, size_t&, _u32)’:
/home/ubuntu/catkin_ws/src/rplidar_ros/sdk/src/rplidar_driver.cpp:1733:26: error: narrowing conversion of ‘rp::hal::Event::EVENT_TIMEOUT’ from ‘int’ to ‘long unsigned int’ [-Wnarrowing]
 1733 |     case rp::hal::Event::EVENT_TIMEOUT:
      |                          ^~~~~~~~~~~~~
make[2]: *** [rplidar_ros/CMakeFiles/rplidarNode.dir/build.make:147 : rplidar_ros/CMakeFiles/rplidarNode.dir/sdk/src/rplidar_driver.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:1070 : rplidar_ros/CMakeFiles/rplidarNode.dir/all] Erreur 2
make: *** [Makefile:160 : all] Erreur 2
Invoking "make -j4 -l4" failed
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-05-24 23:02:16 -0500

qilin_gundamenjoyer gravatar image

Within the file rplidar_driver.cpp, there is an error concerning the message type. The error compile error with the data type of the message within the rplidar_driver.cpp file.

error: narrowing conversion of ‘rp::hal::Event::EVENT_TIMEOUT’ from ‘int’ to ‘long unsigned int’

The error states that the conversion from int, which is declared as a 8-bit unsigned integer (UInt8) by default, to long unsigned int. Correct me if I'm wrong, the error manifested probably because of data being exchanged in between CPP and Python and the number initialized/inputted.

Solution #1: Ensure that the integer inputted/initialized is within the scope of UInt8, ranging from 0 to 256 (2^8). If it's not within that range, ROS message will compute an unpredictable value and end up being a hard-to-find value after compiling.

Solution #2: Ensure that the serialization of the data type matches ROS and the corresponding programming language. Scroll down to Section 2.1.1: Field Types @ http://wiki.ros.org/msg

Solution #3: If self-implemented message types are included in your build, ensure that you have run catkin_make prior to building your project with catkin_make since the self-implemented message types have to be compiled to a language-specific implementation. Otherwise, CPP won't know where to locate the file, let alone compile it.

Solution #4: A classic mistake is that the bash isn't source properly. Ensure that you have "source /opt/ros/noetic/setup.bash" as your pathway. You can check this by typing .nano ~/bash. If it's not, rewrite it to it. An alternative way is to type gedit ~/.bashrc instead. Scroll all the way down and edit the line that has the starting word "source .... ". Save and Exit!

~FIN!

edit flag offensive delete link more

Question Tools

Stats

Asked: 2022-05-24 02:08:02 -0500

Seen: 176 times

Last updated: May 25 '22