Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No image being published #38

Open
ne-v0y opened this issue Jun 30, 2017 · 9 comments
Open

No image being published #38

ne-v0y opened this issue Jun 30, 2017 · 9 comments

Comments

@ne-v0y
Copy link

ne-v0y commented Jun 30, 2017

Hi there,

So I've been trying to launch a Jetson TX2 on-board camera using gscam_nodelet.launch. It runs without errors, but there was no image being published. I wonder if there's anything I missed here. Thanks.

@KonstantineMushegian-TRI

I am trying to get the on-board TX2 working as well and ran into the same issue as you. Did you ever work it out?

I've been looking at NVIDIA forums and I can get the images streaming using
gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e however I tried making my own gscam *.launch file where I specify the settings in the following way:

<launch>
  <!-- This launchfile should bring up a node that broadcasts a ros image
       transport on /webcam/image_raw -->

  <arg name="DEVICE" default="/dev/video0"/>
  <!-- The GStreamer framerate needs to be an integral fraction -->
  <arg name="FPS" default="30/1"/>
  <arg name="PUBLISH_FRAME" default="false"/>
  <arg name="GST10" default="false"/>

  <node ns="v4l" name="gscam_driver_v4l" pkg="gscam" type="gscam" output="screen">
    <param name="camera_name" value="default"/>
    <param name="camera_info_url" value="package://gscam/examples/uncalibrated_parameters.ini"/>
    <param unless="$(arg GST10)" name="gscam_config" value="nvcamerasrc device=$(arg DEVICE) ! video/x-raw-rgb,framerate=$(arg FPS) ! ffmpegcolorspace"/>
    <param if="$(arg GST10)" name="gscam_config" value="nvcamerasrc device=$(arg DEVICE) ! 'video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e"/>
    <param name="frame_id" value="/v4l_frame"/>
    <param name="sync_sink" value="true"/>
  </node>

  <node if="$(arg PUBLISH_FRAME)" name="v4l_transform" pkg="tf" type="static_transform_publisher" args="1 2 3 0 -3.141 0 /world /v4l_frame 10"/>
</launch>

but then I get this output

[ INFO] [1501112404.078656910]: Using gstreamer config from rosparam: "nvcamerasrc device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"
[ INFO] [1501112404.088050691]: camera calibration URL: package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1501112404.088559362]: Loaded camera calibration from package://gscam/examples/uncalibrated_parameters.ini

(gscam:12797): GStreamer-WARNING **: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string).. now.
[FATAL] [1501112404.108395692]: GStreamer: cannot link launchpipe -> sink
[FATAL] [1501112404.108582668]: Failed to initialize gscam stream!

I just started using this today, any input would be welcome!

@gariepyalex
Copy link

@KonstantineMushegian-TRI have you found a solution?

@KonstantineMushegian-TRI

@gariepyalex Are you able to get the camera stream using the following command?
gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e

I was not able to get this package working; I was able to get a video stream using OpenCV however couldn't get the same code to work in ROS.

@ne-v0y
Copy link
Author

ne-v0y commented Aug 10, 2017

I sort of made my own solution: repo

@plieningerweb
Copy link

I solved it by compyling it on the tx2 with version 1.0 and the following launch file:

Install ros like described in
Run ./setupCatkinWorkspace of tutorial

cd ~/catkin-ws
source devel/setup.bash 
cd src
git clone https://github.com/ros-drivers/gscam.git
sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev
cd ..
catkin_make -DGSTREAMER_VERSION_1_x=On

add file ~/catkin_ws/src/gscam/examples/tx2.launch

<launch>
  <!-- This launchfile should bring up a node that broadcasts a ros image
       transport on /webcam/image_raw -->

  <arg name="DEVICE" default="/dev/video0"/>
  <!-- The GStreamer framerate needs to be an integral fraction -->
  <arg name="FPS" default="30/1"/>
  <arg name="PUBLISH_FRAME" default="false"/>
  <arg name="GST10" default="false"/>

  <node ns="v4l" name="gscam_driver_v4l" pkg="gscam" type="gscam" output="screen">
    <param name="camera_name" value="default"/>
    <param name="camera_info_url" value="package://gscam/examples/uncalibrated_parameters.ini"/>
    <param name="gscam_config" value="nvcamerasrc sensor-id=0 ! video/x-raw(memory:NVMM),width=1280, height=720,format=I420, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=BGRx ! videoconvert ! ffmpegcolorspace "/>
    <!-- not working <param name="gscam_config" value="nvcamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280, height=720,format=I420, framerate=30/1' ! nvvidconv flip-method=0 ! 'video/x-raw, format=BGRx' ! videoconvert ! 'video/x-raw, format=BGR' ! appsink "/>-->
    <!-- working, but maybe too much <param name="gscam_config" value="nvcamerasrc sensor-id=0 ! video/x-raw(memory:NVMM),width=1280, height=720,format=I420, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR "/> -->
    <param name="frame_id" value="/v4l_frame"/>
    <param name="sync_sink" value="true"/>
  </node>

  <node if="$(arg PUBLISH_FRAME)" name="v4l_transform" pkg="tf" type="static_transform_publisher" args="1 2 3 0 -3.141 0 /world /v4l_frame 10"/>
