hasauino / rrt_exploration

A ROS package that implements a multi-robot RRT-based map exploration algorithm. It also has the image-based frontier detection that uses image processing to extract frontier points.
http://wiki.ros.org/rrt_exploration
MIT License
513 stars 180 forks source link

How to launch rrt_exploration package for MiR using simple.launch #5

Closed christenbc closed 5 years ago

christenbc commented 5 years ago

Hello Hasauino. I am trying to test your package in an industrial mobile robot as part of my thesis. Here, this device launches the navigation stack automatically so the case is slightly different. I managed to run gmapping and it does without problems. So, at this point as everything is set up properly I am trying to launch your package.

I saw that you made the proper modifications for a unique robot so I don't need to make any modifications and mappings of the topics related with robot_1.

So what I've tried so far the following procedure:

From the mir_robot which provides IP bridging, remapping and removing of topics,... stuff that makes possible a good connection between my computer and the robot.

roslaunch mir_driver mir.launch disable_map:=true

Now I roslaunch this launcher I have created to execute gmapping, rviz and setting use_sim_time = false:

<launch>

  <param name="use_sim_time" value="false" />

  <arg name="scan_topic" default="/f_scan" />

  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">

    <param name="odom_frame" value="odom"/>
    <param name="base_frame" value="base_link"/>
    <param name="map_frame" value="map"/>

    <!-- Process 1 out of every this many scans (set it to a higher number to skip more scans)  -->
    <param name="throttle_scans" value="1"/>

    <param name="map_update_interval" value="5.0"/> <!-- default: 5.0 -->

    <!-- The maximum usable range of the laser. A beam is cropped to this value.  -->
    <param name="maxUrange" value="5.0"/>

    <!-- The maximum range of the sensor. If regions with no obstacles within the range of the sensor should appear as free space in the map, set maxUrange < maximum range of the real sensor <= maxRange -->
    <param name="maxRange" value="10.0"/>

    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="minimumScore" value="0.0"/>
    <!-- Number of beams to skip in each scan. -->
    <param name="lskip" value="0"/>

    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>

    <!-- Process a scan each time the robot translates this far  -->
    <param name="linearUpdate" value="0.1"/>

    <!-- Process a scan each time the robot rotates this far  -->
    <param name="angularUpdate" value="0.05"/>

    <param name="temporalUpdate" value="0.1"/>
    <param name="resampleThreshold" value="0.5"/>

    <!-- Number of particles in the filter. default 30        -->
    <param name="particles" value="10"/>

    <!-- Initial map size  -->
    <param name="xmin" value="-10.0"/>
    <param name="ymin" value="-10.0"/>
    <param name="xmax" value="10.0"/>
    <param name="ymax" value="10.0"/>

    <!-- Processing parameters (resolution of the map)  -->
    <param name="delta" value="0.02"/>

    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>

    <remap from="scan" to="$(arg scan_topic)"/>
  </node>

  <node pkg="rviz" type="rviz" name="rviz" />

</launch>

And finally the last thing I do is:

roslaunch rrt_exploration simple.launch

The problem comes when I try to publish the points in RViz, there won't appear any of them RViz so they won't be published and your algorithm won't run. What am I doing wrong?

hasauino commented 5 years ago

Hi chbloca, I would first check the topic names on which Rviz publishes clicked points, which you use to define the area. The global and local detectors expect the points to be published on /clicked_point. This topic is by default the topic name Rviz publishes any clicked point. Most likely this is not your problem.

The second thing you need to check, whether you visualize Markers on Rviz. The detectors publish Marker messages on /global_detector_shapes and /local_detector_shapes.

I have added a launch file in the rrt_exploration_tutorials package, for launching a robot without name prefix. It uses a Rviz config file to visualize everything correctly. You may need to make changes according to your topic names. For example, the laser scan topic name of yours is different. You may optionally change it to /base_scan, Or modify the Rviz config file, line 242. (but this is not necessary, only if you wish to visualize the laser scans) If the problem still persists, can you show me all the topic names when you run your system?

christenbc commented 5 years ago

I just added this line in the launcher I posted:

<node pkg="rviz" type="rviz" name="rviz" args="-d $(find rrt_exploration_tutorials)/launch/includes/rviz_config/simple.rviz">
  </node>

Now with the RViz running your custom configuration it works! Just the rrt algorithm, but the robot won't move.

sketch

Here are the list of topics:

c b

Are the command move orders based on 2D Nav Goal? Because when I try to send orders manually to the robot with 2D Nav Goal, it won't move. Maybe that's the problem. So if I manage to solve this, will it work? Or what might be another problem? Thanks for your quick answer, Hasauino. PD: I don't want Gazebo to open, I don't need it.

hasauino commented 5 years ago

Can you also show me your tf tree, all the frames? and also your rosservice list

Why is the global costmap not showing? in your first picture, Rviz is showing an error or a warning for the global cost map (marked in orange)?

When you publish Nav goal, what topic do you use?

why do you have two actions for the move base, move_base action and relative_move_action?

christenbc commented 5 years ago

I will try to answer your questions and provide your the rosservice list tomorrow when I have access again to the robot. Meanwhile, here I provide you the tf tree and the frames. The second rqt graph is a simplified version of the whole picture with move_base_node filter rosgraph full with launcher rosgraph with launcher frames with launcher.pdf

christenbc commented 5 years ago

Here is the rosservice list:

1

The topic used to send Nav goal is: /move_base_simple/goal move_base action is for the navigation stack relative_move_action is a feature built-in the robot which provides the posibility of moving it with a virtual joystick as if it was a "rosrun teleop_twist_keyboard teleop_twist_keyboard.py" but smoother.

