我有一个安装了 ROS Noetic 的虚拟机,我想在我的 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
。我应该怎么办?
答案1
对于“无效的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
所以我们不会两次回答同一个问题。
我有靛蓝,我知道兼容性问题有多么痛苦。
祝你好运!