</launch>

run

roslaunch gscam tx2.launch
# on other console, run
rosrun image_view image_view image:=/v4l/camera/image_raw

Now an image is displayed ❤️ 🖼️ 😄

@emilyfy
Copy link

emilyfy commented Apr 1, 2018

Thanks so much for the solutions! Just for info in case anyone faces the same problem, I tried using @plieningerweb's launch file but at first kept getting the error no element "nvcamerasrc". I managed to get it to work in the end by deleting all my gstreamer libraries and reinstalling them, then deleting my build/ and devel/ folders and recompiling.

@jcook3701
Copy link

Environment: JetPack 4.3 running on a TX2

It appears that gstreamer has been updated and "nvcamerasrc" has now become deprecated. The below solution is a modified version of @plieningerweb solution to account for the move to "nvarguscamerasrc" over "nvcamerasrc".

Note: It appears that the only format that nvarguscamerasrc accepts from the TX2 is NV12.

<launch>
  <!-- This launchfile should bring up a node that broadcasts a ros image
       transport on /webcam/image_raw -->

  <arg name="DEVICE" default="/dev/video0"/>
  <!-- The GStreamer framerate needs to be an integral fraction -->
  <arg name="FPS" default="30/1"/>
  <arg name="PUBLISH_FRAME" default="false"/>
  <arg name="GST10" default="false"/>

  <node ns="v4l" name="gscam_driver_v4l" pkg="gscam" type="gscam" output="screen">
    <param name="camera_name" value="default"/>
    <param name="camera_info_url" value="package://gscam/examples/uncalibrated_parameters.ini"/>
    <param name="gscam_config" value="nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM),width=1280, height=720,format=NV12, framerate=30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR"/>
    <param name="frame_id" value="/v4l_frame"/>
    <param name="sync_sink" value="true"/>
  </node>

  <node if="$(arg PUBLISH_FRAME)" name="v4l_transform" pkg="tf" type="static_transform_publisher" args="1 2 3 0 -3.141 0 /world /v4l_frame 10"/>
</launch>

run

roslaunch gscam tx2.launch
# on other console, run
rosrun image_view image_view image:=/v4l/camera/image_raw

Note: If you are having issues you can try debugging with the below command.

GST_DEBUG=4 roslaunch gscam tx2.launch

Helpful Link

Jetson TX2 GStreamer capture and display example pipelines for Jetpack 4.2+

@xuankuzcr
Copy link

hello friend, i just found nvarguscamerasrc plugin make some memory leak in my xavier with gscam,i want know have some resolution over hear.

@nbaldy
Copy link

nbaldy commented May 9, 2024

This is a really late reply and might be specific to the ROS2 version, but an issue I see here is one I faced, you can see how I debugged it here: #97 (comment)

You have to escape your quotes with \" not use '

Example of a ROS2 launch file which works for me:

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import ComposableNodeContainer, Node


def generate_launch_description():
  gscam_node = Node(
      package='gscam',  # Replace with the name of the package containing the node
      executable='gscam_node',  # Replace with the name of the node executable
      parameters=[{"camera_name": "default",
                    "camera_info_url": "package://gscam/examples/uncalibrated_parameters.ini",
                    # The below FAILS - caps not escaped properly!
                    # "gscam_config": "udpsrc port=5000 caps='application/x-rtp,sampling=(string)YCbCr-4:2:2,width=(string)640,height=(string)480' ! rtpvrawdepay ! videoconvert"
                    "gscam_config": "udpsrc port=5000 caps=\"application/x-rtp, sampling=(string)YCbCr-4:2:2, width=(string)640, height=(string)480\" ! rtpvrawdepay ! videoconvert"
                    }]
  )

  return LaunchDescription([gscam_node])

Edit that this is based on the example launchfiles in the repo, though I used python out of personal preference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants