TX2使用记录系列文章(6)-TX2之ZED的使用

软硬件平台

  • PC端:win10
  • TX2端:使用JetPack3.3刷机的系统

1 使用zed的方法

1.1 安装ZED SDK

当前TX2采用的是JetPack3.3刷机的,所以需要安装ZED 2.8X版本的SDK
下载链接 SDK for jetpack 3.3 版本
下载完成之后,放到TX2中,我将此文件放在了Downloads文件夹下,打开终端,运行如下指令

cd Downloads/
chmod +x ZED_SDK_Linux_Tegra_JP33_v2.8.5.run
./ZED_SDK_Linux_Tegra_JP33_v2.8.5.run

首先会出现下图,在这个图片中按q即可跳过这个说明文档在这里插入图片描述
跳过后会出现一系列的询问,输入y即可,大概一分钟即可完成安装在这里插入图片描述

1.2 测试ZED SDK

最后文件都会安装到/usr/local/zed文件夹下,当安装完成后切换路径到安装位置下的tools文件夹

cd /usr/local/zed/tools

运行如下指令测试是否安装成功

./"ZED Explorer"

这里可能会出现提示缺少对应的文件,下面我列出我遇到的,如果你遇到的和我的不同,用apt-get安装对应包应该就可以解决问题
在这里插入图片描述

我这里遇到缺少libturbojpeglibhidapi,分别使用如下指令安装即可
我在安装的时候提示无法解锁对应程序,可能有其他程序占用,将TX2重启一下即可

sudo apt-get install libturbojpeg
sudo apt-get install libhidapi-dev

再次输入如下指令进行测试即可

./"ZED Explorer"

结果如下,家里太乱,就涂掉了
在这里插入图片描述

2 在ROS下使用ZED

2.1 安装ZED_ROS

下载ZED_ROS包
由于我使用的JetPack3.3刷机的系统,所以下载的ROS包是对应的2.8x版本的ROS包

下载后解压到catkin_ws下的src文件夹中,返回到工作空间根目录编译。具体指令如下:

cd ~/catkin_ws/
catkin_make -DCMAKE_BUILD_TYPE=Release
echo source $(pwd)/devel/setup.bash >> ~/.bashrc
source ~/.bashrc

这时候就已经安装完成ZED的ROS包了

2.2 测试

打开终端输入指令:

roslaunch zed_wrapper zed.launch

再打开一个终端,输入指令:

rqt_image_view

可以选择查看不同节点的画面,可以选择左摄像头或者右摄像头的画面等等

在这里插入图片描述

在这里插入图片描述

-------------------------------------------------------------更新:2020.08.05-------------------------------------------------------------

3 zed的launch解读

zed-ros-wrapper-2.8.5功能包的结构如下,我们的launch文件在“zed_wrapper”中

在这里插入图片描述
下图中1的位置是我们启用zed常用的launch,
整个launch的运行流程如下:

  • 启动zed.launchu
  • 启动后会调用2的launch文件
  • 在2中调用params文件夹下的3和4的yaml文件

在这里插入图片描述
我们常用的参数配置都在common.yaml文件中,我们如果需要更改一些初始设置值时,在下面这个文件中修改即可。

# params/common_yaml
# Common parameters to Stereolabs ZED and ZED mini cameras
---

# Dynamic parameters cannot have a namespace
auto_exposure:              true                                # Dynamic
exposure:                   100                                 # Dynamic
gain:                       100                                 # Dynamic
confidence:                 100                                 # Dynamic
mat_resize_factor:          1.0                                 # Dynamic
point_cloud_freq:           10.0                                # Dynamic - frequency of the pointcloud publishing (equal or less to `frame_rate` value)

general:
    camera_flip:                false
    zed_id:                     -1
    serial_number:              0
    resolution:                 2                                   # '0': HD2K, '1': HD1080, '2': HD720, '3': VGA
    frame_rate:                 30
    gpu_id:                     -1
    base_frame:                 'base_link'                         # must be equal to the frame_id used in the URDF file
    camera_frame:               'zed_camera_center'                 # must be equal to the frame_id used in the URDF file
    left_camera_frame:          'zed_left_camera_frame'             # must be equal to the frame_id used in the URDF file
    left_camera_optical_frame:  'zed_left_camera_optical_frame'     # must be equal to the frame_id used in the URDF file
    right_camera_frame:         'zed_right_camera_frame'            # must be equal to the frame_id used in the URDF file
    right_camera_optical_frame: 'zed_right_camera_optical_frame'    # must be equal to the frame_id used in the URDF file
    verbose:                    true
    svo_compression:            4                                   # `0`: RAW (no compression), `1`: LOSSLESS (PNG/ZSTD), `2`: LOSSY (JPEG), `3`: AVCHD (H264 SDK v2.7), `4`: HEVC (H265 SDK v2.7)
    self_calib:                 true                                # enable/disable self calibration at starting

