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

global costmap is not centered

asked 2019-09-18 23:11:22 -0500

june2473 gravatar image

updated 2019-09-19 01:20:10 -0500

I am running the move_base node with dynamic global_cosmap.

here is global_costmap_params.yaml file:

image description

and costmap_common_params.yaml: image description

and this is how global costmap looks like in rviz: image description

you see, robot position starts in the corner, not in the center of global costmap

What can i do to make global costmap centered?

I have mapping node which is publishing the OccupancyGrid. I have a python script that is taking this OccupancyGrid and publishing it in map frame:

#!/usr/bin/env python  
import rospy
import tf_conversions

import tf2_ros
import tf2_msgs.msg
import geometry_msgs.msg
import sensor_msgs.msg
import nav_msgs.msg
from std_msgs.msg import String

def handle_map_frame(data):
  pub = rospy.Publisher("map", nav_msgs.msg.OccupancyGrid, queue_size=10)
  rate = rospy.Rate(10) # 10hz

  data.header.frame_id = "/map"

  pub.publish(data)
  rate.sleep()

if __name__ == '__main__':
  rospy.init_node('map_frame_broadcaster')
  rospy.Subscriber("/occupancy", nav_msgs.msg.OccupancyGrid, handle_map_frame)
  ##rospy.Subscriber('/sensor_us', sensor_msgs.msg.Range, handle_camera_pose)
  rospy.spin()
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-09-19 02:53:18 -0500

pavel92 gravatar image

updated 2019-09-19 02:54:37 -0500

You should set the parameter rolling_window to true in your global_costmap_params.yaml.

You can check out this answer for more information.

edit flag offensive delete link more

Comments

thanks a lot! it helped

june2473 gravatar image june2473  ( 2019-09-19 04:13:06 -0500 )edit

This worked for me too, thanks!

Buzzology gravatar image Buzzology  ( 2023-01-08 04:31:45 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-09-18 23:11:22 -0500

Seen: 628 times

Last updated: Sep 19 '19