rosbag使用--记录深度相机数据

2023-05-16

首先看一下教程:

http://wiki.ros.org/openni_launch/Tutorials/BagRecordingPlayback

知道了rosbag如何进行使用记录深度数据

但是按照以上教程记录下来的bag file还是很大

于是看了别人写的launch file

摘抄自spencer_people_tracking

<!-- Launch file for playing bagfiles recorded with the SPENCER robot platform -->
<launch>
  <!-- CONFIGURABLE ARGUMENTS -->
  <arg name="files" default=""/>
  <arg name="folder" default=""/>
  
  <arg name="urdf" default="false"/>
  <arg name="remap_tf" default="true" if="$(arg urdf)"/>
  <arg name="remap_tf" default="false" unless="$(arg urdf)"/>
  
  <arg name="depth" default="true"/>
  <arg name="no_point_clouds" default="false" />
  <arg name="front_rgbd" default="true"/>
  <arg name="rear_rgbd" default="true"/>
  <arg name="laser" default="true"/>
  <arg name="uncompress_rgbd" default="true"/>
  <arg name="tracked_persons" default="true"/>
  <arg name="velodyne" default="false"/>

  <!-- Playback options -->
  <arg name="rqt" default="false"/>
  <arg name="pause" default="true"/>
  <arg name="initial_wait_time" default="0.0" if="$(arg pause)"/>
  <arg name="initial_wait_time" default="45.0" unless="$(arg pause)"/>
  <arg name="loop" default="false"/>
  <arg name="start" default="0.0"/> <!-- seconds into the bagfile at which to start playing -->
  <arg name="duration" default="99999999.9"/> <!-- number of seconds to play -->
  <arg name="rate" default="1.0"/> <!-- playback speed -->
  <arg name="required" default="true" />

  <!-- Visualization options -->
  <arg name="visualization" default="true" /> <!-- whether to run RViz with provided config, or not -->
  <arg name="panoramas" default="false"/>
  <arg name="relay_rgbd_for_visualization" default="true"/>
  <arg name="rviz_config_file" default="$(find spencer_bagfile_tools)/launch/components/visualization_robot.rviz"/> <!-- configuration file for RViz to use, if visualization is enabled -->

  <arg name="rosbag_play_args" default="--clock --queue=5 --delay=0 --start=$(arg start) --duration=$(arg duration) --rate=$(arg rate)" /> <!-- extra arguments used to play back the bagfile -->

  <!-- Important: Use simulated time published on /clock topic, otherwise TF will be broken -->
  <param name="/use_sim_time" value="true"/>


  <!-- BAG FILE PLAYBACK -->
  <group>
    <remap from="/tf" to="/spencer/sensors/tf_in_bagfile" if="$(arg remap_tf)"/>
    <remap from="/spencer/sensors/clock" to="/clock"/>

    <remap from="/spencer/perception/tracked_persons" to="/spencer/perception/tracked_persons_in_bagfile" unless="$(arg tracked_persons)"/>
    <remap from="/spencer/perception/detected_persons" to="/spencer/perception/detected_persons_in_bagfile" unless="$(arg tracked_persons)"/>

    <!-- Uncompress RGB-D images -->
    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_top/depth/image_raw/compressedDepth" to="/spencer/sensors/rgbd_front_top/depth_recorded/image_raw/compressedDepth"/>
    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_top/rgb/image_raw/compressed"    to="/spencer/sensors/rgbd_front_top/rgb_recorded/image_color/compressed"/>

    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_bottom/depth/image_raw/compressedDepth" to="/spencer/sensors/rgbd_front_bottom/depth_recorded/image_raw/compressedDepth"/>
    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_bottom/rgb/image_raw/compressed"    to="/spencer/sensors/rgbd_front_bottom/rgb_recorded/image_color/compressed"/>

    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_top/depth/image_raw/compressedDepth" to="/spencer/sensors/rgbd_rear_top/depth_recorded/image_raw/compressedDepth"/>
    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_top/rgb/image_raw/compressed"    to="/spencer/sensors/rgbd_rear_top/rgb_recorded/image_color/compressed"/>

    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_bottom/depth/image_raw/compressedDepth" to="/spencer/sensors/rgbd_rear_bottom/depth_recorded/image_raw/compressedDepth"/>
    <remap if="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_bottom/rgb/image_raw/compressed"    to="/spencer/sensors/rgbd_rear_bottom/rgb_recorded/image_color/compressed"/>


    <!-- Hack if uncompressed depth/image_rect was recorded instead of depth/image_raw as recommended at http://wiki.ros.org/openni_launch/Tutorials/BagRecordingPlayback -->
    <remap unless="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_top/depth/image_rect" to="/spencer/sensors/rgbd_front_top/depth/image_raw"/>
    <remap unless="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_front_bottom/depth/image_rect" to="/spencer/sensors/rgbd_front_bottom/depth/image_raw"/>

    <remap unless="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_top/depth/image_rect"  to="/spencer/sensors/rgbd_rear_top/depth/image_raw"/>
    <remap unless="$(arg uncompress_rgbd)" from="/spencer/sensors/rgbd_rear_bottom/depth/image_rect"  to="/spencer/sensors/rgbd_rear_bottom/depth/image_raw"/>


    <!-- This script launches either rosbag play or rqt_bag, and searches for all relevant bag files for the active sensor modalities in the given folder -->
    <node name="playback_wrapper" pkg="spencer_bagfile_tools" type="play.py" output="screen" required="$(arg required)" ns="/spencer/sensors" clear_params="true"> <!-- sub-namespace only applied for relative topic names in bagfile -->
      <!-- Either give a list of files... -->
      <param name="files" value="$(arg files)"/>

      <!-- Or an entire folder containing bagfiles prefixed with laser_, front_rgbd_, etc. -->
      <param name="folder" value="$(arg folder)"/>
      <param name="laser" value="$(arg laser)"/>
      <param name="front_rgbd" value="$(arg front_rgbd)"/>
      <param name="rear_rgbd" value="$(arg rear_rgbd)"/>

      <param name="rqt" value="$(arg rqt)"/>
      <param name="pause" value="$(arg pause)"/>
      <param name="loop" value="$(arg loop)"/>
      <param name="rosbag_play_args" value="$(arg rosbag_play_args)"/>
      <param name="initial_wait_time" value="$(arg initial_wait_time)"/>
    </node>
  </group>


  <!-- TF EXCLUSIONS -->
  <group if="$(arg remap_tf)">
    <remap from="tf_old" to="/spencer/sensors/tf_in_bagfile"/>
    <node name="tf_filter" pkg="spencer_bagfile_tools" type="tf_filter.py" args="_exclude:='[]'"/>
  </group>


  <!-- RGB-D PROCESSING -->
  <group if="$(arg depth)">
    <!-- Uncompress RGB-D -->
    <group if="$(arg uncompress_rgbd)">
      <include file="$(find spencer_bagfile_tools)/launch/components/uncompress_rgbd.launch">
        <arg name="sensor_name" value="rgbd_front_top"/>
      </include>
      <include file="$(find spencer_bagfile_tools)/launch/components/uncompress_rgbd.launch">
        <arg name="sensor_name" value="rgbd_front_bottom"/>
      </include>
      <include file="$(find spencer_bagfile_tools)/launch/components/uncompress_rgbd.launch">
        <arg name="sensor_name" value="rgbd_rear_top"/>
      </include>
      <include file="$(find spencer_bagfile_tools)/launch/components/uncompress_rgbd.launch">
        <arg name="sensor_name" value="rgbd_rear_bottom"/>
      </include>
    </group>

    <!-- Generate point clouds -->
    <group unless="$(arg no_point_clouds)" ns="/spencer/sensors/">
      <!-- Front sensors -->
      <group if="$(arg front_rgbd)">
        <include file="$(find spencer_bagfile_tools)/launch/components/generate_pointcloud.launch">
          <arg name="sensor_name" value="rgbd_front_top"/>
        </include>
        <include file="$(find spencer_bagfile_tools)/launch/components/generate_pointcloud.launch">
          <arg name="sensor_name" value="rgbd_front_bottom"/>
        </include>
      </group>

      <!-- Rear sensors -->
      <group if="$(arg rear_rgbd)">
        <include file="$(find spencer_bagfile_tools)/launch/components/generate_pointcloud.launch">
          <arg name="sensor_name" value="rgbd_rear_top"/>
        </include>
        <include file="$(find spencer_bagfile_tools)/launch/components/generate_pointcloud.launch">
          <arg name="sensor_name" value="rgbd_rear_bottom"/>
        </include>
      </group>
    </group>
  </group>


  <!-- Relay original RGB-D images to throttled visualization topics (for playback, we don't need compression and throttling) -->
  <group if="$(arg relay_rgbd_for_visualization)" ns="relay_rgbd_for_visualization">
    <node pkg="nodelet" type="nodelet" name="manager" args="manager" output="screen"/>

    <include file="$(find spencer_bagfile_tools)/launch/components/relay_rgbd_for_visualization.launch">
      <arg name="camera" value="rgbd_front_top"/>
    </include>

    <include file="$(find spencer_bagfile_tools)/launch/components/relay_rgbd_for_visualization.launch">
      <arg name="camera" value="rgbd_front_bottom"/>
    </include>

    <include file="$(find spencer_bagfile_tools)/launch/components/relay_rgbd_for_visualization.launch">
      <arg name="camera" value="rgbd_rear_top"/>
    </include>

      <include file="$(find spencer_bagfile_tools)/launch/components/relay_rgbd_for_visualization.launch">
      <arg name="camera" value="rgbd_rear_bottom"/>
    </include>
  </group>


  <!-- Create RGB and depth panoramas for visualization -->
  <group if="$(arg panoramas)" ns="/spencer/sensors">
    <node if="$(arg front_rgbd)" name="panorama_rgb_front" pkg="spencer_bagfile_tools" type="panorama_builder" args="_topics:='/spencer/sensors/rgbd_front_top/rgb /spencer/sensors/rgbd_front_bottom/rgb' _inplane_rotations:='0.0 180.0' _vertical:=true _output_topic:='/spencer/sensors/rgbd_front_panorama/rgb'"/>

    <node if="$(arg rear_rgbd)" name="panorama_rgb_rear" pkg="spencer_bagfile_tools" type="panorama_builder" args="_topics:='/spencer/sensors/rgbd_rear_top/rgb /spencer/sensors/rgbd_rear_bottom/rgb' _inplane_rotations:='0.0 180.0' _vertical:=true _output_topic:='/spencer/sensors/rgbd_rear_panorama/rgb'"/>

    <group if="$(arg depth)">
      <node if="$(arg front_rgbd)" name="panorama_depth_front" pkg="spencer_bagfile_tools" type="panorama_builder" args="_topics:='/spencer/sensors/rgbd_front_top/depth /spencer/sensors/rgbd_front_bottom/depth' _inplane_rotations:='0.0 180.0' _vertical:=true _output_topic:='/spencer/sensors/rgbd_front_panorama/depth'"/>

      <node if="$(arg rear_rgbd)" name="panorama_depth_rear" pkg="spencer_bagfile_tools" type="panorama_builder" args="_topics:='/spencer/sensors/rgbd_rear_top/depth /spencer/sensors/rgbd_rear_bottom/depth' _inplane_rotations:='0.0 180.0' _vertical:=true _output_topic:='/spencer/sensors/rgbd_rear_panorama/depth'"/>
    </group>
  </group>


  <!-- VELODYNE POINT CLOUD GENERATION -->
  <group if="$(arg velodyne)">
    <include file="$(find velodyne_pointcloud)/launch/VLP16_points.launch"/>
  </group>


  <!-- ROBOT URDF -->
  <group if="$(arg urdf)">
    <include file="$(find spencer_description)/launch/publish.launch"/>
  </group>

  <!-- VISUALIZATION -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rviz_config_file)" required="false" if="$(arg visualization)"/>

