0
$\begingroup$

Rosanswers logo

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()

Originally posted by june2473 on ROS Answers with karma: 83 on 2019-09-18

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

You can check out this answer for more information.


Originally posted by pavel92 with karma: 1655 on 2019-09-19

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by june2473 on 2019-09-19:
thanks a lot! it helped

Comment by Buzzology on 2023-01-08:
This worked for me too, thanks!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.