ROS仿真笔记之——基于gazebo的event camera仿真(dvs gazebo)
Posted gwpscut
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ROS仿真笔记之——基于gazebo的event camera仿真(dvs gazebo)相关的知识,希望对你有一定的参考价值。
首先安装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的event camera仿真(dvs gazebo)的主要内容,如果未能解决你的问题,请参考以下文章
ROS仿真笔记之——基于rrt_exploration的单个机器人自主探索建图