</launch>

可以看到解压缩,rosbag info 以下别人的bag file

topics:

/spencer/sensors/rgbd_front_top/depth/camera_info 720 msgs : sensor_msgs/CameraInfo
/spencer/sensors/rgbd_front_top/depth/image_raw/compressedDepth 720 msgs : sensor_msgs/CompressedImage
/spencer/sensors/rgbd_front_top/rgb/camera_info 691 msgs : sensor_msgs/CameraInfo
/spencer/sensors/rgbd_front_top/rgb/image_raw/compressed 691 msgs : sensor_msgs/CompressedImage

发现记录的都是压缩格式的深度图,和彩色图

于是需要解压缩

别人的uncompress_rgbd.launch

<launch>
    <arg name="sensor_name"/>

    <group ns="/spencer/sensors/$(arg sensor_name)">
     <!--注意这里是base topic就是说这个base topic下的所有topic都会被变换--> <node name="republish_rgb" pkg="image_transport" type="republish" args="compressed in:=rgb_recorded/image_color raw out:=rgb/image_raw"/> <node name="republish_depth" pkg="image_transport" type="republish" args="compressedDepth in:=depth_recorded/image_raw raw out:=depth/image_raw"/> </group> </launch>

发现用到了image_transport

于是去看

http://wiki.ros.org/image_transport

