YARP
Yet Another Robot Platform
MapGrid2DInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #ifndef YARP_DEV_MAPGRID2DINFO_H
10 #define YARP_DEV_MAPGRID2DINFO_H
11 
12 #include <string>
13 
14 #include <yarp/os/Portable.h>
16 #include <yarp/sig/Image.h>
17 #include <yarp/math/Vec2D.h>
18 #include <yarp/dev/api.h>
19 #include <yarp/dev/Map2DLocation.h>
20 #include <yarp/dev/NavTypes.h>
21 
25 namespace yarp
26 {
27  namespace dev
28  {
29  namespace Nav2D
30  {
32  {
33  private:
34  double sa;
35  double ca;
36  private:
37  double x;
38  double y;
39  double theta;
40  public:
42  MapGrid2DOrigin(double x_init, double y_init, double t_init);
43  inline double get_x() const { return x; }
44  inline double get_y() const { return y; }
45  inline double get_theta() const { return theta; }
46  void setOrigin(double x_init, double y_init, double t_init);
47  bool operator != (const MapGrid2DOrigin& other) const;
48  public:
49  inline double get_ca() const { return ca; }
50  inline double get_sa() const { return sa; }
51  };
52 
54  {
55  public:
56  MapGrid2DInfo();
57 
59  double m_resolution;
61  size_t m_width;
62  size_t m_height;
63 
64  //------------------------------utility functions-------------------------------
65  //convert a cell (from the upper-left corner) to the map reference frame (located in m_origin, measured in meters)
66  XYWorld cell2World(XYCell cell) const;
67  yarp::dev::Nav2D::Map2DLocation toLocation(XYCell cell) const;
68  XYCell toXYCell(yarp::dev::Nav2D::Map2DLocation loc) const;
69 
70  //convert a world location (wrt the map reference frame located in m_origin, measured in meters), to a cell from the upper-left corner.
71  XYCell world2Cell(XYWorld world) const;
72  XYCell world2Cell_unsafeFast(XYWorld world) const;
73  yarp::dev::Nav2D::Map2DLocation toLocation(XYWorld cell) const;
74  XYWorld toXYWorld(yarp::dev::Nav2D::Map2DLocation loc) const;
75 
80  bool isInsideMap(XYCell cell) const;
81 
87  bool isInsideMap(XYWorld world) const;
88  };
89  }
90  }
91 }
92 
93 #endif // YARP_DEV_MAPGRID2D_H
contains the definition of a Map2DLocation type
contains definitions for common types used in navigation interfaces
MapGrid2DOrigin m_origin
pose of the map frame w.r.t. the bottom left corner of the map image
Definition: MapGrid2DInfo.h:60
double m_resolution
meters/pixel
Definition: MapGrid2DInfo.h:59
The main, catch-all namespace for YARP.
Definition: dirs.h:19
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:339
#define YARP_dev_API
Definition: api.h:21