ros仿真笔记之——基于gazebo的eventcamera仿真(dvsgazebo)(代码片段)

gwpscut gwpscut     2023-01-04     741

关键词:

首先安装DVS的驱动包,之前博客《ROS学习笔记之——ESVO复现及DAVIS346测试》已经配置过了~

然后clone工程,随便放到一个文件下

git clone https://github.com/HBPNeurorobotics/gazebo_dvs_plugin.git

然后编译,即可将dvs模型安装到系统中

cd gazebo_dvs_plugin
mkdir build
cd build
cmake ..
sudo make install

然后找到该模型的plugin,应该在/usr/local/lib/libgazebo_dvs_plugin.so

然后拉出来放到工作空间中。

This plugin can be used as a drop-in replacement for normal Gazebo camera plugins. Both, the DVS plugin and the CameraPlugin use the Gazebo CameraSensor internally.

<sensor name='camera' type='camera'>
    <camera name='__default__'>
        <horizontal_fov>1.8</horizontal_fov>
        <image>
            <width>128</width>
            <height>128</height>
        </image>
        <clip>
            <near>0.1</near>
            <far>100</far>
        </clip>
    </camera>
    <always_on>1</always_on>
    <update_rate>60</update_rate>
    <visualize>0</visualize>
    <plugin name='camera_controller' filename='libgazebo_dvs_plugin.so'>
        <cameraName>camera_front</cameraName>
        <robotNamespace>AADC_AudiTT</robotNamespace>
        <eventThreshold>10</eventThreshold>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <!-- <eventsTopicName>events</eventsTopicName> -->
    </plugin>
</sensor>

The parameters robotNamespace, cameraName and eventsTopicName (default: "events") result in "$robotNamespace/$cameraName/$eventsTopicName" as the identifier of the provided events topic. In this case, events will be accessible from "/AADC_AudiTT/camera_front/events".

The parameter eventThreshold specifies the pixel-wise threshold which has to be exceeded for a event to be emitted for this pixel.

The sensor parameter update_rate has only limited effect in Gazebo. The real rate is determined by the rendering pipeline and can be way lower than the specified rate. Still, this implementation yields a higher event frequency than similar Python-based implementations as a standalone node.

<gazebo reference="camera_rgb_frame">
    <!-- <material>Gazebo/Green</material> -->
    <sensor type="camera" name="camera">
      <update_rate>30.0</update_rate>
      <!-- <camera name="camera">
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
      </camera> -->

    <camera>
          <horizontal_fov>1.3962634</horizontal_fov>
          <image>
              <width>800</width>
              <height>800</height>
              <format>R8G8B8</format>
          </image>
          <clip>
              <near>0.02</near>
              <far>300</far>
          </clip>
      </camera>

      <plugin name="camera_controller" filename="libgazebo_dvs_plugin.so">
        <alwaysOn>true</alwaysOn>	
        <!-- <update_rate>60</update_rate> -->
        <update_rate>30.0</update_rate>
        <!-- <visualize>0</visualize> -->
        <visualize>$(arg camera_visual)</visualize>
        <updateRate>0.0</updateRate>
        <!-- <cameraName>mybot/camera1</cameraName> -->
         <cameraName>camera</cameraName>
	      <!-- <robotNamespace>/</robotNamespace> -->
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <eventThreshold>10</eventThreshold>
         <eventsTopicName>events</eventsTopicName>
        <!-- <frameName>camera</frameName> -->
         <frameName>camera_rgb_optical_frame</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

配置了一轮后,发现根本无法用。。。。

然后试试放到cm的工作空间中,cm一下,然后找到对应的.so文件,修改urdf如下,work了!

  <!-- camera -->
  <gazebo reference="camera_rgb_frame">
    <sensor type="camera" name="camera1">
      <!-- <update_rate>30.0</update_rate> -->
      <camera name='__default__'>
        <horizontal_fov>1.8</horizontal_fov>
        <image>
          <width>128</width>
           <height>128</height>
          <!-- <format>R8G8B8</format> -->
        </image>
        <clip>
          <near>0.1</near>
          <far>100</far>
        </clip>
        <!-- <noise>
          <type>gaussian</type>
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise> -->
      </camera>
      <update_rate>60</update_rate>
        <alwaysOn>1</alwaysOn>
         <visualize>0</visualize>
      <plugin name="camera_controller" filename="/home/kwanwaipang/catkin_ws/devel/lib/libgazebo_dvs_plugin.so">
        <!-- <alwaysOn>true</alwaysOn> -->
        <!-- <alwaysOn>1</alwaysOn> -->
        <!-- <update_rate>60</update_rate> -->
         <!-- <visualize>0</visualize> -->
        <!-- <updateRate>0.0</updateRate> -->
        <eventThreshold>10</eventThreshold>
        <cameraName>rrbot/camera1</cameraName>
        <robotNamespace>/</robotNamespace>
        <!-- <imageTopicName>image_raw</imageTopicName> -->
        <eventsTopicName>events</eventsTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <!-- <frameName>camera_rgb_optical_frame</frameName> -->
        <!-- <hackBaseline>0.07</hackBaseline> -->
        <!-- <distortionK1>0.0</distortionK1> -->
        <!-- <distortionK2>0.0</distortionK2> -->
        <!-- <distortionK3>0.0</distortionK3> -->
        <!-- <distortionT1>0.0</distortionT1> -->
        <!-- <distortionT2>0.0</distortionT2> -->
      </plugin>
    </sensor>
  </gazebo>

