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

Move_base stuck at Sim period

asked 2020-12-08 05:02:59 -0600

hiep127 gravatar image

updated 2020-12-15 20:59:01 -0600

jayess gravatar image

Hello

I'm a begginer with ros

I'm trying to use move_base to control my robot but i don't know why my move_base stuck at Sim period is set to 0.20 and cant receive odom like in this https://imgur.com/E7uYihx

This is my screen while launching move_base https://imgur.com/BWQkXLA

This is my tf tree https://imgur.com/NZ7zJfw

This is my main launch file

 <launch>
  <node pkg="robot" type="lidar_tf.py" name="lidar_tf" output="screen"/>
  <node pkg="robot" type="diff_tf.py" name="diff_tf" output="screen"/>
  <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
  <param name="serial_port"         type="string" value="/dev/ttyUSB0"/>  
  <param name="serial_baudrate"     type="int"    value="115200"/>
  <param name="frame_id"            type="string" value="laser"/>
  <param name="inverted"            type="bool"   value="false"/>
  <param name="angle_compensate"    type="bool"   value="true"/>
 </node>
<include file="$(find robot)/launch/gmapping.launch"/>
</launch>

This is my navigation launch file

<launch>
  <!-- Name of the map to use (without path nor extension) and initial position -->
  <arg name="map_file"       default=" $(find robot)/map/mymap.yaml"/> <!-- psu -->
  <arg name="initial_pose_x" default="20.925"/>
  <arg name="initial_pose_y" default="11.925"/>
  <arg name="initial_pose_a" default="0.0"/>
  <param name="/use_sim_time" value="true"/>

<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)">

  </node>


<include file="$(find robot)/launch/amcl.launch.xml">
    <arg name="scan_topic" value="scan"/>
    <arg name="use_map_topic" value="true"/>
    <arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
    <arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
    <arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
  </include>
  <!--  ************** Navigation  ***************  -->
  <include file="$(find robot)/launch/move_base.launch.xml"/>
 <!--
 <node pkg="robot" type="navigation.py" name="navigation" output="screen">
    <rosparam param="xHome">2.77388</rosparam>
    <rosparam param="YHome">-2.25284</rosparam>
    <rosparam param="xDestination">-51.225</rosparam>
    <rosparam param="yDestination">-51.225</rosparam>
 </node>
-->

</launch>\

This is my move_base

<launch>
  <arg name="odom_frame_id"   default="odom"/>
  <arg name="base_frame_id"   default="base_link"/>
  <arg name="global_frame_id" default="map"/>
  <arg name="odom_topic" default="odom" />
  <arg name="laser_topic" default="scan" />



  <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find robot)/param/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find robot)/param/costmap_common_params.yaml" command="load" ns="local_costmap" />   
    <rosparam file="$(find robot)/param/local_costmap_params.yaml" command="load" />   
    <rosparam file="$(find robot)/param/global_costmap_params.yaml" command="load" />
    <rosparam file="$(find robot)/param/dwa_local_planner_params.yaml" command="load" />
    <rosparam file="$(find robot)/param/move_base_params.yaml" command="load" />
    <rosparam file="$(find robot)/param/global_planner_params.yaml" command="load" />
    <rosparam file="$(find robot)/param/navfn_global_planner_params.yaml" command="load" />
    <param name="global_costmap/global_frame" value="$(arg global_frame_id)"/>
    <param name="global_costmap/robot_base_frame" value="$(arg base_frame_id)"/>
    <param name="local_costmap/global_frame" value="$(arg odom_frame_id)"/>
    <param name="local_costmap/robot_base_frame" value="$(arg base_frame_id)"/>
    <param name="DWAPlannerROS/global_frame_id" value ...
(more)
edit retag flag offensive close merge delete

Comments

@hiep127 please don't post an update as an answer. Please update your question instead

jayess gravatar image jayess  ( 2020-12-15 20:59:39 -0600 )edit

Also, for any text please don't use images as the text in images can't be copy and pasted. Please see the support page

