amcl: No laser scan received (and thus no pose updates have been published) for xxxx seconds ?

asked 2018-09-17 12:36:12 -0500

fourchette gravatar image

Hello,

I'm using ROS kinectic on ubuntu 16.04 on an HP laptop. I made my own "real/physical" 2WD robot, and now I want to use ROS navigation stack to get it to move around autonomously. I'm currently struggling with the real robot. Typical behavior is that after the robot accepts a 2DNav goal, it starts navigating to the goal, then hesidates, rotates on himself, then continues rotating forever. A friend of mine suggested to model my physical environment in gazebo, then use the ROS navigation stack in gazebo, tune the navigation parameters until it works decently in gazebo, then reuse those navigation parameters for the real robot.

So here I am, struggling to get the simulated robot to navigate.

Firing gazebo works. the world I created is ok. 2WD plugin of gazebo feels fine when i teleop it with a keyboard. The mapping process worked just fine. I publish the previously recorded map, it works. The published /odom and /scan values seems correct too. I can see them in rviz as expected. rostopic echo /scan and rostopic echo /odom feels fine as well.

The problem is that when I launch amcl, I keep getting the following warning:

[ WARN] [1537204065.051924673, 3433.606000000]: No laser scan received (and thus no pose updates have been published) for 34139472.000000 seconds.  Verify that data is being published on the /scan topic.
[ WARN] [1537204080.975562709, 3448.606000000]: No laser scan received (and thus no pose updates have been published) for 34139472.000000 seconds.  Verify that data is being published on the /scan topic.
[ WARN] [1537204096.883037473, 3463.606000000]: No laser scan received (and thus no pose updates have been published) for 34139472.000000 seconds.  Verify that data is being published on the /scan topic.
[...]

Here is a typical /scan message (taken somehow later)

user@ubuntu:~$ rostopic info /scan
Type: sensor_msgs/LaserScan

Publishers:
 * /gazebo (http://ubuntu:40085/)

Subscribers:
 * /amcl (http://ubuntu:38221/)

user@ubuntu:~$ rostopic echo -n 1 /scan
header:
  seq: 42106
  stamp:
    secs: 4001
    nsecs: 770000000
  frame_id: "sensor_laser"
angle_min: 0.0
angle_max: 6.27319002151
angle_increment: 0.0174740664661
time_increment: 0.0
scan_time: 0.0
range_min: 0.10000000149
range_max: 18.0
ranges: [0.14208605885505676, 0.11974052339792252, ..., 1.9066493511199951, 1.8749361038208008]
intensities: [-3.16707076146899e+24, ... , 0.0]
---
user@ubuntu:~$

When i look into the node, it seems amcl is indeed connected to /scan.

user@ubuntu:~$ rosnode info amcl
--------------------------------------------------------------------------------
Node [/amcl]
Publications:
 * /amcl/parameter_descriptions [dynamic_reconfigure/ConfigDescription]
 * /amcl/parameter_updates [dynamic_reconfigure/Config]
 * /amcl_pose [geometry_msgs/PoseWithCovarianceStamped]
 * /particlecloud [geometry_msgs/PoseArray]
 * /rosout [rosgraph_msgs/Log]
 * /tf [tf2_msgs/TFMessage]

Subscriptions:
 * /clock [rosgraph_msgs/Clock]
 * /initialpose [unknown type]
 * /map [nav_msgs/OccupancyGrid]
 * /scan [sensor_msgs/LaserScan]
 * /tf [tf2_msgs/TFMessage]
 * /tf_static [tf2_msgs/TFMessage]

Services:
 * /amcl/get_loggers
 * /amcl/set_logger_level
 * /amcl/set_parameters
 * /global_localization
 * /request_nomotion_update
 * /set_map


contacting node http://ubuntu:38221/ ...
Pid: 20339
Connections:
 * topic: /rosout
    * to: /rosout
    * direction: outbound
    * transport: TCPROS
 * topic: /tf
    * to: /amcl
    * direction: outbound
    * transport: INTRAPROCESS
 * topic: /clock
    * to: /gazebo (http://ubuntu:40085/)
    * direction: inbound
    * transport: TCPROS
 * topic: /tf
    * to: /amcl (http://ubuntu:38221/)
    * direction: inbound
    * transport: INTRAPROCESS
 * topic: /tf
    * to: /robot_state_publisher (http://ubuntu:33029 ...
(more)
edit retag flag offensive close merge delete

Comments

Can you provide your launch files or the different rosrun you use ? Are you launching the map_server node ?

Also AMCL needs odometry information but you don't seem to get them. #q229978 might help you.

Delb gravatar imageDelb ( 2018-09-18 04:39:43 -0500 )edit

all my code for this project is on github. the launch file is https://github.com/alexisdal/mnwlk3r/... however, I also tried to launch each node from command line to simplify at least. to no avail. i feel lost. gazebo does publish odom

fourchette gravatar imagefourchette ( 2018-09-18 07:31:02 -0500 )edit

I would change two things :

  • In spawn.launch : put <arg name="z" default="0.5"/> to 0 instead (because you didn't set AMCL to the same initial pose
  • In gazebo.launch : add <arg name="map_file" value="$(find mnwlk3r_simulation)/maps/fablab_sim.yaml"/>inside the include
Delb gravatar imageDelb ( 2018-09-18 07:42:53 -0500 )edit

Try also adding this to amcl.launch (with the correct map arg):

<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)">
    <param name="frame_id" value="/map"/>
</node>
Delb gravatar imageDelb ( 2018-09-18 07:53:21 -0500 )edit

Sorry I made a mistake don't add anything in gazebo.launch.

Delb gravatar imageDelb ( 2018-09-18 08:19:19 -0500 )edit

I tried running your project with roslaunch mnwlk3r_simulation navigation.launch (after i added the map_server node in amcl.launch) and I got the same warning one time but after that the robot was in gazebo and i could visualize the scan with rviz

Delb gravatar imageDelb ( 2018-09-18 10:04:24 -0500 )edit

indeed i agree the map server wasn't included in the launch file because i was starting it with a seperate one liner i did not mention. however, i tried what you suggest: to no avail. i continue to have this stupid "No laser scan received" message and map->odom does not appear in my tf tree.

fourchette gravatar imagefourchette ( 2018-09-19 03:38:31 -0500 )edit

i feel desperate. i'm sure it's something stupid. can you please kindly offer a push request on github?

fourchette gravatar imagefourchette ( 2018-09-19 03:39:25 -0500 )edit