UbiquityRobotics / raspicam_node

ROS node for camera module of Raspberry Pi
BSD 3-Clause "New" or "Revised" License
293 stars 162 forks source link

Compilation for Ubuntu 18.04.4 LTS #93

Open pryre opened 4 years ago

pryre commented 4 years ago

Not sure on the priority, but I have managed to get a running copy of raspicam_node on the new Ubuntu 18.04.4 LTS release using ROS melodic. Everything seems to be working as expected (except I haven't actually opened an image_view as I have to run headless for the time being).

The primary problem was a linking issue, similar to this. Compiling in catkin_ws gave a binary with the following linking (and some strange compiler warnings):

$ ldd raspicam_node | grep mmal
    libmmal.so => /opt/vc/lib/libmmal.so (0xb6b82000)
    libmmal_core.so => /opt/vc/lib/libmmal_core.so (0xb6b66000)
    libmmal_util.so => /opt/vc/lib/libmmal_util.so (0xb6b48000)

Adding the following line to CMakeLists.txt fixed this issue (and removed the warnings):

SET( CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed" )

Resulting binary was is linked as:

$ ldd raspicam_node | grep mmal
    libmmal.so => /opt/vc/lib/libmmal.so (0xb53ed000)
    libmmal_core.so => /opt/vc/lib/libmmal_core.so (0xb53d1000)
    libmmal_util.so => /opt/vc/lib/libmmal_util.so (0xb53b3000)
    libmmal_vc_client.so => /opt/vc/lib/libmmal_vc_client.so (0xb5397000)

The actual issue that is referenced above is a bit complicated for me to dive into at the moment, but this fix seems to work temporarily at least. Hopefully it helps anyone passing by.


Additional info: I would recommend reading this page for getting the native Pi packages set up. I also had to add the following to /boot/firmware/config.txt to get the Pi detected (adding it to usercfg.txt did no seem to work for both RPi2 and RPi4):

start_x=1
gpu_mem=128

The result was as detected shows:

$ vcgencmd get_camera
    supported=1 detected=1
rohbotics commented 4 years ago

@pryre Thanks for opening this issue.

Seems like the link time optimizer is doing something incorrectly. Can you make a PR with the change that made it work?

Thanks!

guillermoherreraf commented 4 years ago

Hey @pryre! I've got ROS Melodic running on my RPI 4 (under Raspbian Buster). I managed to have a copy of the raspicam_node running, however when I run the tutorial.launch and afterwards I run rosrun rqt_image_view rqt_image_view there is nothing on the display... any idea what it might be?

Here is the erros message I get:

libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile

(python2:2364): GLib-GObject-WARNING **: 10:50:52.039: cannot register existing type 'GtkWidget'

(python2:2364): GLib-GObject-WARNING **: 10:50:52.039: cannot add class private field to invalid type '<invalid>'

(python2:2364): GLib-GObject-WARNING **: 10:50:52.039: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(python2:2364): GLib-GObject-CRITICAL **: 10:50:52.039: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(python2:2364): GLib-GObject-WARNING **: 10:50:52.039: cannot register existing type 'GtkBuildable'

(python2:2364): GLib-GObject-CRITICAL **: 10:50:52.040: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed

(python2:2364): GLib-CRITICAL **: 10:50:52.040: g_once_init_leave: assertion 'result != 0' failed

(python2:2364): GLib-GObject-CRITICAL **: 10:50:52.040: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed

(python2:2364): Gtk-CRITICAL **: 10:50:52.040: gtk_widget_size_request: assertion 'GTK_IS_WIDGET (widget)' failed

(python2:2364): GLib-GObject-WARNING **: 10:50:52.040: cannot register existing type 'GtkWidget'

(python2:2364): GLib-GObject-WARNING **: 10:50:52.040: cannot add class private field to invalid type '<invalid>'

(python2:2364): GLib-GObject-WARNING **: 10:50:52.040: cannot add private field to invalid (non-instantiatable) type '<invalid>'

(python2:2364): GLib-GObject-CRITICAL **: 10:50:52.040: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
Corrupt JPEG data: 32793 extraneous bytes before marker 0xd9
bltDefender commented 4 years ago

@pryre @GuillermoHerreraF how did you manage to get it running under 18.04.4? I cannot build cause libraspberrypi0 is missing. Any hint welcome, I'm stuck.

ChrisTayl2018 commented 4 years ago

I am having problems building this from src on Ubuntu Server 16.04 as well as it is unable to locate libraspberrypi-dev or libraspberrypi0. Also looking for any suggestions?

robo1@robuntudev:~/catkin_ws$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y executing command [sudo -H apt-get install -y libraspberrypi-dev] Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package libraspberrypi-dev ERROR: the following rosdeps failed to install apt: command [sudo -H apt-get install -y libraspberrypi-dev] failed

guillermoherreraf commented 4 years ago

@bltDefender I changed to the usb_cam node. I could not manage to make the raspicam_node work with my system configuration. http://wiki.ros.org/usb_cam