jayess gravatar image jayess  ( 2020-12-15 21:01:05 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-12-08 08:07:11 -0600

tryan gravatar image

It's generally better to post the text of your files/code directly with the 101010 formatting button. That way it's searchable. That aside, your tf tree indicates you probably have something setup incorrectly. The map frame is usually the root of the tree and parent of the odom frame, which is the parent of base_link. The map->odom tf comes from mapping/SLAM, and the odom->base_link tf comes from odometry (sensor data). The navigation tutorials provide an excellent resource for getting started. I recommend following along in simulation before trying to apply it to hardware. If you've done that and are still having problems, please, post all of the launch files/code you are using. Looking at the node/topic graph with rosrun rqt_graph rqt_graph may also help. Finally, ensure that something is publishing odometry with rostopic echo /odom. If you don't see "odom received," it's likely not published or on the wrong topic.

edit flag offensive delete link more

Comments

1

Tks for ur advice it my second time using this forum and i still dont know all about its feature yet xD

I will try ur advice and hope it will work :3

thanks again for ur help

hiep127 gravatar image hiep127  ( 2020-12-08 09:35:45 -0600 )edit

https://imgur.com/NZ7zJfw

I have made tf tree look like this but it still now work :(

i updated the launch file i am using too

hiep127 gravatar image hiep127  ( 2020-12-09 05:38:28 -0600 )edit

Thanks for the additional info. As mentioned above, looking at the node graph and echoing the topics will help determine if anything is publishing data on odom. Your tree indicates that diff_tf is publishing the odom->base_link transform. It appears to be a custom node, so I can't say whether that's correct without the source code--same for lidar_tf.py and navigation.py. On a side note, I recommend static_transform_publisher nodes for generating constant transforms instead if that's what your lidar_tf node is doing. I don't see anything that's clearly publishing odometry, though.

Your tree also indicates a hector_mapping node, but I don't see that in your launch files. You also reference a gmapping launch file and use a map_server node. I would step back from navigation and be sure your localization setup working first, including odometry. What is your setup as you see it?

tryan gravatar image tryan  ( 2020-12-09 08:05:44 -0600 )edit

sorry for the missing information

diff_tf is a node povided by http://wiki.ros.org/differential_drive which can be used to get odometry from differential robot and hector_mapping is a SLAM (http://wiki.ros.org/hector_slam) so i don't think they are the problem.....

Also for localization i have tried run the robot by hand with teleop_twist_keyboard and it create an accurate map in rviz so that i don't think it's a problem too so i forget to post it

hiep127 gravatar image hiep127  ( 2020-12-09 08:13:51 -0600 )edit

this is lidar_tf

#!/usr/bin/env python  
    import roslib


    import rospy
    import tf

    if __name__ == '__main__':
        rospy.init_node('lidar_tf')
        br = tf.TransformBroadcaster()
        rate = rospy.Rate(10.0)
        while not rospy.is_shutdown():
            br.sendTransform((0.0, 0.0, 0.0),
                             (0.0, 0.0, 0.0, 1.0),
                             rospy.Time.now(),
                             "laser",
                             "base_link")
            rate.sleep()
hiep127 gravatar image hiep127  ( 2020-12-09 08:14:34 -0600 )edit

i also update the gmapping.launch file and i also echo to odom and there are data published to odom but idk why my move_base cant receive it

hiep127 gravatar image hiep127  ( 2020-12-09 08:16:20 -0600 )edit

Also i have a question to ask

Ask u mentioned be4 the map to odom come from mapping/slam but SLAM also published to /map topic

if i run SLAM so that i can't publish a map to map_server right? @@!

hiep127 gravatar image hiep127  ( 2020-12-09 08:36:38 -0600 )edit

The diff_tf node is old but may be fine, though you should consider the diff_drive_controller package in the future. Is it definitely publishing odometry data on the odom topic? Is that topic connected to the correct nodes?

When you teleop your robot, do you get the correct odometry output?

If you're using hector_slam, why do you also run amcl and a map_server node? Please, describe your work flow and overall setup.

The lidar_tf.py code looks fine, but static_transform_publisher is a standard node that does the same thing.

EDIT: apparently I missed some of your comments before posting this, so ignore the parts you answered.

tryan gravatar image tryan  ( 2020-12-09 08:57:56 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-08 05:02:59 -0600

Seen: 536 times

Last updated: Dec 15 '20