HBPNeurorobotics / gazebo_dvs_plugin

This package provides a DVS simulation implemented as Gazebo plugin.
GNU General Public License v2.0
31 stars 16 forks source link

Can't Use this Plugin in a Gazebo Turtlebot world #4

Closed meera-m-t closed 4 years ago

meera-m-t commented 4 years ago

Hey, Thank you for open sourcing your dvs plugin for gazebo simulations.

I tried to configure your plugin by installing all dvs ros drivers as well as your repository and changed the camera sensor to use this plugin. However, when I use the camera with your plugin gazebo_dvs_plugin.so there simply are no events to subscribe to and I cannot see any images. To be specific I have used the following configuration in my URDF file. I cannot see any Images in rqt or any other places. Replacing this with normal cotroller works. my environment (Gazebo9+ros-melodic+Ubuntu18.04).


<gazebo reference="camera">
    <material>Gazebo/Green</material>
    <sensor type="camera" name="camera1">
      <update_rate>30.0</update_rate>
      <camera name="head">
        <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>
        <visualize>0</visualize>
        <updateRate>0.0</updateRate>
        <eventThreshold>0</eventThreshold>
        <cameraName>mybot/camera1</cameraName>
    <robotNamespace>/</robotNamespace>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>camera</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>

The output of rostopic-list is:


~/mybot_ws$ rostopic list -v

Published topics:
 * /gazebo/link_states [gazebo_msgs/LinkStates] 1 publisher
 * /rosout [rosgraph_msgs/Log] 2 publishers
 * /mybot/laser/scan [sensor_msgs/LaserScan] 1 publisher
 * /rosout_agg [rosgraph_msgs/Log] 1 publisher
 * /gazebo/model_states [gazebo_msgs/ModelStates] 1 publisher
 * /clock [rosgraph_msgs/Clock] 1 publisher
 * /gazebo/parameter_descriptions [dynamic_reconfigure/ConfigDescription] 1 publisher
 * /mybot/camera1/events [dvs_msgs/EventArray] 1 publisher
 * /tf [tf2_msgs/TFMessage] 1 publisher
 * /odom [nav_msgs/Odometry] 1 publisher
 * /gazebo/parameter_updates [dynamic_reconfigure/Config] 1 publisher

Subscribed topics:
 * /clock [rosgraph_msgs/Clock] 3 subscribers
 * /gazebo/set_model_state [gazebo_msgs/ModelState] 1 subscriber
 * /rosout [rosgraph_msgs/Log] 1 subscriber
 * /cmd_vel [geometry_msgs/Twist] 1 subscriber
 * /gazebo/set_link_state [gazebo_msgs/LinkState] 1 subscriber

It looks like the events are being published but the recording a rosbag and playing it with dvs_renderer doesn't show any images image

jackokaiser commented 4 years ago

Hi Sameerah,

Your issue is in your ROS setup and not specific to this plugin. Here some clarification on what's happening:

  1. in your urdf file, you have a <imageTopicName> tag, but no <eventsTopicName>, so the events are published to the default topic (this is fine). We can see the events topic in the output of your rostopic list:
    * /mybot/camera1/events [dvs_msgs/EventArray] 1 publisher
  2. You could check that events are indeed published with rostopic echo /mybot/camera1/events. If no events are published, make sure the robot or the environment is in motion.
  3. Events can not be directly visualized by rqt_image_view - which can only visualize sensor_msgs/Image message. Instead, events are published as dvs_msgs/EventArray messages. You can get more information about this type with:
    rosmsg show dvs_msgs/EventArray
  4. You can convert events to images with the dvs_renderer as you mentioned, but you need to make sure that the ROS topics are connected correctly. The dvs_renderer is a node, which needs to listen to the events (topic /mybot/camera1/events) and will publish a sensor_msgs/Image on a different topic. To connect the ros topics corretly use topic remapping:
    rosrun dvs_renderer dvs_renderer /events:=//mybot/camera1/events

    You can also use the <remap> tag in a launch file. By default, images will be published on the topic /dvs_rendering, which you can also remap the same way.

meera-m-t commented 4 years ago

Screenshot from 2020-04-07 15-10-15 Screenshot from 2020-04-07 15-11-07

Thank you. I followed your instructions , and I had small mistakes I fixed it now it is working correctly.