http://wiki.ros.org/image_transport_plugins

下面是本文采用的launch file,使用compressed imge节省了空间

在弄这个launch file 的时候出了错误,rosbag记录正确,但是image_view就是没有图像,问题在于remap出错了,应该放在node里,或者放在rosbag node前面

<launch>
 	<!-- Important: Use simulated time published on /clock topic, otherwise TF will be broken -->
  	<param name="/use_sim_time" value="true"/>
	<node pkg="rosbag" type="play" name="rosbag" args="--clock --queue=5 --delay=0 --start=0 --duration=99999999 --rate=1   --loop $(find vision_obstacles_avoidance)/bags/xtion.bag">
		<remap  from="/vision_obstacles_avoidance/xtion/depth_registered/image_raw/compressedDepth" to="/vision_obstacles_avoidance/xtion/depth_registered_recorded/image_raw/compressedDepth"/>
    	<remap   from="/vision_obstacles_avoidance/xtion/rgb/image_raw/compressed" to="/vision_obstacles_avoidance/xtion/rgb_recorded/image_color/compressed"/>
	</node>
	<!--注意这里是base topic就是说这个base topic下的所有topic都会被变换-->
    <group ns="/vision_obstacles_avoidance/xtion">
		<node name="republish_rgb"   pkg="image_transport" type="republish" args="compressed in:=rgb_recorded/image_color raw out:=rgb/image_raw"/>
		<node name="republish_depth" pkg="image_transport" type="republish" args="compressedDepth in:=depth_registered_recorded/image_raw raw out:=depth_registered/image_raw"/>
    </group>
