Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
map.c
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey & Kasper Stoy
4  * gerkey@usc.edu kaspers@robotics.usc.edu
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 /**************************************************************************
22  * Desc: Global map (grid-based)
23  * Author: Andrew Howard
24  * Date: 6 Feb 2003
25  * CVS: $Id: map.c 1713 2003-08-23 04:03:43Z inspectorg $
26 **************************************************************************/
27 
28 #include <stdlib.h>
29 
30 #include "nav2_amcl/map/map.hpp"
31 
32 
33 // Create a new map
34 map_t * map_alloc(void)
35 {
36  map_t * map;
37 
38  map = (map_t *) malloc(sizeof(map_t));
39 
40  // Assume we start at (0, 0)
41  map->origin_x = 0;
42  map->origin_y = 0;
43 
44  // Make the size odd
45  map->size_x = 0;
46  map->size_y = 0;
47  map->scale = 0;
48 
49  // Allocate storage for main map
50  map->cells = (map_cell_t *) NULL;
51 
52  // Initialize max_occ_dist to 0.0
53  map->max_occ_dist = 0.0;
54 
55  return map;
56 }
57 
58 
59 // Destroy a map
60 void map_free(map_t * map)
61 {
62  free(map->cells);
63  free(map);
64 }
Definition: map.hpp:62