video:
    rgb_topic_root:             'rgb'                               # default `rgb/image_rect_color`, `rgb/camera_info`, `rgb_raw/image_raw_color`, `rgb_raw/camera_info`
    left_topic_root:            'left'                              # default `left/image_rect_color`, `left/camera_info`, `left_raw/image_raw_color`, `left_raw/camera_info`
    right_topic_root:           'right'                             # default `right/image_rect_color`, `right/camera_info`, `right_raw/image_raw_color`, `right_raw/camera_info`
    stereo_topic_root:          'stereo'                            # default `stereo/image_rect_color`, `stereo/camera_info`, `stereo_raw/image_raw_color`, `stereo_raw/camera_info`
    color_enhancement:          true                                # [FUTURE USE] This parameter enhances color spreading on R/G/B channel and increase gamma correction on black areas for a better gray segmentation in black areas. Recommended for computer's vision applications.

depth:
    quality:                    1                                   # '0': NONE, '1': PERFORMANCE, '2': MEDIUM, '3': QUALITY, '4': ULTRA
    sensing_mode:               0                                   # '0': STANDARD, '1': FILL
    depth_stabilization:        1                                   # `0`: disabled, `1`: enabled
    openni_depth_mode:          0                                   # '0': 32bit float meters, '1': 16bit uchar millimeters
    depth_topic_root:           'depth'                             # default `depth/depth_registered` or `depth/depth_raw_registered` if `openni_depth_mode` is true
    point_cloud_topic_root:     'point_cloud'
    disparity_topic:            'disparity/disparity_image'
    confidence_root:            'confidence'                        # default `confidence/confidence_image` and `confidence/confidence_map`

tracking:
    publish_tf:                 true                                # publish `odom -> base_link` TF
    publish_map_tf:             true                                # publish `map -> odom` TF
    world_frame:                'map'                               # the reference fixed frame (same as `map_frame` or `odometry_frame`)
    map_frame:                  'map'
    odometry_frame:             'odom'
    odometry_db:                ''
    spatial_memory:             true                                # Enable to detect loop closure
    floor_alignment:            false                               # Enable to automatically calculate camera/floor offset
    initial_base_pose:          [0.0,0.0,0.0, 0.0,0.0,0.0]          # [X, Y, Z, R, P, Y]
    pose_topic:                 'pose'
    publish_pose_covariance:    true                                # Enable to publish the `pose_with_covariance` message
    fixed_covariance:           false                               # Set the covariance for pose and odometry to a diagonal matrix with `fixed_cov_value` on the diagonal
    fixed_cov_value:            1e-6                                # Value used on the diagonal of the fixed covariance matrix (`fixed_covariance -> true`)
    odometry_topic:             'odom'
    init_odom_with_first_valid_pose: true                           # Enable to initialize the odometry with the first valid pose
    path_pub_rate:              2.0                                 # Path positions punlishing frequency
    path_max_count:             -1                                  # use '-1' for unlimited path size
    two_d_mode:                 false                               # Force navigation on a plane. If true the Z value will be fixed to "fixed_z_value", roll and pitch to zero
    fixed_z_value:              1.0                                 # Value to be used for Z coordinate if `two_d_mode` is true

mapping:
    mapping_enabled:            false                               # True to enable mapping and fused point cloud pubblication
    resolution:                 1                                   # `0`: HIGH, `1`: MEDIUM, `2`: LOW
    fused_pointcloud_freq:      1.0                                 # frequency of the publishing of the fused colored point cloud


如果需要更改zed的最小测量值时在zed.yaml中修改

# params/zed_yaml
# Parameters for Stereolabs ZED camera
---

camera_model: 'zed'

# Dynamic parameters cannot have a namespace
max_depth: 20.0                 # Dynamic

depth:
    min_depth: 0.3              # Min: 0.3, Max: 3.0


4 参数的介绍

官方文档

在这里上面提到的yaml文件中的设置,不懂的可以在这个文档中找到具体的解释

举例: 我们在用zed测试距离的时候会遇到测到的数据为nan 或者 -inf 或者 inf等,在官方文档中能找到下面的说明,大概就是说nan是由于部分点被遮挡或者异常导致无法估测距离,inf是由于测量的点的距离超出了测量的最大范围,-inf是由于测量的点超出了测量的最小范围

原文如下:

In STANDARD mode, holes (black pixels) have different values depending on their type. They are associated with an enum:

  • NAN referred as OCCLUSION_VALUE. The depth of the pixel cannot be estimated as it is occluded or an outlier.
  • -INFINITY referred as TOO_CLOSE. The depth of the pixel cannot be estimated as it is too close to the camera.
  • INFINITY referred as TOO_FAR. The depth of the pixel cannot be estimated as it is too far from the camera.
    You can check for valid depth values using isValidMeasure()

参考文章

zed-ros-wrapper
zed介绍
zed-node

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值