</launch>

 

rosbag record --duration=15  /vision_obstacles_avoidance/xtion/depth_registered/image_raw/compressedDepth /vision_obstacles_avoidance/xtion/depth_registered/camera_info /vision_obstacles_avoidance/xtion/rgb/image_raw/compressed /vision_obstacles_avoidance/xtion/rgb/camera_info -O xtion

 

rosbag record --duration=15 /vision_obstacles_avoidance/xtion/depth/image_raw/compressedDepth /vision_obstacles_avoidance/xtion/depth/camera_info /vision_obstacles_avoidance/xtion/rgb/image_raw/compressed /vision_obstacles_avoidance/xtion/rgb/camera_info -O xtion

 

转载于:https://www.cnblogs.com/hong2016/p/7624280.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

rosbag使用--记录深度相机数据 的相关文章

随机推荐

  • VIN-Fusion config with Realsense D435i

    First shot Copy the launch file in package VINS Fusion to the directory of realsense2 cameara launch cp home william cat
  • 算法的5个层次

    对算法的掌握 xff0c 大致可以分为5个层次 听说 了解 理解 实现 应用 Level 1 xff1a 听说 知道算法名 知道算法功能 Leven 2 xff1a 了解 知道算法原理 自然语言描述 知道算法优缺点 Leven 3 xff1
  • elf文件下载出错问题

    现在遇到的是sof文件下载有问题 xff0c 不是对应的sof文件 在复制工程后 xff0c 可以在assignment gt setting中指定生成文件所在的文件夹 xff0c 防止sof文件的不对应 转载于 https www cnb
  • 搞定INTEL快速存储技术(用SSD硬盘做缓存加速)

    给朋友买了个联想 ideapad s400 超级本 xff0c 还真是锻炼我的 idea 啊 xff0c 原机不带 WIN7 系统 xff0c 所以只好自己动手装 WIN7 xff0c 并打开 24G SSD 硬盘做缓存 一 用常规方法 G
  • php取今天开始结束,PHP获取今天开始和结束的时间戳

    PHP获取今天开始和结束的时间戳 xff1a t 61 time 开始时间戳 start 61 mktime 0 0 0 date 34 m 34 t date 34 d 34 t date 34 Y 34 t 结束时间戳 end 61 m
  • Java中Semaphore(信号量)的使用

    Semaphore的作用 xff1a 在java中 xff0c 使用了synchronized关键字和Lock锁实现了资源的并发访问控制 xff0c 在同一时间只允许唯一了线程进入临界区访问资源 读锁除外 xff0c 这样子控制的主要目的是
  • git找回丢失的代码

    多人开发时找回丢失的代码 1 先保证所有分支的代码都已经提交并拉取到最新状态 2 最重要的是需要找到最近一条自己代码还存在的记录 xff0c 然后复制到最近的更早一条的提交记录的id xff0c 比如e36e9e76da144536c196
  • Docker容器进入的4种方式

    Docker容器进入的4种方式 在使用Docker创建了容器之后 xff0c 大家比较关心的就是如何进入该容器了 xff0c 其实进入Docker容器有好几多种方式 xff0c 这里我们就讲一下常用的几种进入Docker容器的方法 进入Do
  • HTTP Basic和Digest认证介绍与计算

    一 说明 web用户认证 xff0c 最开始是get提交 43 把用户名密码存放在客户端的cookie中的形式 xff1b 在意识到这样不安全之后逐渐演变成了post提交 43 把用户凭证放到了服务端的session中的形式 xff08 当
  • TeamViewer 的替代品 ZeroTier + NoMachine

    之前不怎么用 TeamViewer xff0c 最近用的多了 xff0c 特别好用 xff0c 有点上瘾 xff0c 在哪儿都能连家里的 RTX xff0c 太棒了 然后它就开始作了 有没有好的替代方案呢 xff1f 有人推荐向日葵 xff
  • Kubernetes tutorial - K8S 官方入门教程 中文翻译

    官方教程 xff0c 共 6 个小节 每一小节的第一部分是知识讲解 xff0c 第二部分是在线测试环境的入口 kubectl 的命令手册 原文地址 1 创建集群 1 1 使用 Minikube 创建集群 Kubernetes 集群 Kube
  • 两年,从纯小白到腾讯阿里,应届非计算机毕业生的2014互联网求职之路

    0 写在前面 以此文 xff0c 献给自己这两年的青葱岁月 xff0c 感谢淘宝的朗英师兄和微博的旭爷 全栈pm莹姐姐 酷炫石女王 以及我逝去的头发 参照Lucida的 9个offer xff0c 12家公司 xff0c 35场面试 一文
  • 在cmd中使用start运行exe文件闪退问题

    如果我们是使用的bat批处理文件来执行某件事 xff0c 我们可以直接使用 k参数 xff0c 或者pause命令来让容器 cmd 执行完文件后不退出 如果我们是在cmd中使用start或其他命令直接执行任务 xff0c 导致当前容器退出
  • GreenPlum 5.0的安装

    基本环境 xff1a serverIPMDW172 16 16 31SDW1172 16 16 34SDW2172 16 16 35 1 xff1a 检查操作系统是否符合要求 xff0c 以及系统设置 我这里使用的系统是CentOS 操作系
  • 转载:Pixhawk源码笔记八:添加新的参数

    转载 xff1a 新浪 64 WalkAnt 第九部分 添加新的参数 英文参考 xff1a http dev ardupilot com wiki code overview adding a new parameter 本节源自 xff1
  • Ubuntu(Linux) 下 unzip 命令使用详解

    1 功能作用 xff1a 解压缩zip文件 2 位置 xff1a usr bin unzip 3 格式用法 xff1a unzip Z opts modifiers file zip list x xlist d exdir 4 主要参数
  • Linux之Libcurl库的介绍与应用20170509

    一 LibCurl简介 LibCurl是免费的客户端URL传输库 xff0c 支持FTP FTPS HTTP HTTPS SCP SFTP TFTP TELNET DICT FILE xff0c LDAP等协议 xff0c 其主页是http
  • 面试问题之操作系统:动态链接库和静态链接库的区别

    动态链接库是一个可以被其它应用程序共享的程序模块 xff0c 其中封装了一些可以被共享的例程和资源 动态链接库文件名的扩展名一般是dll xff0c 也有可能是drv xff0c sys和fon xff0c 它和可执行文件 exe 非常类似
  • (uC/OS-II学习笔记) 消息邮箱&&消息队列

    原文出处 xff1a http www cnblogs com hebaichuanyeah 与信号量一样 xff0c 消息邮箱与消息列队都是一种事件块 消息邮箱可以在任务间实现信息传递 比如 xff0c 在任务1中发送一条消息 xff0c
  • rosbag使用--记录深度相机数据

    首先看一下教程 xff1a http wiki ros org openni launch Tutorials BagRecordingPlayback 知道了rosbag如何进行使用记录深度数据 但是按照以上教程记录下来的bag file