hasauino commented 5 years ago

Hi chbloca, It looks like both the filter and the assigner nodes are not running. I first will list what both of these nodes depend on. Then I will try to expect what your setup is missing.

1-Filter node:

It depends on:

2-Assigner node:

it depends on:

What I think is missing in your setup:

-/move_base_node/NavfnROS/make_plan service. In your rosservice list it was not there. I also don't see other navigation stack services. They are not required though.

Rviz tools properties panel

christenbc commented 5 years ago

Ok, problem solved. The problems were that I didn't include the move_base node in the launcher and that the resolution of the gmapping was too high (delta parameter) so it had a tremendous impact laptop which caused lags and TF OLD DATA. Adjusting some parameters I got this launcher which works perfectly.

<launch>

  <param name="use_sim_time" value="false" />

  <arg name="scan_topic" default="/f_scan" />
  <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">

    <param name="odom_frame" value="odom"/>
    <param name="base_frame" value="base_link"/>
    <param name="map_frame" value="map"/>

    <!-- Process 1 out of every this many scans (set it to a higher number to skip more scans)  -->
    <param name="throttle_scans" value="1"/>

    <param name="map_update_interval" value="2.0"/> <!-- default: 5.0 -->

    <!-- The maximum usable range of the laser. A beam is cropped to this value.  -->
    <param name="maxUrange" value="5.0"/>

    <!-- The maximum range of the sensor. If regions with no obstacles within the range of the sensor should appear as free space in the map, set maxUrange < maximum range of the real sensor <= maxRange -->
    <param name="maxRange" value="10.0"/>

    <param name="sigma" value="0.05"/>
    <param name="kernelSize" value="1"/>
    <param name="lstep" value="0.05"/>
    <param name="astep" value="0.05"/>
    <param name="iterations" value="5"/>
    <param name="lsigma" value="0.075"/>
    <param name="ogain" value="3.0"/>
    <param name="minimumScore" value="0.0"/>
    <!-- Number of beams to skip in each scan. -->
    <param name="lskip" value="0"/>

    <param name="srr" value="0.01"/>
    <param name="srt" value="0.02"/>
    <param name="str" value="0.01"/>
    <param name="stt" value="0.02"/>

    <!-- Process a scan each time the robot translates this far  -->
    <param name="linearUpdate" value="0.1"/>

    <!-- Process a scan each time the robot rotates this far  -->
    <param name="angularUpdate" value="0.05"/>

    <param name="temporalUpdate" value="0.1"/>
    <param name="resampleThreshold" value="0.5"/>

    <!-- Number of particles in the filter. default 30        -->
    <param name="particles" value="10"/>

    <!-- Initial map size  -->
    <param name="xmin" value="-5.0"/>
    <param name="ymin" value="-5.0"/>
    <param name="xmax" value="5.0"/>
    <param name="ymax" value="5.0"/>

    <!-- Processing parameters (resolution of the map)  -->
    <param name="delta" value="0.1"/>

    <param name="llsamplerange" value="0.01"/>
    <param name="llsamplestep" value="0.01"/>
    <param name="lasamplerange" value="0.005"/>
    <param name="lasamplestep" value="0.005"/>

    <remap from="scan" to="$(arg scan_topic)"/>
  </node>

  <arg name="namespace" value=""/>
  <node pkg="move_base" type="move_base" respawn="false" name="move_base_node" output="screen">
    <param name="footprint_padding" value="0.01" />
    <param name="controller_frequency" value="5.0" />
    <param name="controller_patience" value="3.0" />
    <param name="oscillation_timeout" value="30.0" />
    <param name="oscillation_distance" value="0.5" />
    <param name="planner_patience" value="1" />
    <param name="controller_patience" value="1" /> 
    <remap from="cmd_vel" to="mobile_base/commands/velocity"/>
    <param name="recovery_behavior_enabled" value="false" />
    <rosparam file="$(find rrt_exploration_tutorials)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find rrt_exploration_tutorials)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find rrt_exploration_tutorials)/param/local_costmap_params.yaml" command="load" />
    <rosparam file="$(find rrt_exploration_tutorials)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find rrt_exploration_tutorials)/param/base_local_planner_params.yaml" command="load" />  
    <param name="global_costmap/global_frame" value="$(arg namespace)/map"/>
    <param name="global_costmap/robot_base_frame" value="$(arg namespace)/base_link"/>
    <param name="global_costmap/laser_scan_sensor/sensor_frame" value="/$(arg namespace)/base_laser_link"/>
    <param name="global_costmap/laser_scan_sensor/topic" value="/$(arg namespace)/$(arg scan_topic)"/>    
    <param name="local_costmap/global_frame" value="$(arg namespace)/odom"/>
    <param name="local_costmap/robot_base_frame" value="$(arg namespace)/base_link"/>
    <param name="local_costmap/laser_scan_sensor/sensor_frame" value="$(arg namespace)/front_laser_link"/>
    <param name="local_costmap/laser_scan_sensor/topic" value="/$(arg namespace)/$(arg scan_topic)"/>
    <param name="local_costmap/obstacle_layer/laser_scan_sensor/topic" value="/$(arg namespace)/$(arg scan_topic)"/>
  </node>

  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find rrt_exploration_tutorials)/launch/includes/rviz_config/simple.rviz">
  </node>

</launch>

Thank you very much Hasauino for your support.

hasauino commented 5 years ago

Ok great!  :thumbsup: glad it finally worked. I will close this issue now. thanks for providing this launch file, I think it might be helpful for others running through the same problem