Robotics StackExchange | Archived questions

nav2d Multi Agent Exploration

Platform: Ubuntu 18.04 VM on VirtualBox

I've read this thread and I am trying to do the same thing. I've completed tutorials 1-3 and I noticed that something has changed regarding nav2d services. rosservice call /StartMapping 3 would fail in tutorial 3 while rosservice call /StartMapping would not. It would raise an exception that no parameters were expected.

So when moving onto "combining" tutorials 3 and 4 to get multi agent exploration by following the configuration and steps in the thread linked. I used rosservice call /robot_0/StartMapping instead of rosservice call /robot_0/StartMapping 3 as the latter would fail.

Pictured is the output I would get running the recommended commands after adding the Operator, Navigator and the ActionClients to both robot namespaces.rosservice call /robot_0/StartMapping would not move robot_0 like it would in tutorial 3. I even tried copying tutorial 3's mapper over to each robots namespace with no luck.

Considering that the question was asked 6 years ago has anything changed that I'm missing here? Has anyone encountered a similar issue?

Here is the edited tutorial4 launch file:

<launch>

<!-- Some general parameters -->
<param name="use_sim_time" value="true" />

<!-- Start Stage simulator with a given environment -->
<node name="Stage" pkg="stage_ros" type="stageros" args="$(find nav2d_tutorials)/world/tutorial4.world">
    <param name="base_watchdog_timeout" value="0" />
</node>

<!-- Start the joystick-driver and remote-controller for operation-->
<node name="Joystick" pkg="joy" type="joy_node" />
<node name="Remote" pkg="nav2d_remote" type="remote_joy" />

<node name="R0_MapAlign" pkg="tf" type="static_transform_publisher" args="0 0 0 0 0 0 /map /robot_0/map 100"/>
<node name="R1_MapAlign" pkg="tf" type="static_transform_publisher" args="40 0 0 0 0 0 /map /robot_1/map 100"/>

<group ns="robot_0">
    <param name="robot_id" value="1" />
    <param name="tf_prefix" type="string" value="robot_0"/>
    <rosparam file="$(find nav2d_tutorials)/param/ros.yaml"/>

    <!-- Start the Operator to control the simulated robot -->
    <node name="Operator" pkg="nav2d_operator" type="operator" >
        <remap from="scan" to="base_scan"/>
        <rosparam file="$(find nav2d_tutorials)/param/operator.yaml"/>
        <rosparam file="$(find nav2d_tutorials)/param/costmap.yaml" ns="local_map" />
    </node>

    <!-- Start the Navigator to move the robot autonomously -->
    <node name="Navigator" pkg="nav2d_navigator" type="navigator">
        <rosparam file="$(find nav2d_tutorials)/param/navigator.yaml"/>
    </node>

    <node name="GetMap" pkg="nav2d_navigator" type="get_map_client" />
    <node name="Explore" pkg="nav2d_navigator" type="explore_client" />
    <node name="SetGoal" pkg="nav2d_navigator" type="set_goal_client" />

    <node name="Mapper" pkg="nav2d_karto" type="mapper">
        <remap from="scan" to="base_scan"/>
        <rosparam file="$(find nav2d_tutorials)/param/mapper.yaml"/>
    </node>

    <!-- Commenting Out
    <node name="Mapper" pkg="nav2d_karto" type="mapper">
        <remap from="scan" to="base_scan"/>
        <remap from="karto_in" to="/shared_scans_r2"/>
        <remap from="karto_out" to="/shared_scans_r1"/>
        <rosparam file="$(find nav2d_tutorials)/param/mapper.yaml"/>
    </node>
    -->

</group>

<group ns="robot_1">
    <param name="robot_id" value="2" />
    <param name="tf_prefix" type="string" value="robot_1"/>
    <rosparam file="$(find nav2d_tutorials)/param/ros.yaml"/>

    <!-- Start the Operator to control the simulated robot -->
    <node name="Operator" pkg="nav2d_operator" type="operator" >
        <remap from="scan" to="base_scan"/>
        <rosparam file="$(find nav2d_tutorials)/param/operator.yaml"/>
        <rosparam file="$(find nav2d_tutorials)/param/costmap.yaml" ns="local_map" />
    </node>

    <!-- Start the Navigator to move the robots autonomously -->
    <node name="Navigator" pkg="nav2d_navigator" type="navigator">
        <rosparam file="$(find nav2d_tutorials)/param/navigator.yaml"/>
    </node>

    <node name="GetMap" pkg="nav2d_navigator" type="get_map_client" />
    <node name="SetGoal" pkg="nav2d_navigator" type="set_goal_client" />
    <node name="Localize" pkg="nav2d_navigator" type="localize_client" />
    <node name="Explore" pkg="nav2d_navigator" type="explore_client" />

    <node name="Mapper" pkg="nav2d_karto" type="mapper">
        <remap from="scan" to="base_scan"/>
        <rosparam file="$(find nav2d_tutorials)/param/mapper.yaml"/>
    </node>

    <!-- Commenting Out
    <node name="Mapper" pkg="nav2d_karto" type="mapper">
        <remap from="scan" to="base_scan"/>
        <remap from="karto_in" to="/shared_scans_r1"/>
        <remap from="karto_out" to="/shared_scans_r2"/>
        <rosparam file="$(find nav2d_tutorials)/param/mapper.yaml"/>
    </node>
    -->

</group>

<!-- RVIZ to view the visualization -->
<node name="RVIZ" pkg="rviz" type="rviz" args=" -d $(find nav2d_tutorials)/param/tutorial4.rviz" />

Thank you!

Asked by GageAsch on 2020-09-15 19:29:03 UTC

Comments

Answers

About the StartMapping service, the parameter was indeed removed some years ago, so it's just called with no params now.

About the error message you receive I cannot really say much about it. Have you checked ros-console whether there are any errors or warnings when you call StartMapping on robot_0?

Asked by Sebastian Kasperski on 2021-01-18 05:59:27 UTC

Comments