qboticslabs / mastering_ros

This repository contains exercise files of the book "Mastering ROS for Robotics Programming"
https://www.packtpub.com/hardware-and-creative/mastering-ros-robotics-programming
479 stars 282 forks source link

Gmapping and base_footprint error #23

Open imad-ali opened 7 years ago

imad-ali commented 7 years ago

Hi everyone,

I am new to ROS and have been learning from Mastering ROS for Robotics Programming. I have run into an issue in Chapter 4 where gmapping and AMCL are used to build a map of Willow Garage world and navigate autonomously. I am using a dual boot machine running Windows 10 and Ubuntu 14.04 on separate HDDs.

When I run: roslaunch diff_wheeled_robot_gazebo diff_wheeled_gazebo_full.launch

The robot launches in Gazebo in an empty world instead of Willow Garage and the terminal displays the following warnings:

[ WARN] [1502832331.629880560]: The 'state_publisher' executable is deprecated. Please use 'robot_state_publisher' instead [ WARN] [1502832331.632663525]: The root link base_footprint has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.

Next, when I run: roslaunch diff_wheeled_robot_gazebo gmapping.launch

The terminal displays the following output including an error.

imad@imad-Aspire-E5-575G:~$ roslaunch diff_wheeled_robot_gazebo gmapping.launch
... logging to /home/imad/.ros/log/44052ba2-8200-11e7-a9e0-74dfbf917593/roslaunch-imad-Aspire-E5-575G-10008.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://imad-Aspire-E5-575G:44666/
SUMMARY

