ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to use the functions of Navigation Stack separately?

asked 2016-04-15 03:45:36 -0500

kai1006 gravatar image

updated 2016-04-27 10:55:55 -0500

Hi all,

I am interested in navigation on mobile robots. Following this tutorial I have successfully simulated the mobile robot running on rviz by given 2D Nav Goal. The rqt_graph is as attached.

However I want to test and learn how to use the functions inside the move_base package separately. I have no idea how to get the rqt_graph inside the move_base.

More specifically, if I want to test the global planner(or local planner) alone, which information(topics) I should give?
I am trying to use

rosnode info /node_name

to guess which topics I may receive and which to publish, but it doesn't seem to be a good way.

My launch file is

<launch>
  <master auto="start"/>

  <!-- Run the map server -->
  <arg name="map_file" default="$(find robot)/yaml/map.yaml"/>
  <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

  <node pkg="global_planner" type="planner" respawn="false" name="planner" output="screen" />
  <node pkg="costmap_2d" type="costmap_2d_node" respawn="false" name="costmap_2d_node" />

  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot)/rviz/config.rviz"/>

</launch>

I think there is still some works to do like remapping the topic names. Could anyone give me some hints?

edit retag flag offensive close merge delete

Comments

Please, create a new question from your revised one. The way it looks now is you ask about planners (which has been answered) and then creates another question about costmaps, which is answered by yourself.

Procópio gravatar image Procópio  ( 2016-04-27 06:10:46 -0500 )edit

sorry, thanks for your advice.

kai1006 gravatar image kai1006  ( 2016-04-27 10:57:26 -0500 )edit

2 Answers

Sort by » oldest newest most voted
4

answered 2016-04-15 06:31:42 -0500

jorge gravatar image

updated 2016-04-15 09:56:34 -0500

Afaik, move_base always work as a single ROS node, so you cannot do such a thing. The internal components are of two types:

  • plugins loaded at startup (but cannot be changed at runtime, I think) as the local or global planners, recovery behaviors, etc.
  • fixed components as the global and local costmaps.

But all the communications within move_base are function calls, no ROS messages at all.

That said, you can instantiate any of these components in your own nodes, for example create a costmap for your own navigation. See Component API section at the bottom of move_base wiki

edit flag offensive delete link more

Comments

1

jorge, I think you meant to link to http://wiki.ros.org/move_base or http://wiki.ros.org/costmap_2d

spmaniato gravatar image spmaniato  ( 2016-04-15 09:18:26 -0500 )edit

exactly, thanks! (fixed)

jorge gravatar image jorge  ( 2016-04-15 09:57:10 -0500 )edit

Thanks for your reply. Sorry for not replying immediately. I spend some time reread the costmap_2d.

kai1006 gravatar image kai1006  ( 2016-04-16 06:01:51 -0500 )edit

In fact, I don’t intend to use the global_planner package alone. My intention is to test every function properly. So if I want to test the global planner, I only need to subscribe the /move_base/NavfnROS/plan and close the marking and clearing function right?

kai1006 gravatar image kai1006  ( 2016-04-16 06:04:14 -0500 )edit
3

answered 2016-10-13 05:59:50 -0500

abrzozowski gravatar image

updated 2016-10-17 16:23:53 -0500

I think you should be able to run the standalone global_planner like so:

<?xml version="1.0"?>
<launch>
    <master auto="start"/>

    <arg name="global_frame" default="/map"/>
    <arg name="robot_base_frame" default="base_link"/>

    <node pkg="tf" type="static_transform_publisher" name="base_link_to_map"
        args="0.0 0.0 0.0 0.0 0.0 0.0 $(arg robot_base_frame) $(arg global_frame) 40" />

    <node pkg="navfn" type="navfn_node" respawn="false" name="planner" output="screen">
        <param name="navfn_planner/visualize_potential" value="true" />
        <param name="navfn_planner/allow_unknown" value="true" />
        <param name="navfn_planner/planner_window_x" value="0.0" />
        <param name="navfn_planner/planner_window_y" value="0.0" />
        <param name="navfn_planner/default_tolerance" value="0.0" />

    <!-- or global_planner -->
     <!--<node pkg="global_planner" type="planner" respawn="false" name="planner" output="screen">
        <param name="planner/old_navfn_behavior" value="false" />
        <param name="planner/use_quadratic" value="true" />
        <param name="planner/use_dijkstra" value="true" />
        <param name="planner/use_grid_path" value="false" />
        <param name="planner/allow_unknown" value="true" />
        <param name="planner/planner_window_x" value="0.0" />
        <param name="planner/planner_window_y" value="0.0" />
        <param name="planner/default_tolerance" value="0.0" />
        <param name="planner/publish_scale" value="100" /> -->

        <remap from="/planner/goal" to="/move_base_simple/goal" />

        <!--costmap-->
            <!--required-->
            <param name="costmap/global_frame" value="$(arg global_frame)"/>
            <param name="costmap/robot_base_frame" value="$(arg robot_base_frame)"/>
            <param name="costmap/origin_x" value="-5.0"/>
            <param name="costmap/origin_y" value="-5.0"/>
            <!--optional-->
            <param name="costmap/width" value="10.0"/>
            <param name="costmap/height" value="10.0"/>
            <param name="costmap/resolution" value="0.05"/>
            <param name="costmap/transform_tolerance" value="0.2"/>
            <param name="costmap/update_frequency" value="5.0"/>
            <param name="costmap/publish_frequency" value="0.0"/>
            <param name="costmap/transform_tolerance" value="0.2"/>
            <param name="costmap/rolling_window" value="false"/>
            <param name="costmap/track_unknown_space" value="false"/>
            <param name="costmap/always_send_full_costmap" value="false"/>
            <param name="costmap/footprint_padding" value="0.0"/>
            <param name="costmap/robot_radius" value="0.5"/>
    </node>

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

Minimal move_base roslaunch file can look like:

<launch>
    <node pkg="tf" type="static_transform_publisher" name="base_link_to_map"
        args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /map 40" />

    <arg name="base_global_planner" default="navfn/NavfnROS"/>
    <arg name="base_local_planner" default="dwa_local_planner/DWAPlannerROS"/>
    <!-- <arg name="base_local_planner" default="base_local_planner/TrajectoryPlannerROS"/> -->

    <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
        <param name="base_global_planner" value="$(arg base_global_planner)"/>
        <param name="base_local_planner" value="$(arg base_local_planner)"/>  

        <param name="local_costmap/width" value="10.0"/>
        <param name="local_costmap/height" value="10.0"/>
        <param name="local_costmap/origin_x" value="-5.0"/>
        <param name="local_costmap/origin_y" value="-5.0"/>

        <param name="global_costmap/width" value="20.0"/>
        <param name="global_costmap/height" value="20.0"/>
        <param name="global_costmap/origin_x" value="-10.0"/>
        <param name="global_costmap/origin_y" value="-10.0"/>
    </node>
    <node pkg="rviz" type="rviz" name="rviz"/>
</launch>

Have fun!

edit flag offensive delete link more

Comments

Works great! Thanks

burakaksoy gravatar image burakaksoy  ( 2023-07-29 13:59:31 -0500 )edit

Question Tools

4 followers

Stats

Asked: 2016-04-15 03:45:36 -0500

Seen: 1,261 times

Last updated: Oct 17 '16