Trying to get our robot navigating
Hello, there:
My partner and I are trying to get an autonomous robot which is based on 2 Rpis that comunicate via ethernet. The robot has 4 wheels, 4 electric motors and 2 motor controllers (Roboclaw 2x15A) and is rectangle-shaped. We have implemented a little supervisor that switches between teloperated mode and autonomous mode. We also have a little RTC in order to get both rpis synchronized through chronyd server (we had some issues about the timestamp so we got this fixed like that). This was just for introducing you for what comes now.
The thing is: when having everything fired up (nodes, etc) our move_base node shows this message:
WARN /move_base [/tmp/binarydeb/ros-melodic-costmap-2d-1.16.7/src/costmap_2d_ros.cpp:101(Costmap2DROS::Costmap2DROS)] [topics: /rosout, /cmd_vel, /move_base/current_goal, /move_base/goal] Timed out waiting for transform from base_link to world to become available before running costmap, tf error: Lookup would require extrapolation into the past. Requested time 1630430254.744803905 but the earliest data is at time 1630437446.981132030, when looking up transform from frame [base_link] to frame [world]. canTransform returned after 0.10104 timeout was 0.1.
We have the following configuration of the navigation stack:
Common costmap params yaml
obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[-17, -22], [17, -22], [17,25], [-17,25]]
inflation_radius: 0.60
IMPORTANT: we have no laser or imus. Just a camera and odometry source (motors).
Global costmap yaml
global_costmap:
global_frame: world
robot_base_frame: base_link
update_frequency: 5.0
static_map: true
Local costmap yaml
local_costmap:
global_frame: odom
robot_base_frame: base_link
update_frequency: 5.0
publish_frequency: 2.0
static_map: true
rolling_window: false
width: 6.0
height: 6.0
resolution: 0.05
Base local planner params yaml
TrajectoryPlannerROS:
max_vel_x: 2
min_vel_x: 0.1
max_vel_theta: 1.0
min_in_place_vel_theta: 0.4
acc_lim_theta: 3.2
acc_lim_x: 2.5
acc_lim_y: 2.5
holonomic_robot: false
Map yaml
image: /home/ubuntu/catkin_ws/src/robot_navigation/map_2.pgm
resolution: 0.012270416
origin: [11.019, 0.12270416, 0.0]
occupied_thresh: 0.85
free_thresh: 0.15
negate: 0
Map image (i can´t upload images since I haven´t got enough points). In the system is a .pgm file. Tf tree and node graph.
And last but not least, here are the launch and yamls of robotlocalization package and movebase:
Robot_localization launch file
<launch>
<!--Robot location-->
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_se" clear_params="true">
<rosparam command="load" file="$(find robot_localization)/params/ekf_robot.yaml" />
<rosparam param="initial_state">[10.0, 0.0, 0.0,
0.0, 0.0, 1.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0]</rosparam>
</node>
</launch>
Robot_localization yaml
frequency: 30
silent_tf_failure: false
sensor_timeout: 0.1
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 0.0
print_diagnostics: true
debug: false
debug_out_file: /path/to/debug/file.txt
publish_tf: true
publish_acceleration: false
map_frame: world # Defaults to "map" if unspecified
odom_frame: odom # Defaults to "odom" if unspecified
base_link_frame: base_link # Defaults to "base_link" if unspecified
world_frame: world # Defaults to the value of odom_frame if unspecified
odom0: /odom
odom0_config: [false, false, false,
false, false, false,
true, true, false,
false, false, false,
false, false, false]
odom0_queue_size: 5
odom0_nodelay: false
odom0_differential: false
odom0_relative: false
odom0_pose_rejection_threshold: 5
odom0_twist_rejection_threshold: 1
#POSE ARUCO
pose0: /cam_pose_in_world
pose0_config: [true, true, false,
false, false, false,
false, false, false,
false, false, false,
false, false, false]
pose0_differential: false
pose0_relative: false
pose0_queue_size: 5
pose0_rejection_threshold: 2 # Note the difference in parameter name
pose0_nodelay: false
imu0_remove_gravitational_acceleration: true
use_control: true
stamped_control: false
control_timeout: 0.2
# Which velocities are being controlled. Order is vx, vy, vz, vroll, vpitch, vyaw.
control_config: [false, false, false, false, false, false]
# Places limits on how large the acceleration term will be. Should match your robot's kinematics.
acceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 3.4]
# Acceleration and deceleration limits are not always the same for robots.
deceleration_limits: [1.3, 0.0, 0.0, 0.0, 0.0, 4.5]
# If your robot cannot instantaneously reach its acceleration limit, the permitted change can be controlled with these
# gains
acceleration_gains: [0.8, 0.0, 0.0, 0.0, 0.0, 0.9]
# If your robot cannot instantaneously reach its deceleration limit, the permitted change can be controlled with these
# gains
deceleration_gains: [1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
# [ADVANCED] The process noise covariance matrix can be difficult to tune, and can vary for each application, so it is
# exposed as a configuration parameter. This matrix represents the noise we add to the total error after each
# prediction step. The better the omnidirectional motion model matches your system, the smaller these values can be.
# However, if users find that a given variable is slow to converge, one approach is to increase the
# process_noise_covariance diagonal value for the variable in question, which will cause the filter's predicted error
# to be larger, which will cause the filter to trust the incoming measurement more during correction. The values are
# ordered as x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below if
# unspecified.
process_noise_covariance: [0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.06, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0.04, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015]
# [ADVANCED] This represents the initial value for the state estimate error covariance matrix. Setting a diagonal
# value (variance) to a large value will result in rapid convergence for initial measurements of the variable in
# question. Users should take care not to use large values for variables that will not be measured directly. The values
# are ordered as x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. Defaults to the matrix below
#if unspecified.
initial_estimate_covariance: [1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-9]
Move_base launch file
<launch>
<master auto="start"/>
<!-- Run the map server -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find map_test)/test.yaml">
<param name="frame_id" value="map"/>
</node>
<!--- Run AMCL -->
<include file="$(find amcl)/examples/amcl_diff.launch"/>
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find robot_navigation)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find robot_navigation)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find robot_navigation)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find robot_navigation)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find robot_navigation)/base_local_planner_params.yaml" command="load" />
</node>
<node pkg="tf" type="static_transform_publisher" name="map" args="-23 -3 0.0 0.0 0.0 0.0 1.0 world map 100"/>
</launch>
So, moving back to the warning I showed...We are kinda new to ROS so we are a bit lost. We have followed all the tutorials (I guess) and we can´t really find out what could be wrong with frames and all this stuff. Hope all this information provided will be enough to come up with the solution and sorry about the massive info. Please feel free to ask about other files and to point out whatever you consider to be wrong.
Thanks in advice.
Asked by Ronro on 2021-08-31 17:47:31 UTC
Answers
From rosgraph.png, it looks like the cost map of move_base is not linked to the map image.
If you change the global costmap yaml to the following, it should improve the problem.
global_costmap:
global_frame: world
robot_base_frame: base_link
update_frequency: 5.0
static_map: true
resolution: 0.012270416
plugins:
- {name: static_layer, type: "costmap_2d::StaticLayer"}
static_layer:
map_topic: "map"
Asked by miura on 2021-09-01 19:53:34 UTC
Comments
Hi, Miura. This improves nothing. How this should help us? Thanks in advice.
Asked by Ronro on 2021-09-06 13:54:12 UTC
So it did not change. I am thinking that the change will be in the node graph.
When I look at the node graph, there is no line extending from /map to any node. This means that no one is using the loaded map image, and we assume that this is one of the reasons for the anomaly.
Asked by miura on 2021-09-06 18:00:02 UTC
Well...That´s kinda weird because our robot sometimes says that he is not on the costmap and he doesn´t plan anything :/
Asked by Ronro on 2021-09-08 13:30:48 UTC
Are you able to see the map in rviz
?
Asked by miura on 2021-09-08 18:21:11 UTC
Comments
Checking TF tree may help you discover something. TF tree can be created with
rosrun tf view_frames
with all nodes up. ( ref http://wiki.ros.org/tf#view_frames )Asked by miura on 2021-08-31 18:10:59 UTC
Already posted the TF tree between map yaml and robot localization launch.
Asked by Ronro on 2021-09-01 03:02:37 UTC
I'm sorry. I overlooked it.
Asked by miura on 2021-09-01 19:51:57 UTC