Navigation2 Collision Monitor with Multiple Data Sources

asked 2023-06-12 21:33:31 -0500

elladuncan14 gravatar image

updated 2023-06-14 20:12:26 -0500

Hi there,

I am trying to setup NAV2 collision monitor with a lidar and radar working together, so I can use the system for a fuzzing technique. I am a software/security person, and do not have a whole lot of experience with the physical aspects of ROS. I tried altering the turtlebot3_waffle.urdf to add a radar, but when I launch the tb3_simulation, I can't see the component in Gazebo. I am certain that what I have is not right as I only added a couple lines of code that I based off the given base_scan. I am hoping someone could help me complete the URDF correctly, and help me confirm what topic this simulated radar will be published to. Any help would be very appreciated, thank you so much!


What I added to the turtlebot3_waffle.urdf, directly after the base_scan lines:


 <!--Modification: Here we add the joint and link for the front IR sensor-->

  <joint name="ir_front_joint" type="fixed">
    <parent link="base_link"/>
    <child link="base_ir_front"/>
    <origin rpy="0 0 0" xyz="0.5 0 0"/>
    <axis xyz="0 1 0" />
  </joint>

  <link name="base_ir_front">
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.01 0.01 0.01"/>
      </geometry>
      <material name="dark"/>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.01 0.01 0.01"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0"
               iyy="1e-6" iyz="0"
               izz="1e-6" />
    </inertial>
  </link>

  <!--End of Modification-->


  <!--Modification: Here we add the plugin for the IR sensor-->
  <gazebo reference="base_ir_front">    
    <sensor type="gpu_ray" name="range_sensor">
    <ray>
      <scan>
        <horizontal>
          <samples>10</samples>
          <resolution>1</resolution>
          <min_angle>-0.087</min_angle>
          <max_angle>0.087</max_angle>
        </horizontal>
        <vertical>
          <samples>10</samples>
          <resolution>1</resolution>
          <min_angle>-0.087</min_angle>
          <max_angle>0.087</max_angle>
        </vertical>
      </scan>
      <range>
        <min>0.10</min>
        <max>5.0</max>
        <resolution>0.01</resolution>
      </range>
      <!-- Using gazebo's noise instead of plugin's -->
      <noise>
        <type>gaussian</type>
        <mean>0.0</mean>
        <stddev>0.01</stddev>
      </noise>
    </ray>
    <!-- Using gazebo's update rate instead of plugin's -->
    <update_rate>30</update_rate>
    <plugin name="gazebo_ros_range_controller" filename="libgazebo_ros_ray_sensor.so">
      <!-- Change namespace and output topic so published topic is /rrbot/laser/scan -->
      <ros>
        <!--namespace>/rrbot</namespace-->
        <remapping>~/out:=range</remapping>
      </ros>
      <!-- Set output to sensor_msgs/Range to get same output type as gazebo_ros_range -->
      <output_type>sensor_msgs/Range</output_type>
      <!-- <frame_name> ommited, will default to range_link -->
      <frame_name>base_ir_front</frame_name>
    </plugin>
  </sensor> 
  </gazebo>
  <!--End of plugin Modification-->

Once I run the initial Nav2 simualtion (ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False) and examine the ros topic lists, I can see that this range topic is not showing up. See topic list below:

...
/mobile_base/sensors/bumper_pointcloud
/odom
/parameter_events
/particle_cloud
/performance_metrics
/plan ...
(more)
edit retag flag offensive close merge delete