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

Catkin_make on a Raspberry Pi 4 gives error with ros-i2cpwmboard

asked 2021-02-08 10:43:28 -0500

RobotHunter gravatar image

This is a follow up from my previous question, about geometry_msgs not being found in catkin_ws, after I had installed ROS Noetic on a Raspberry Pi 4 Model B. The previous thread can be found here

I was able to get geometry_msgs by downloading common_msgs from the ROS Github page - though for some reason I couldn't download only the geometry_msgs folder and had to download the entire common_msgs package. However, catkin_make still does not work. I added geometry_msgs to the dependencies in the package.xml folder for the ros-i2cpwmboard package, and to the two lines in the CMakeList.txt for that package (which lines are specified in the previous thread). I end up getting this error:

/home/pi/catkin_ws/src/ros-i2cpwmboard/src/i2cpwm_controller.cpp:422:15:
error: ‘i2c_smbus_read_byte_data’ was not declared in this scope
     oldmode = i2c_smbus_read_byte_data (_controller_io_handle, __MODE1);
               ^~~~~~~~~~~~~~~~~~~~~~~~

I looked at a similar thread with Opencv, but I don't think that thread applies to this package. Anyone know what could be the problem?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2021-02-09 12:58:02 -0500

RobotHunter gravatar image

updated 2021-02-10 02:33:56 -0500

gvdhoorn gravatar image

I was able to fix this using the solution found here


Edit: Right, sorry about that. The solution comes from a user named Louise Radtke.

"At first, I installed libi2c-dev. Then, I added i2c into line 22 of src/ros-i2cpwmboard/CMakeLists.txt, so that it looks like:

target_link_libraries(i2cpwm_board ${catkin_LIBRARIES} i2c)

And as mentioned in this post from Nvidia Devtalk, I added

extern "C" {
    #include <i2c/smbus.h>
}

to src/ros-i2cpwmboard/src/i2cpwm_controller.cpp. Now it's fine. :) I am using Ubuntu 18.04."

Specifically, I added the extern C function at line 268, above the line #define MAX_BOARDS 62

edit flag offensive delete link more

Comments

1

Please don't post link-only answers.

Copy the relevant parts into your answer here using quotes.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-09 13:10:41 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-02-08 10:43:28 -0500

Seen: 545 times

Last updated: Feb 10 '21