jhu-dvrk / dvrk-ros

daVinci Research Kit ROS stack. See dVRK wiki to get started: https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki
https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki
Other
100 stars 80 forks source link

Setting up gscam in ROS #31

Closed Cartucho closed 5 years ago

Cartucho commented 5 years ago

I am using a Blackmagic DeckLink Duo 2 video card and I was trying to get the stereo video into ROS. I am also using Ubuntu 16.04 and ROS Kinetic.

I was following the instructions provided here and I am able to get the video when I run the following command:

gst-launch-1.0 decklinkvideosrc device-number=0 ! videoconvert ! autovideosink

So the drivers are working fine.

To get the video into ROS I tried to follow the following instructions:

gscam

gscam is a ROS node using the gstreamer library. The gstreamer library supports a few frame grabbers including the Hauppage one. The gstreamer developement library can be installed using apt-get install. Make sure you install gstreamer 1.0, not 0.1.

Important note: gscam binaries provided with ROS kinetic use gstreamer 0.1 so you should not install these using apt. Instead, download the source from github and compile in your catkin workspace. See https://github.com/ros-drivers/gscam. As of March 2018, the readme on gscam/github are a bit confusing since they still indicate that gstreamer 1.x support is experimental but they provide instructions to compile with gstreamer 1.x. So, make sure you compile for 1.x version.

ROS Ubuntu packages

Use apt install to install gscam! The package name should be ros-<distro>-gscam. It will install all the required dependencies for you.

Manual compilation

This is not recommended anymore, there are now ROS packages for gstreamer, just use them!

However, this instructions are a bit confusing. I guess I only need to run the following command:

sudo apt-get install ros-kinetic-gscam

Is this correct?

Cartucho commented 5 years ago

I tried that. However when I run the following command:

roslaunch dvrk_robot gscam_decklink_stereo.launch rig_name:=jhu_daVinci

I get the following error:

image

adeguet1 commented 5 years ago

I updated the video.md in the devel branch: https://github.com/jhu-dvrk/dvrk-ros/blob/devel/dvrk_robot/video.md#gscam

It seems that gscam on 16.04 still uses the old streamer so you will have to compile gscam in your workspace. I would recommend you remove the apt installed gscam as well as the gstreamer 0.1 packages that might have been installed with it.

To figure out which gstreamer was likely installed with gscam, I used:

~$ apt-cache showpkg ros-kinetic-gscam 
Package: ros-kinetic-gscam
Versions: 
0.2.0-0xenial-20190320-144244-0800 (/var/lib/apt/lists/packages.ros.org_ros_ubuntu_dists_xenial_main_binary-amd64_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/packages.ros.org_ros_ubuntu_dists_xenial_main_binary-amd64_Packages
                  MD5: da470009252921be5c95044e8548f73f
 Description Language: 
                 File: /var/lib/apt/lists/packages.ros.org_ros_ubuntu_dists_xenial_main_binary-i386_Packages
                  MD5: da470009252921be5c95044e8548f73f

Reverse Depends: 
  ros-kinetic-ps4eye,ros-kinetic-gscam
  ros-kinetic-gscam:i386,ros-kinetic-gscam
Dependencies: 
0.2.0-0xenial-20190320-144244-0800 - libboost-system1.58.0 (0 (null)) libboost-thread1.58.0 (0 (null)) libc6 (2 2.14) libconsole-bridge0.2v5 (0 (null)) libgcc1 (2 1:3.0) libglib2.0-0 (2 2.16.0) libgstreamer-plugins-base0.10-0 (2 0.10.22) libgstreamer0.10-0 (2 0.10.31) libstdc++6 (2 5.2) ros-kinetic-camera-calibration-parsers (0 (null)) ros-kinetic-camera-info-manager (0 (null)) ros-kinetic-cv-bridge (0 (null)) ros-kinetic-image-transport (0 (null)) ros-kinetic-nodelet (0 (null)) ros-kinetic-roscpp (0 (null)) ros-kinetic-sensor-msgs (0 (null)) ros-kinetic-gscam:i386 (32 (null)) 
Provides: 
0.2.0-0xenial-20190320-144244-0800 - 
Reverse Provides: 
Cartucho commented 5 years ago

It worked:

image

For Ubuntu 16.04 using Kinetic:

  1. install blackmagic decklink duo drivers (in specific, we used Blackmagic_Desktop_Video_Linux_10.10)
  2. sudo apt install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
  3. sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev
  4. manual build:
    cd ~/catkin_ws/src
    git clone https://github.com/ros-drivers/gscam
    cd ..
    catkin build
adeguet1 commented 5 years ago

I'm glad I could help. I updated the video.md file to add your comment re. adding development libraries.