运行

roslaunch turtlebot3_navigation dvs_test.launch

对应的launch文件为:

<launch>
  <arg name="x_pos" default="-3.0"/>
  <arg name="y_pos" default="1.0"/>
  <arg name="z_pos" default="0.0"/>
  <arg name="gpu" default="false"/>

  <arg name="second_tb3_x_pos" default=" 7.0"/>
  <arg name="second_tb3_y_pos" default="-1.0"/>
  <arg name="second_tb3_z_pos" default=" 0.0"/>
  <arg name="second_tb3_yaw"   default=" 0.0"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="/$(find turtlebot3_gazebo)/worlds/turtlebot3_house.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>

  <param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_waffle_pi.urdf.xacro gpu:=$(arg gpu)" />

  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3 -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" />
  
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="30.0" />
  </node>

  </launch>

运行键盘控制使得场景与robot产生相对运动

rosrun turtlebot3_teleop turtlebot3_teleop_key

通过命令查看对应的topic

rostopic echo 

对应的launch也要修改topic name

roslaunch dvs_renderer davis_mono.launch
<launch>
  <!-- camera driver -->
  <node name="davis_ros_driver" pkg="davis_ros_driver" type="davis_ros_driver" />

  <!-- visualization -->
  <node name="dvs_renderer" pkg="dvs_renderer" type="dvs_renderer">
    <!-- <param name="display_method" value="grayscale"/> -->
    <param name="display_method" value="red-blue"/>
    <!-- <remap from="events" to="/dvs/events" /> -->
    <remap from="events" to="/camera1/events" />
    <remap from="image" to="/dvs/image_raw" />
    <remap from="camera_info" to="/dvs/camera_info" />
  </node>

  <!-- display -->
  <node name="image_view" pkg="rqt_image_view" type="rqt_image_view">
  	<remap from="image" to="dvs_rendering"/>
  </node>

  <!-- configure -->
  <node name="rqt_reconfigure" pkg="rqt_reconfigure" type="rqt_reconfigure" />

</launch>

视频效果如下:

dvs

参考资料

GitHub - HBPNeurorobotics/gazebo_dvs_plugin: This package provides a DVS simulation implemented as Gazebo plugin.
https://githubmemory.com/repo/HBPNeurorobotics/gazebo_dvs_plugin/issues
https://githubmemory.com/repo/HBPNeurorobotics/gazebo_dvs_plugin/issues/4

ros仿真笔记之——基于gazebo的多机器人探索环境仿真(代码片段)

...绍过一个名为explore_lite的机器人的包本博文对其进行gazebo仿真分析 目录实验修改地方的说明参考资料 实验首先在包clone下来(这个包设置为私密了,想下载的读者可以直接下载源包https://github.com/hrnr/m-explore然后再做相... 查看详情

ros学习笔记之——gazebo仿真(代码片段)

本博文是本人学习gazebo的学习记录。 Gazebo是一款3D仿真器,支持机器人开发所需的机器人、传感器和环境模型,并且通过搭载的物理引擎可以得到逼真的仿真结果。Gazebo是近年来最受欢迎的三维仿真器之一,并被选... 查看详情

ros实验笔记之——evo(代码片段)

...lyingroom"·Issue#4·uzh-rpg/rpg_dvs_evo_open·GitHub之前博客《ROS仿真笔记之——基于gazebo的eventcamera仿真(dvsgazebo)》介绍了DVS的gazebo仿真。博客《ROS学习笔记之——ESVO复现及DAVIS346测试》介绍了ESVO以及事件相 查看详情

ros仿真笔记之——基于rrt_exploration的单个机器人自主探索建图(代码片段)

...SLAMmapmerage《ROS学习笔记之——多机器人探索环境》《ROS仿真笔记之——基于gazebo的多机器人探索环境仿真》《ROS仿真笔记之——多移动机器人SLAM地图融合》《ROS仿真笔记之——移动机器人自主探索式地图构建》之前的都是基于... 查看详情

ros2+gazebo+opencv之mobot仿真视觉传感器(代码片段)

...xff08;2021共6套) 其中:使用机器人操作系统ROS2和仿真软件Gazebo9服务进阶实战(八)-mobot 查看详情

