​Jetson Nano 调用 CSI摄像头运行CCMSLAM​

转载自:Jetson Nano 调用CSI摄像头运行CCMSLAM_不能再吃了OvO的博客-CSDN博客

Jetson Nano 调用CSI摄像头运行CCMSLAM

不能再吃了OvO 2021-04-28 15:09:49

310  正在上传…重新上传取消​ 收藏 6 

分类专栏: CCMSLAM

版权

​ CCMSLAM  专栏收录该内容

4 篇文章 0 订阅

订阅专栏

文章目录

在这里插入图片描述

1.安装ROS的CSI摄像头软件包

TX2推荐安装jetson_csi_cam,而Nano推荐安装jetson_nano_csi_cam

1.1 jetson_csi_cam

注意:与下面的jetson_nano_csi_cam二选一。
参考:GitHub - peter-moran/jetson_csi_cam: A ROS package making it simple to use CSI cameras on the Nvidia Jetson TK1, TX1, or TX2 with ROS.

1.1.1安装 GStreamer-1.0

sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt-get update
sudo apt-get install gstreamer1.0-tools gstreamer1.0-alsa \
 gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
 gstreamer1.0-libav
sudo apt-get install libgstreamer1.0-dev \
 libgstreamer-plugins-base1.0-dev \
 libgstreamer-plugins-good1.0-dev \
 libgstreamer-plugins-bad1.0-dev

查看 GStreamer-1.0 版本

gst-inspect-1.0 --version

1.1.2下载包jetson_csi_camgscam

cd ~/ccmslam_ws/src
git clone https://github.com/peter-moran/jetson_csi_cam.git
git clone https://github.com/ros-drivers/gscam.git

修改gscamMakefile

gedit ~/ccmslam_ws/gscam/Makefile

第一行后面加上-DGSTREAMER_VERSION_1_x=On变成:

EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1 -DGSTREAMER_VERSION_1_x=On

保存退出,返回工作空间编译:

cd ../..
catkin_make

如果catkin_make失败,则用

catkin_make_isolated

测试:

roscore
roslaunch jetson_csi_cam jetson_csi_cam.launch

若出现错误:gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
解决方法转自:Gscam reports `gst_uri_is_valid (uri)` error on startup, but video still works. · Issue #1 · peter-moran/jetson_csi_cam · GitHub
修改jetson_csi_cam.launch

gedit ~/ccmslam_ws/src/jetson_csi_cam/jetson_csi_cam.launch

把关于GSCAM_CONFIG的那一段改为:

<env name="GSCAM_CONFIG" value="nvarguscamerasrc sensor-id=$(arg sensor_id) ! video/x-raw(memory:NVMM),
    width=(int)$(arg width), height=(int)$(arg height), format=(string)I420, framerate=(fraction)$(arg fps)/1 ! 
    nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert" />

1.1.3 再运行roslaunch:

roslaunch jetson_csi_cam jetson_csi_cam.launch

如果出现错误:Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvargus
则终端运行:

sudo systemctl restart nvargus-daemon

再运行roslaunch

查看ROS话题:

rostopic list

发现出现了/csi_cam_0/image_raw
查看捕获的图像:

rqt_image_view

如果能正确显示图像,则成功了。


1.2 jetson_nano_csi_cam

注意:与上面的jetson_csi_cam二选一。
参考:GitHub - rt-net/jetson_nano_csi_cam_ros: ROS driver of Jetson Nano DevKit B01 + dual CSI camera

1.2.1安装 GStreamer-1.0

sudo add-apt-repository universe
sudo add-apt-repository multiverse
sudo apt-get update
sudo apt-get install gstreamer1.0-tools gstreamer1.0-alsa \
 gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
 gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
 gstreamer1.0-libav
sudo apt-get install libgstreamer1.0-dev \
 libgstreamer-plugins-base1.0-dev \
 libgstreamer-plugins-good1.0-dev \
 libgstreamer-plugins-bad1.0-dev

查看 GStreamer-1.0 版本

gst-inspect-1.0 --version

1.2.2下载包jetson_nano_csi_camgscam

cd ~/ccmslam_ws/src
git clone https://github.com/rt-net/jetson_nano_csi_cam_ros.git 
git clone https://github.com/ros-drivers/gscam.git

修改gscam的Makefile:

gedit ~/ccmslam_ws/gscam/Makefile

第一行后面加上-DGSTREAMER_VERSION_1_x=On变成:

EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1 -DGSTREAMER_VERSION_1_x=On

保存退出,返回工作空间编译:

cd ../..
catkin_make

1.2.3 运行roslaunch:

roslaunch jetson_nano_csi_cam jetson_nano_csi_cam.launch

查看ROS话题:

rostopic list

发现出现了/csi_cam_0/image_raw

查看捕获的图像:

rqt_image_view

如果能正确显示图像,则成功了。


2.修改Client0_euroc.launch

gedit ~/ccmslam_ws/src/ccm_slam/cslam/launch/EuRoC/Client0_euroc.launch

将参数cam更改为新相机文件的路径:
即,将

 <param name="~TopicNameCamSub" type="string" value="/cam0/image_raw" />

改为:

 <param name="~TopicNameCamSub" type="string" value="/csi_cam_0/image_raw" />

3.编写启动文件

编写ccm-csi.sh

gnome-terminal -t "cam" -x bash -c "roslaunch jetson_csi_cam jetson_csi_cam.launch;exec bash;"

sleep 3
gnome-terminal -t "server" -x bash -c "roslaunch ccmslam Server.launch;exec bash;"
sleep 3

gnome-terminal -t "agent0" -x bash -c "roslaunch ccmslam Client0_euroc.launch;exec bash;"

sleep 3 
gnome-terminal -t "rviz" -x bash -c "roscd ccmslam ;rviz -d conf/rviz/ccmslam.rviz ;exec bash;"


如果上面用的是jetson_nano_csi_cam包,则:

gnome-terminal -t "cam" -x bash -c "roslaunch jetson_nano_csi_cam jetson_nano_csi_cam.launch;exec bash;"

sleep 3
gnome-terminal -t "server" -x bash -c "roslaunch ccmslam Server.launch;exec bash;"
sleep 3

gnome-terminal -t "agent0" -x bash -c "roslaunch ccmslam Client0_euroc.launch;exec bash;"

sleep 3 
gnome-terminal -t "rviz" -x bash -c "roscd ccmslam ;rviz -d conf/rviz/ccmslam.rviz ;exec bash;"


4.启动

命令行输入:

chmod +x ccm-csi.sh
sh ccm-csi.sh

在这里插入图片描述
在这里插入图片描述
如果出现错误:Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvargus
则终端运行:

sudo systemctl restart nvargus-daemon

转载请备注:Jetson Nano 调用CSI摄像头运行CCMSLAM_不能再吃了OvO的博客-CSDN博客

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值