NVIDIA-AI-IOT / caffe_ros

Package containing nodes for deep learning in ROS.
BSD 3-Clause "New" or "Revised" License
23 stars 15 forks source link

Creating gstreamer pipeline with nvcamerasrc. #3

Closed bpinaya closed 6 years ago

bpinaya commented 7 years ago

Hi there, me again, have you been able to launch a gscam node with a nvcamerasrc? I said this since my L4T version is low enough that I can't use the v4l2src to /dev/video0 and also, according to this site it says: "Starting on L4T R23.2 there is a /dev/video0 node to capture, however, this node will give you frames in bayer which are NOT suitable to encode because it grabs frames directly from the ov5693 camera without using the ISP." So I think using the nvcamerasrc plugin should give better results? Do you recommend for me to update my L4T and skip this issue and I think the other one I opened? If possible I wouldn't like to update yet.

bpinaya commented 7 years ago

It's ok, just updated my jetpack but I think there are some issues with the gscam launch file, when tried to run it gave the following output:

started roslaunch server http://tegra-ubuntu:38911/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.7

NODES
  /
    gscam (gscam/gscam)

auto-starting new master
process[master]: started with pid [16660]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 6b6609a6-ca39-11e7-82e2-00044b633dff
process[rosout-1]: started with pid [16673]
started core service [/rosout]
process[gscam-2]: started with pid [16680]
[FATAL] [1510773363.189379895]: Failed to PAUSE stream, check your gstreamer configuration.
[FATAL] [1510773363.189437237]: Failed to initialize gscam stream!
[gscam-2] process has finished cleanly
log file: /home/nvidia/.ros/log/6b6609a6-ca39-11e7-82e2-00044b633dff/gscam-2*.log

You are using /dev/video1 to get access to the onboard camera right? Also, I am assuming you are using the master branch of https://github.com/ros-drivers/gscam , is that correct? Any help is appreciated!!!

bpinaya commented 7 years ago

After having updated to 28.1 and tried the:

roslaunch caffe_ros gscam.launch

it launches with no errors, after a rostopic list I can even see:

/camera/camera_info
/camera/image_raw
/rosout
/rosout_agg

But there is no info being published to /camera/image_raw , I tested with:

rostopic echo /camera/image_raw

and:

rosrun image_view image_view image:=/camera/image_raw

But there is nothing there, is there something I am missing? Is this supposed to work with the onboard camera or an external webcam? I tried both, still nothing, tried dev/camera0 and 2, still nothing.

rachel-1 commented 7 years ago

Are you using the onboard camera or an external webcam? It should work with both (though it was originally designed to work with an external webcam). It is just standard gscam from the Debian package (i.e. nothing custom). Have you verified that the camera is working with your system in general? Can you view the camera image through something like Cheese, or a raw gstreamer pipeline? One thing to note is that the device should be /dev/video0 or /dev/video1. You can try ls /dev/video* to get a list of devices that might work.

bpinaya commented 7 years ago

Thanks for the reply @rachel-1 , I indeed tried with both, none of them work. Cheese opens a webcam with no problems but when launching the gscam.launch I get the following output:

started roslaunch server http://tegra-ubuntu:43666/

SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.7

NODES
  /
    gscam (gscam/gscam)

auto-starting new master
process[master]: started with pid [5217]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 8a40b2e6-cad8-11e7-a80c-00044b633dff
process[rosout-1]: started with pid [5230]
started core service [/rosout]
process[gscam-2]: started with pid [5233]
[ERROR] [1510841705.357596322]: Could not get gstreamer sample.
[gscam-2] process has finished cleanly
log file: /home/nvidia/.ros/log/8a40b2e6-cad8-11e7-a80c-00044b633dff/gscam-2*.log

So there is the error [ERROR] [1510841705.357596322]: Could not get gstreamer sample. and if I do a rostopic list there are no topics being published.

Then again I tried changing to /dev/video0 and that launches with no problem, generating this output:

started roslaunch server http://tegra-ubuntu:36972/                                      

SUMMARY                                     
========                                    

PARAMETERS                                  
 * /rosdistro: kinetic                      
 * /rosversion: 1.12.7                      

NODES                                       
  /                                         
    gscam (gscam/gscam)                     

auto-starting new master                    
process[master]: started with pid [5437]    
ROS_MASTER_URI=http://localhost:11311       

setting /run_id to 24bbacd6-cad9-11e7-9bda-00044b633dff                                  
process[rosout-1]: started with pid [5450]  
started core service [/rosout]              
process[gscam-2]: started with pid [5457]   

And in the rostopic list I can see:

/camera/camera_info
/camera/image_raw
/rosout
/rosout_agg

but the image seems to be black, I checked with rostopic echo /camera/image_raw and just 0s are being published, also a rosrun image_view image_view image:=/camera/image_raw just shows all black: camera1

I can see both cameras when doing a ls /dev/video*. I see /dev/video0 /dev/video1. This is the cheese output so that you can see that there are no issues with the webcam: camera2

And this is the on board camera working with the ./gst-camera from jetson-inference: camera3

As I said this is my L4T version: # R28 (release), REVISION: 1.0, GCID: 9379712, BOARD: t210ref, EABI: aarch64, DATE: Thu Jul 20 07:45:59 UTC 2017

I am totally puzzled by this.

bpinaya commented 7 years ago

You are using the gscam driver from here right? https://github.com/ros-drivers/gscam and in it's master branch? I've seen there is a branch called gstreamer-1-0-support but from reviewing the files it seems master is more updated.

rachel-1 commented 7 years ago

The gscam we used is from the Debian package (so nothing special there). What kind of webcam are you using? I would suggest just trying to get a gstreamer pipeline working with that webcam (and ignoring the ROS or the onboard camera for now). To run exactly the same pipeline we are currently using with gscam, you can try: gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=1920, height=1080 ! videocrop top=540 left=0 right=0 bottom=0 ! videoconvert However, it seems like our default gstreamer configuration won't work for the webcam you have, so you'll need to modify it for your particular webcam. I'd suggest getting rid of the cropping portion, and modifying the width and height to match your webcam. You may also need to change the format parameter of video/x-raw.