PARAMETERS

    /move_base/DWAPlannerROS/acc_lim_theta: 2.0
    /move_base/DWAPlannerROS/acc_lim_x: 1.0
    /move_base/DWAPlannerROS/acc_lim_y: 0.0
    /move_base/DWAPlannerROS/forward_point_distance: 0.325
    /move_base/DWAPlannerROS/global_frame_id: odom
    /move_base/DWAPlannerROS/goal_distance_bias: 24.0
    /move_base/DWAPlannerROS/max_rot_vel: 5.0
    /move_base/DWAPlannerROS/max_scaling_factor: 0.2
    /move_base/DWAPlannerROS/max_trans_vel: 0.5
    /move_base/DWAPlannerROS/max_vel_x: 0.5
    /move_base/DWAPlannerROS/max_vel_y: 0.0
    /move_base/DWAPlannerROS/min_rot_vel: 0.4
    /move_base/DWAPlannerROS/min_trans_vel: 0.1
    /move_base/DWAPlannerROS/min_vel_x: 0.0
    /move_base/DWAPlannerROS/min_vel_y: 0.0
    /move_base/DWAPlannerROS/occdist_scale: 0.5
    /move_base/DWAPlannerROS/oscillation_reset_dist: 0.05
    /move_base/DWAPlannerROS/path_distance_bias: 64.0
    /move_base/DWAPlannerROS/publish_cost_grid_pc: True
    /move_base/DWAPlannerROS/publish_traj_pc: True
    /move_base/DWAPlannerROS/rot_stopped_vel: 0.4
    /move_base/DWAPlannerROS/scaling_speed: 0.25
    /move_base/DWAPlannerROS/sim_time: 1.0
    /move_base/DWAPlannerROS/stop_time_buffer: 0.2
    /move_base/DWAPlannerROS/trans_stopped_vel: 0.1
    /move_base/DWAPlannerROS/vtheta_samples: 20
    /move_base/DWAPlannerROS/vx_samples: 6
    /move_base/DWAPlannerROS/vy_samples: 1
    /move_base/DWAPlannerROS/xy_goal_tolerance: 0.15
    /move_base/DWAPlannerROS/yaw_goal_tolerance: 0.3
    /move_base/TrajectoryPlannerROS/acc_lim_theta: 1.0
    /move_base/TrajectoryPlannerROS/acc_lim_x: 0.5
    /move_base/TrajectoryPlannerROS/acc_lim_y: 0.0
    /move_base/TrajectoryPlannerROS/dwa: True
    /move_base/TrajectoryPlannerROS/gdist_scale: 0.8
    /move_base/TrajectoryPlannerROS/heading_lookahead: 0.325
    /move_base/TrajectoryPlannerROS/holonomic_robot: False
    /move_base/TrajectoryPlannerROS/max_vel_theta: 1.0
    /move_base/TrajectoryPlannerROS/max_vel_x: 0.3
    /move_base/TrajectoryPlannerROS/max_vel_y: 0.0
    /move_base/TrajectoryPlannerROS/meter_scoring: True
    /move_base/TrajectoryPlannerROS/min_in_place_vel_theta: 0.6
    /move_base/TrajectoryPlannerROS/min_vel_theta: -1.0
    /move_base/TrajectoryPlannerROS/min_vel_x: 0.1
    /move_base/TrajectoryPlannerROS/min_vel_y: 0.0
    /move_base/TrajectoryPlannerROS/occdist_scale: 0.01
    /move_base/TrajectoryPlannerROS/oscillation_reset_dist: 0.05
    /move_base/TrajectoryPlannerROS/pdist_scale: 0.6
    /move_base/TrajectoryPlannerROS/sim_time: 3.0
    /move_base/TrajectoryPlannerROS/vtheta_samples: 20
    /move_base/TrajectoryPlannerROS/vx_samples: 6
    /move_base/TrajectoryPlannerROS/vy_samples: 1
    /move_base/TrajectoryPlannerROS/xy_goal_tolerance: 0.15
    /move_base/TrajectoryPlannerROS/yaw_goal_tolerance: 0.3
    /move_base/base_local_planner: dwa_local_planner...
    /move_base/controller_frequency: 5.0
    /move_base/controller_patience: 3.0
    /move_base/global_costmap/bump/clearing: False
    /move_base/global_costmap/bump/data_type: PointCloud2
    /move_base/global_costmap/bump/marking: True
    /move_base/global_costmap/bump/max_obstacle_height: 0.15
    /move_base/global_costmap/bump/min_obstacle_height: 0.0
    /move_base/global_costmap/bump/topic: mobile_base/senso...
    /move_base/global_costmap/cost_scaling_factor: 5
    /move_base/global_costmap/global_frame: /map
    /move_base/global_costmap/inflation_radius: 0.5
    /move_base/global_costmap/map_type: costmap
    /move_base/global_costmap/max_obstacle_height: 0.6
    /move_base/global_costmap/observation_sources: scan bump
    /move_base/global_costmap/obstacle_range: 2.5
    /move_base/global_costmap/origin_z: 0.0
    /move_base/global_costmap/publish_frequency: 0.5
    /move_base/global_costmap/publish_voxel_map: False
    /move_base/global_costmap/raytrace_range: 3.0
    /move_base/global_costmap/robot_base_frame: /base_footprint
    /move_base/global_costmap/robot_radius: 0.4509
    /move_base/global_costmap/scan/clearing: True
    /move_base/global_costmap/scan/data_type: LaserScan
    /move_base/global_costmap/scan/marking: True
    /move_base/global_costmap/scan/max_obstacle_height: 3
    /move_base/global_costmap/scan/min_obstacle_height: 0.0
    /move_base/global_costmap/scan/topic: scan
    /move_base/global_costmap/static_map: True
    /move_base/global_costmap/transform_tolerance: 0.5
    /move_base/global_costmap/update_frequency: 1.0
    /move_base/global_costmap/z_resolution: 0.2
    /move_base/global_costmap/z_voxels: 2
    /move_base/local_costmap/bump/clearing: False
    /move_base/local_costmap/bump/data_type: PointCloud2
    /move_base/local_costmap/bump/marking: True
    /move_base/local_costmap/bump/max_obstacle_height: 0.15
    /move_base/local_costmap/bump/min_obstacle_height: 0.0
    /move_base/local_costmap/bump/topic: mobile_base/senso...
    /move_base/local_costmap/cost_scaling_factor: 5
    /move_base/local_costmap/global_frame: odom
    /move_base/local_costmap/height: 4.0
    /move_base/local_costmap/inflation_radius: 0.5
    /move_base/local_costmap/map_type: costmap
    /move_base/local_costmap/max_obstacle_height: 0.6
    /move_base/local_costmap/observation_sources: scan bump
    /move_base/local_costmap/obstacle_range: 2.5
    /move_base/local_costmap/origin_z: 0.0
    /move_base/local_costmap/publish_frequency: 2.0
    /move_base/local_costmap/publish_voxel_map: False
    /move_base/local_costmap/raytrace_range: 3.0
    /move_base/local_costmap/resolution: 0.05
    /move_base/local_costmap/robot_base_frame: /base_footprint
    /move_base/local_costmap/robot_radius: 0.4509
    /move_base/local_costmap/rolling_window: True
    /move_base/local_costmap/scan/clearing: True
    /move_base/local_costmap/scan/data_type: LaserScan
    /move_base/local_costmap/scan/marking: True
    /move_base/local_costmap/scan/max_obstacle_height: 3
    /move_base/local_costmap/scan/min_obstacle_height: 0.0
    /move_base/local_costmap/scan/topic: scan
    /move_base/local_costmap/static_map: False
    /move_base/local_costmap/transform_tolerance: 0.5
    /move_base/local_costmap/update_frequency: 5.0
    /move_base/local_costmap/width: 4.0
    /move_base/local_costmap/z_resolution: 0.2
    /move_base/local_costmap/z_voxels: 2
    /move_base/oscillation_distance: 0.2
    /move_base/oscillation_timeout: 10.0
    /move_base/planner_frequency: 1.0
    /move_base/planner_patience: 5.0
    /move_base/shutdown_costmaps: False
    /rosdistro: indigo
    /rosversion: 1.11.21
    /slam_gmapping/angularUpdate: 0.436
    /slam_gmapping/astep: 0.05
    /slam_gmapping/base_frame: base_footprint
    /slam_gmapping/delta: 0.05
    /slam_gmapping/iterations: 5
    /slam_gmapping/kernelSize: 1
    /slam_gmapping/lasamplerange: 0.005
    /slam_gmapping/lasamplestep: 0.005
    /slam_gmapping/linearUpdate: 0.5
    /slam_gmapping/llsamplerange: 0.01
    /slam_gmapping/llsamplestep: 0.01
    /slam_gmapping/lsigma: 0.075
    /slam_gmapping/lskip: 0
    /slam_gmapping/lstep: 0.05
    /slam_gmapping/map_update_interval: 5.0
    /slam_gmapping/maxRange: 8.0
    /slam_gmapping/maxUrange: 6.0
    /slam_gmapping/minimumScore: 100
    /slam_gmapping/odom_frame: odom
    /slam_gmapping/ogain: 3.0
    /slam_gmapping/particles: 80
    /slam_gmapping/resampleThreshold: 0.5
    /slam_gmapping/sigma: 0.05
    /slam_gmapping/srr: 0.01
    /slam_gmapping/srt: 0.02
    /slam_gmapping/str: 0.01
    /slam_gmapping/stt: 0.02
    /slam_gmapping/temporalUpdate: -1.0
    /slam_gmapping/xmax: 1.0
    /slam_gmapping/xmin: -1.0
    /slam_gmapping/ymax: 1.0
    /slam_gmapping/ymin: -1.0

