Video

ROS 相機校準 GStreamer 錯誤

  • February 8, 2021

我有一個安裝了 ROS Noetic 的 VM,我想在我的 USB 網路攝像頭上執行攝像頭校準。我遵循以下指南,對於啟動器,我輸入了以下程式碼:

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

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

 <node ns="left" 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="v4l2src device=$(arg DEVICEl) ! video/x-raw-rgb,framerate=$(arg FPS) ! ffmpegcolorspace"/>
   <param name="frame_id" value="/v4l_frame_l"/>
   <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>

我嘗試啟動它並得到以下響應:

... logging to /home/dragonros/.ros/log/e62adeac-5d96-11eb-b879-09066182755f/roslaunch-ubuntu-42560.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

invalid ROS_HOSTNAME (an empty string)
invalid ROS_HOSTNAME (an empty string)
started roslaunch server http://ubuntu:35479/

SUMMARY
========

PARAMETERS
* /left/gscam_driver_v4l/camera_info_url: package://gscam/e...
* /left/gscam_driver_v4l/camera_name: default
* /left/gscam_driver_v4l/frame_id: /v4l_frame_l
* /left/gscam_driver_v4l/gscam_config: v4l2src device=/d...
* /left/gscam_driver_v4l/sync_sink: True
* /rosdistro: noetic
* /rosversion: 1.15.9

NODES
 /left/
   gscam_driver_v4l (gscam/gscam)

ROS_MASTER_URI=http://localhost:11311

process[left/gscam_driver_v4l-1]: started with pid [42574]
[ WARN] [1611445425.340701580]: invalid ROS_HOSTNAME (an empty string)
[ INFO] [1611445425.361034554]: Using gstreamer config from rosparam: "v4l2src device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"
[ INFO] [1611445425.366515919]: camera calibration URL: package://gscam/examples/uncalibrated_parameters.ini
[ INFO] [1611445425.366725052]: Loaded camera calibration from package://gscam/examples/uncalibrated_parameters.ini

(gscam:42574): GStreamer-WARNING **: 15:43:45.455: 0.10-style raw video caps are being created. Should be video/x-raw,format=(string).. now.
[ INFO] [1611445425.455679084]: Time offset: 1611418553.717
[ INFO] [1611445425.555216304]: Publishing stream...
[ INFO] [1611445425.555412447]: Started stream.
[ERROR] [1611445425.555446013]: Could not get gstreamer sample.
[ INFO] [1611445425.555455586]: Stopping gstreamer pipeline...
[ INFO] [1611445425.557306732]: GStreamer stream stopped!
[ INFO] [1611445425.557374812]: Cleaning up stream and exiting...
[left/gscam_driver_v4l-1] process has finished cleanly
log file: /home/dragonros/.ros/log/e62adeac-5d96-11eb-b879-09066182755f/left-gscam_driver_v4l-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

它說它無法獲得 gstreamer 樣本。此外,由於某種原因,當我將相機插入電腦時,它會同時創建/dev/video0/dev/video1. 如果我跑步,這也是我得到的rosrun gscam gscam。我應該怎麼辦?

對於“invalid ROS_HOSTNAME”與環境變數有關。看看這個頁面:

https://wiki.ros.org/ROS/EnvironmentVariables

這裡的假設是您的 Cam 與 ROS 兼容。

您在校準前是否嘗試過:

roscd gscam
cd bin
export GSCAM_CONFIG="v4l2src device=/dev/video0 ! video/x-raw-rgb,framerate=30/1 ! ffmpegcolorspace"
rosrun gscam gscam

你有沒有嘗試過 camera_calibration 包:

http://wiki.ros.org/camera_calibration

我不確定 gscam 是否與 noetic 兼容。

https://index.ros.org/r/gscam/#noetic

那時人們已經通過確保滿足 gscam 依賴項來解決這個問題,並添加

“<param if="$(arg GST10)” name=“gscam_config” value=“v4l2src….."。

看看這個:

https://github.com/ros-drivers/gscam/issues/25
https://github.com/ros-drivers/gscam/tree/master/examples

另外,考慮關閉 ::: https://stackoverflow.com/questions/65865736/ros-camera-calibration

所以我們不會兩次回答同一個問題。

我有靛藍,我知道兼容性問題有多痛苦。

祝你好運!

引用自:https://unix.stackexchange.com/questions/630768