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

Robot is not moving to goal

asked 2018-06-15 12:21:04 -0600

topkek gravatar image

updated 2018-08-01 13:24:23 -0600

I have a simulation in gazebo with two robots. I launch navigation file so i can send goals to a robot. I use this command to move robot to a goal

rostopic pub /r2/move_base_simple/goal geometry_msgs/PoseStamped '{header: {stamp: now, frame_id: "map"}, pose: {position: {x: 3.0, y: 2.0, z: 0.0}, orientation: {w: 1.0}}}'

robot looks lost in space and is randomly moving.

graph: image description

frames: https://files.fm/u/7gzgncpa

I want robot to move to its goal when i send the command.

Here's the launch file to launch two robots in gazebo simulation

<launch>

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



  <!-- Run GAZEBO World -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find multi_pioneer)/worlds/clearpath_playpen.world"/> <!-- world_name is wrt GAZEBO_RESOURCE_PATH environment variable -->
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>

  <!-- Robot1 with diff drive -->
  <include file="$(find multi_pioneer)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r1" />
    <arg name="robot_position" value="-x 0.0 -y -0.5 -z 0.0 -R 0 -P 0 -Y +1.57" />
  </include>

  <!-- Robot2 with diff drive -->
  <include file="$(find multi_pioneer)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r2" />
    <arg name="robot_position" value="-x 0.0 -y 0.5 -z 0.0 -R 0 -P 0 -Y -1.57" />
  </include>



</launch>

Launch file to spawn a single robot

<launch>

  <arg name="robot_name" default="p3dx" />
  <arg name="robot_position" default="-x 0.0 -y 0.0 -z 0.01" />


  <group ns="$(arg robot_name)">

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find multi_pioneer)/xacro/p3dx/pioneer3dx.xacro'" />

    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model $(arg robot_name) -param robot_description $(arg robot_position) "/>

    <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher">
      <param name="publish_frequency" type="double" value="30.0"/>
      <param name="tf_prefix" type="string" value="$(arg robot_name)"/>
    </node>
  </group>

</launch>

File to launch navigation

<launch>
 <node name="map_server" pkg="map_server" type="map_server" args="$(find multi_pioneer)/maps/playpen_map.yaml" output="screen">
    <param name="frame_id" value="/map" />
  </node>

<!-- Robot 1 Localization & Navigation -->
  <include file="$(find multi_pioneer)/launch/navigation.launch">
    <arg name="tf_prefix" value="r1"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="1.57"/>
  </include>

  <!-- Robot 2 Localization & Navigation -->
  <include file="$(find multi_pioneer)/launch/navigation.launch">
    <arg name="tf_prefix" value="r2"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="-1.57"/>
  </include>

 <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r1" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r1/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r2" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r2/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args ...
(more)
edit retag flag offensive close merge delete

Comments

  1. move_base publishes action related topics (e.g., /move_base/status). Can you verify that when you send your goal the move_base action server is registering it?

  2. Can you verify that your Husky is subscribed to the correct /cmd_vel topic? And check if anything is being published on it

stevejp gravatar image stevejp  ( 2018-06-16 11:28:58 -0600 )edit
  1. Yes, i can verify that move_base action server is registering it. I can see in move base terminal message ' Got new plan'. I can also see that topic like /husky2/move_base_simple/goal is echoing correct position and orientation...
  2. Yes, /husky2/cmd_vel topic changes linear x to 0.5
topkek gravatar image topkek  ( 2018-06-18 04:33:23 -0600 )edit

What are your planner parameter? Somewhere one should get current position of the robot in the move_base...

What if you try to publish odom on "husky2/odom"? since you are using "husky2" as group namespace. Are you shure that parameter "tf_prefix" should not be defined under node "move_base"?

destogl gravatar image destogl  ( 2018-06-24 16:02:05 -0600 )edit

husky2/odom gives an error. tf_prefix definitely has to be before move_base node

topkek gravatar image topkek  ( 2018-06-25 11:30:43 -0600 )edit

there is missing information how do you start your husky1 robot. Can you post your frames and node graph?

destogl gravatar image destogl  ( 2018-06-29 01:14:04 -0600 )edit
topkek gravatar image topkek  ( 2018-06-29 02:56:08 -0600 )edit

@topkek Can you please add those files directly into the question. That way the question will be self-contained and if/when those external links disappear your question will not lose any information.

jayess gravatar image jayess  ( 2018-06-29 04:03:32 -0600 )edit

Can you update launch files, node graph (in "Node/Topic (all)" option) and error message in the question? Do that we can follow easier.