NODES
/
move_base (move_base/move_base)
slam_gmapping (gmapping/slam_gmapping)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[slam_gmapping-1]: started with pid [10026]
process[move_base-2]: started with pid [10027]
[ WARN] [1502833436.250359091, 1084.378000000]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: . canTransform returned after 1084.38 timeout was 0.1.
[ WARN] [1502833441.391352686, 1089.464000000]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: Could not find a connection between 'map' and 'base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.. canTransform returned after 0.103 timeout was 0.1.
[ WARN] [1502833446.596302597, 1094.560000000]: Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: Could not find a connection between 'map' and 'base_footprint' because they are not part of the same tree.Tf has two or more unconnected trees.. canTransform returned after 0.104 timeout was 0.1.
[ WARN] [1502833451.529031298, 1099.367000000]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_notifier] rosconsole logger to DEBUG for more information.`

I have double and triple checked all the packages built so far to ensure they are the same as what's in the code for the chapters. However, something seems to be amiss. I also updated the navigation package to make sure nothing is missing from it. Has anybody had a similar issue? How do I fix this?

imad-ali commented 7 years ago

As advised, I changed the node type on line 26 of diff_wheeled_gazebo_full.launch from "state_publisher" to "robot_state_publisher", and the first warning [ WARN] [1502832331.629880560]: The 'state_publisher' executable is deprecated. Please use 'robot_state_publisher' instead

has disappeared but the others still remain. Correct me if I am wrong, but I feel gmapping might be acting up because the robot is coming up in an empty world in Gazebo. Shouldn't this part in diff_wheeled_gazebo_full.launch refer to willowgarage_world.launch instead of empty_world.launch?

<!-- We resume the logic in empty_world.launch -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="debug" value="$(arg debug)" />
    <arg name="gui" value="$(arg gui)" />
    <arg name="paused" value="$(arg paused)"/>
    <arg name="use_sim_time" value="$(arg use_sim_time)"/>
    <arg name="headless" value="$(arg headless)"/>
  </include>

Hoping someone can help me nail this. Thanks :)

qboticslabs commented 6 years ago

Hi @imad-ali

You can start Gazebo first and make sure the following topics are getting

1) /odom 2) /tf

Also, SLAM will not work properly in an empty world, maybe you can add some obstacle around the robot to map the world.