nav_grid_info.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Locus Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef NAV_GRID_NAV_GRID_INFO_H
36 #define NAV_GRID_NAV_GRID_INFO_H
37 
38 #include <string>
39 
40 namespace nav_grid
41 {
50 {
51 public:
52  /* All data is publically accessible */
53  unsigned int width = 0;
54  unsigned int height = 0;
55  double resolution = 1.0;
56  std::string frame_id = "map";
57  double origin_x = 0.0;
58  double origin_y = 0.0;
59 
63  bool operator == (const NavGridInfo& info) const
64  {
65  return width == info.width && height == info.height && resolution == info.resolution &&
66  origin_x == info.origin_x && origin_y == info.origin_y && frame_id == info.frame_id;
67  }
68 
69  bool operator != (const NavGridInfo& info) const
70  {
71  return !operator==(info);
72  }
73 
77  std::string toString() const
78  {
79  return std::to_string(width) + "x" + std::to_string(height) + " (" + std::to_string(resolution) + "res) " +
80  frame_id + " " + std::to_string(origin_x) + " " + std::to_string(origin_y);
81  }
82 };
83 
84 inline std::ostream& operator<<(std::ostream& stream, const NavGridInfo& info)
85 {
86  stream << info.toString();
87  return stream;
88 }
89 
90 } // namespace nav_grid
91 
92 #endif // NAV_GRID_NAV_GRID_INFO_H
bool operator!=(const NavGridInfo &info) const
Definition: nav_grid_info.h:69
std::string toString() const
String representation of this object.
Definition: nav_grid_info.h:77
double origin_x
The origin defines the coordinates of minimum corner of cell (0,0) in the grid.
Definition: nav_grid_info.h:57
bool operator==(const NavGridInfo &info) const
comparison operator that requires all fields are equal
Definition: nav_grid_info.h:63
std::ostream & operator<<(std::ostream &stream, const GenericIndex< NumericType > &index)
Definition: index.h:88


nav_grid
Author(s):
autogenerated on Wed Jun 26 2019 20:06:04