OS & Tools/Error

[error] ROS-i2cpwmboard package error when compiled (catkin_make) on ubuntu-16.04 ROS kinetic

전두선 2020. 5. 8. 14:53

error

[100%] Built target i2cpwm_board_generate_messages_eus
Scanning dependencies of target i2cpwm_board_generate_messages
[100%] Built target i2cpwm_board_generate_messages
[100%] Built target test_pub_sub_generate_messages_eus
Scanning dependencies of target test_pub_sub_generate_messages
[100%] Built target test_pub_sub_generate_messages
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp: In function ‘void _set_pwm_frequency(int)’:
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:422:71: error: ‘i2c_smbus_read_byte_data’ was not declared in this scope
     oldmode = i2c_smbus_read_byte_data (_controller_io_handle, __MODE1);
                                                                       ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:425:79: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __MODE1, newmode)) // go to sleep
                                                                               ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:428:97: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 >  i2c_smbus_write_byte_data(_controller_io_handle, __PRESCALE, (int)(floor(prescale))))
                                                                                                 ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:431:78: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data(_controller_io_handle, __MODE1, oldmode))
                                                                              ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:436:85: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data(_controller_io_handle, __MODE1, oldmode | 0x80))
                                                                                     ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp: In function ‘void _set_pwm_interval_all(int, int)’:
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:459:96: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __ALL_CHANNELS_ON_L, start & 0xFF))
                                                                                                ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:461:96: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 >  i2c_smbus_write_byte_data (_controller_io_handle, __ALL_CHANNELS_ON_H, start  >> 8))
                                                                                                ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:463:95: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __ALL_CHANNELS_OFF_L, end & 0xFF))
                                                                                               ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:465:93: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __ALL_CHANNELS_OFF_H, end >> 8))
                                                                                             ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp: In function ‘void _set_active_board(int)’:
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:501:88: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
             if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __MODE2, __OUTDRV))
                                                                                        ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:504:89: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
             if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __MODE1, __ALLCALL))
                                                                                         ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:510:80: error: ‘i2c_smbus_read_byte_data’ was not declared in this scope
             mode1res = i2c_smbus_read_byte_data (_controller_io_handle, __MODE1);
                                                                                ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:513:88: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
             if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __MODE1, mode1res))
                                                                                        ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp: In function ‘void _set_pwm_interval(int, int, int)’:
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:555:101: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __CHANNEL_ON_L+4*channel, start & 0xFF))
                                                                                                     ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:557:101: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 >  i2c_smbus_write_byte_data (_controller_io_handle, __CHANNEL_ON_H+4*channel, start  >> 8))
                                                                                                     ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:559:100: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __CHANNEL_OFF_L+4*channel, end & 0xFF))
                                                                                                    ^
/home/jds-linux/catkin_ws/src/ros_tutorials/ros-i2cpwmboard/src/i2cpwm_controller.cpp:561:98: error: ‘i2c_smbus_write_byte_data’ was not declared in this scope
     if (0 > i2c_smbus_write_byte_data (_controller_io_handle, __CHANNEL_OFF_H+4*channel, end >> 8))
                                                                                                  ^
ros_tutorials/ros-i2cpwmboard/CMakeFiles/i2cpwm_board.dir/build.make:62: recipe for target 'ros_tutorials/ros-i2cpwmboard/CMakeFiles/i2cpwm_board.dir/src/i2cpwm_controller.cpp.o' failed
make[2]: *** [ros_tutorials/ros-i2cpwmboard/CMakeFiles/i2cpwm_board.dir/src/i2cpwm_controller.cpp.o] Error 1
CMakeFiles/Makefile2:3930: recipe for target 'ros_tutorials/ros-i2cpwmboard/CMakeFiles/i2cpwm_board.dir/all' failed
make[1]: *** [ros_tutorials/ros-i2cpwmboard/CMakeFiles/i2cpwm_board.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[100%] Linking CXX executable /home/jds-linux/catkin_ws/devel/lib/ce30c_driver/ce30_cloud
[100%] Built target ce30_cloud
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

 

 

 

i2c 모듈을 제어하기 위한 라이브러리가 설치되있지 않아서 뜨는 문제이다. 아래 명령어로 해당 패키지를 다운받음으로써 간단하게 해결가능하다.

 

$ sudo apt-get install -y libi2c-dev
1 2 3 4 5 6