Robotics StackExchange | Archived questions

Change location of global costmap relative to map frame / cartographer mark prohibited area

Hi there

I am trying to implement outdoor navigation. When i do so i come to a point where the maps from Google Cartographer do not separate street and meadow good enough. Due to the fact that i want to stay on the street i came up with the idea of editing the map. I do not found a way to edit the .pbstream which is normally the Input for my navigation. To be able to edit a map i run the assets writer, which resulted in a nice map.pgm picture and a map.yaml file. This enables me to edit the map.pgm with normal tools like ImageMagick. Therefore i can draw meadow and other obstacles in this map.

My plan is it still to localize with Cartographer and send the location info over tf to the movebase node. The globalcostmap should then initialize on the edited map published with mapserver. With enabling the option clearing = false the painted area should stay restricted. to reach that only the /map topic from the mapserver gets published is simply commented out cartographeroccupancygrid_node. This works fine.

The problem is neither the overlapping from the published maps (submaps (black/white right bottom) represents cartographer map, /map (purple right bottom with transparency edited lines) represents the edited map from the map_server) as apparent under visualization of all maps. I simply solved this with changing

origin: [5.51, 8.09, 3.14159] in the map.yaml file...

The problem indeed is, that the globalcostmap (purple/turquoise left top) does not adopt its origin an gets published at the [0.0, 0.0, 0.0 ] location. Is there a way to force the globalcostmap also to get published at a distinct location (same as the map_server map in the /map frame)? Or do you got any other suggestions to mark the prohibited area with google cartographer?

Thanks in advance

map.yaml

image: /home/ba_slam/bagfiles/keller/keller_edit.pgm
resolution: 0.050000
origin: [5.51, 8.09, 3.14159]
#origin: [0.0, 0.0, 0.0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

autonomousnavigationrp.launch

<launch>

<param name="/use_sim_time" value="true"/>


  <!-- Run the map server -->
  <arg name="map_file" default="/home/ba_slam/bagfiles/keller/keller.bag_map.yaml"/>
  <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
  <!-- <remap from="map" to="map_server_map"/>  -->



<!-- RPlidar starten #################################################################### -->

  <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
  <param name="serial_port"         type="string" value="/dev/ttyUSB1"/>
  <param name="serial_baudrate"     type="int"    value="115200"/>
  <param name="frame_id"            type="string" value="rp_link"/>
  <param name="inverted"            type="bool"   value="false"/>
  <param name="angle_compensate"    type="bool"   value="true"/>
  </node> 



<!-- RVIZ starten #################################################################### -->
  <node name="rviz" pkg="rviz" type="rviz" args="-d $(find rplidar_ros)/rviz/rplidar.rviz" /> 




<!-- eigene tf_broadcaster/listener einbinden############################################## 

<node name="tf_broadcaster_base" pkg="robot_setup_tf" type="tf_broadcaster_base" /> 
-->

<!-- Turtlebot  bringup ################################################################## -->
<include file =  "$(find turtlebot_bringup)/launch/minimal.launch"/>


<!---Cartographer ######################   -->  

  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/00_Kobuki_rp.urdf" />
  <node name="cartographer_node" pkg="cartographer_ros"
      type="cartographer_node" args="
          -configuration_directory $(find cartographer_ros)/configuration_files
          -configuration_basename 00_Kobuki_rp.lua
          -load_state_filename $(arg load_state_filename)"
      output="screen">
  </node>

 <!-- <node name="cartographer_occupancy_grid_node" pkg="cartographer_ros"
      type="cartographer_occupancy_grid_node" args="-resolution 0.05" /> -->


<!-- move base node  ##########################################################################   --> 
  <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS"/>
   <param name="base_global_planner" value="carrot_planner/CarrotPlanner"/>
  <param name="robot_description"
    textfile="$(find cartographer_ros)/urdf/00_Kobuki_rp.urdf" />

   <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
   <param name="controller_frequency"     type="int"    value="3"/>

   <rosparam file = "$(find kobuki_nav)/costmap_common_params.yaml" command="load" ns="global_costmap"/>
   <rosparam file = "$(find kobuki_nav)/costmap_common_params.yaml" command="load" ns="local_costmap"/> 
   <rosparam file="$(find kobuki_nav)/map_nav_params/global_costmap_params.yaml" command="load"  /> 
   <rosparam file = "$(find kobuki_nav)/map_nav_params/local_costmap_params.yaml" command="load" />
   <rosparam file="$(find kobuki_nav)/move_base_params.yaml" command="load" />

   <rosparam file="$(find kobuki_nav)/dwa_local_planner_params.yaml" command="load" />
   <rosparam file="$(find kobuki_nav)/base_local_planner_params.yaml" command="load" /> 
   </node>


</launch>

costmapcommonparams.yaml

map_type: costmap
  origin_z: 0.0
  z_resolution: 1
  z_voxels: 2

  obstacle_range: 2.5
  raytrace_range: 3.0

  publish_voxel_map: true
  transform_tolerance: 0.5
  meter_scoring: true

  robot_radius: 0.2

  plugins:
    - {name: static_layer, type: "costmap_2d::StaticLayer"}
    - {name: obstacles_layer, type: "costmap_2d::VoxelLayer"}
    - {name: inflater_layer, type: "costmap_2d::InflationLayer"}

  static_layer:
    map_topic: /map
    subscribe_to_updates: true
    static_map: true  

  obstacles_layer:
    observation_sources: scan
    scan: {sensor_frame: rp_link, data_type: LaserScan, topic: scan, marking: true, clearing: true, min_obstacle_height: -2.0, max_obstacle_height: 2.0, obstacle_range: 2.5, raytrace_range: 8.5}

  inflater_layer:
    inflation_radius: 0.25

globalcostmapparams.yaml

global_costmap:
   global_frame: map
   robot_base_frame: base_footprint
   update_frequency: 10.0
   publish_frequency: 5.0
   width: 40.0
   height: 40.0
   resolution: 0.05
# origin_x: 100
# origin_y: 100
   always_send_full_costmap: true
   origin: [5.51, 8.09, 3.14159]
#   static_map: true
   rolling_window: false

localcostmapparams.yaml

local_costmap:
   global_frame: map
   robot_base_frame: base_footprint
   update_frequency: 10.0
   publish_frequency: 5.0
   width: 10.0
   height: 10.0
   resolution: 0.05
   static_map: false
   rolling_window: true

rqttftree https://github.com/goeldisandro/outdoor_navigation/blob/master/rqt_tf_tree.png

all the code https://github.com/goeldisandro/outdoor_navigation/tree/master/src

Thanks a lot for your adivces

Asked by goeldisandro on 2019-07-16 03:28:40 UTC

Comments

I've upvoted your question so that you have enough karma to add your image directly to the question.

Asked by jayess on 2019-08-17 10:11:07 UTC

Answers