ros学习笔记之——基于qgc的px4仿真

之前博客《ROS实验笔记之——PX4仿真》已经介绍了PX4编译及QGC的安装,本博文进一步的基于QGC进行仿真控制QGC里有很多的参数控制首先打开虚拟的遥控器是实现遥控控制就可以在QGC用模拟手柄控制无人机(左边的遥感是... 查看详情

ros仿真笔记之——基于frontier_exploration的机器人自主探索

...客也尝试了不同的自主探索包,如rrt_exploration包《ROS仿真笔记之——基于rrt_exploration的单个机器人自主探索建图》与explore_lite包《ROS仿真笔记之——移动机器人自主探索式地图构建》。本博文尝试一下frontier_exploration包关于... 查看详情

ros和gazebo进行机器人仿真

Gazebo是一种多机器人仿真器,可用于室内外机器人仿真。Gazebo在ROS中有良好的接口,包含ROS和Gazebo的所有控制。若要实现ROS到Gazebo的通信,我们必须安装ROS-Gazebo接口。应该安装以下软件包:$sudoaptinstallros-melodic-gazebo-ros-pkgs ro... 查看详情

ros实验笔记之——px4仿真

...搭建了px4开发环境。本博文在ubuntu下对PX4进行一些基本的仿真学习~之前在做无人机仿真开发时《ROS实验笔记之——基于Prometheus自主无人机开源项目的学习与仿真》,已经安装了px4了~为此不需要 查看详情

gazebo机器人仿真流程之world类(代码片段)

...ate类的成员变量及成员函数。这里集中梳理一下,在Gazebo仿真场景(World)中,都有哪些东西。在Gazebo中,仿真相关的对象主要有以下几个:(1)物理引擎PhysicsEngine(2)模型Model(3)实体Entity(4)场景状态WorldState(5)插件Plug... 查看详情

ros实验笔记之——基于prometheus的无人机运动规划(代码片段)

...验笔记之——基于Prometheus自主无人机开源项目的学习与仿真》Demo演示基于2D-LiDAR的APF路径规划基于rgbdcamera的APF路径规划基于3D-LiDAR的Astar路径规划ego-planner对于ego-planner,直接下载源码编译即可。(源码连接& 查看详情

ros实验笔记之——基于cartographer的多机器人slam地图融合(代码片段)

之前博客《 ROS仿真笔记之——多移动机器人SLAM地图融合 》已经实现了基于gmapping的多机器人地图融合。实验和仿真都验证过了。本博文通过cartographer来实现SLAM,再做mapmerge先看视频效果two启动的文件#!/bin/bashgnome-terminal--tab... 查看详情

ros学习笔记之——px4位置环pid控制

之前博客《ROS学习笔记之——基于QGC的PX4在线仿真调PID》已经学习了如何在仿真环境下,调节PID位置环与姿态环。本博文细细的看一下PX4位置环PID调节如下图所示 参考资料 查看详情

rosgazebo使用解析

Gazebo是ROS中的一个实现物理仿真的工具包,gazebo本身就是一款机器人的仿真软件,基于ODE的物理引擎,可以模拟机器人以及环境中的很多物理特性。类似于rviz工具,在gazebo工具中也可以加载机器人模型。加载的步骤:安装gazebo... 查看详情

ros从入门到精通2-5:gazebo插件制作案例(带碰撞属性的多行人场景)(代码片段)

...精通》1Gazebo插件在ROS从入门到精通2-2:机器人3D物理仿真——Gazebo中介绍过Gazebo是一款3D物理仿真器,支持机器人开发所需的机器人、传感器和环境模型,并通过其搭载的强大物理引擎产生高品质的图形画面,达... 查看详情

ur5仿真学习笔记(代码片段)

UR5仿真学习笔记仿真环境搭建安装moveit安装UR5驱动启动Gazebo和rviz参考博客在ROS中完成UR5机械臂的仿真,记录学习过程仿真环境搭建安装moveit参考:Ubuntu18.04安装ros-melodic-moveitmoveit官方文档$sudoapt-getinstallros-melodic-moveit$source... 查看详情

ur5仿真学习笔记(代码片段)

UR5仿真学习笔记仿真环境搭建安装moveit安装UR5驱动启动Gazebo和rviz参考博客在ROS中完成UR5机械臂的仿真,记录学习过程仿真环境搭建安装moveit参考:Ubuntu18.04安装ros-melodic-moveitmoveit官方文档$sudoapt-getinstallros-melodic-moveit$source... 查看详情

ros之gazebo

<?xmlversion="1.0"?><launch><!--thesearetheargumentsyoucanpassthislaunchfile,forexamplepaused:=true--><argname="paused"default="true"/><argname="use_sim_time"default="false" 查看详情