nightwish gravatar image nightwish  ( 2018-06-29 11:45:26 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-06-30 17:56:57 -0600

nightwish gravatar image

updated 2018-06-30 17:58:12 -0600

These are my launch files working well in simulation with P3-DX robot. They was made by following this question. At first I got the same problem as this question and I successfully managed to fix this. Hope these can help you.

multiple_robot.launch

<launch>

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

  <!-- Run GAZEBO World -->
  <include file="$(find multi_robot_scenario)/launch/gazebo_world.launch">
    <arg name="gui" value="false"/>
  </include>

  <!-- Robot1 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r1" />
    <arg name="robot_position" value="-x 0.0 -y -0.5 -z 0.0 -R 0 -P 0 -Y +1.57" />
  </include>

  <!-- Robot2 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r2" />
    <arg name="robot_position" value="-x 0.0 -y 0.5 -z 0.0 -R 0 -P 0 -Y -1.57" />
  </include>

  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r1" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r1/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r2" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r2/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 map odom 100" />

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find robot_setup_tf)/maps/map.yaml" output="screen">
    <param name="frame_id" value="/map" />
  </node>

  <!-- Robot 1 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r1"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="1.57"/>
  </include>

  <!-- Robot 2 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r2"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="-1.57"/>
  </include>

  <!-- RVIZ -->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find multi_robot_scenario)/rviz_cfg/multi_robot.rviz"/>

</launch>

pioneer3dx.gazebo.launch

<launch>

  <arg name="robot_name" default="r1" />
  <arg name="model" default="$(find multi_robot_scenario)/xacro/p3dx/pioneer3dx.xacro" />
  <arg name="robot_position" default="-x 0.0 -y 0.0 -z 0.0" />

  <group ns="$(arg robot_name)">
    <param name="tf_prefix" type="string" value="$(arg robot_name)"/>

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />

    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model $(arg robot_name) -param robot_description $(arg robot_position)" />

    <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher">
      <param name="publish_frequency" type="double" value="30.0"/>
    </node>
  </group>

</launch>

navigation.launch

<launch>

    <param name="/use_sim_time" value="true"/>
    <arg name="tf_prefix" default="r1"/>
    <arg name="initial_pose_x" default="0.0" />
    <arg name="initial_pose_y" default="0.0" />
    <arg name="initial_pose_a" default="0.0" />

    <group ns="$(arg tf_prefix)">
        <param name="tf_prefix" type="string" value="$(arg tf_prefix)"/>

        <include file="$(find multi_robot_scenario)/launch/amcl.launch">
            <arg name="scan_topic" value="front_laser/scan" />
            <!-- <arg name="global_frame_id" value ...
(more)
edit flag offensive delete link more

Comments

now my files look similar to yours, but im getting some errors https://pastebin.com/QB0hjJ8j Probably because of the scan topics but i dont understand why. i changed argument scan topic to "scan" but i always get these errors

topkek gravatar image topkek  ( 2018-07-02 10:51:31 -0600 )edit

The errors about different md5sums mean that you are trying to make something subscribe to a topic with the wrong data type. We need to see your current launch files to help more. Update your question.

Geoff gravatar image Geoff  ( 2018-07-02 19:15:53 -0600 )edit

Can you update the yaml files that was loaded by move_base into your question?

nightwish gravatar image nightwish  ( 2018-07-03 03:13:20 -0600 )edit

ok, for some reason i dont get red errors anymore. i use yaml files from the tutorial I think my global_costmap file was causing problems so i fixed it.

topkek gravatar image topkek  ( 2018-07-03 04:09:17 -0600 )edit

i updated question with files. My robot now get goal but it is lost and cant find the right direction to go

topkek gravatar image topkek  ( 2018-07-03 04:10:44 -0600 )edit

now the error is back -.-

topkek gravatar image topkek  ( 2018-07-03 04:26:40 -0600 )edit

In the tutorial, there are some places need replacing by the follower. You should post your files. After that we can find out.

nightwish gravatar image nightwish  ( 2018-07-03 07:47:57 -0600 )edit

my yaml files are exactly like from the tutorials. Error happens when i enable laser scan in file that spawns robots. i always get this warn: No laser scan received (and thus no pose updates have been published) for 1327.120000 seconds. Verify that data is being published on the /husky1/scan topic.

topkek gravatar image topkek  ( 2018-07-04 10:33:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-15 12:21:04 -0600

Seen: 2,620 times

Last updated: Aug 01 '18