YARP
Yet Another Robot Platform
MapGrid2DInfo.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_DEV_MAPGRID2DINFO_H
7 #define YARP_DEV_MAPGRID2DINFO_H
8 
9 #include <string>
10 
11 #include <yarp/os/Portable.h>
13 #include <yarp/sig/Image.h>
14 #include <yarp/math/Vec2D.h>
15 #include <yarp/dev/api.h>
16 #include <yarp/dev/Map2DLocation.h>
17 #include <yarp/dev/NavTypes.h>
18 
22 namespace yarp
23 {
24  namespace dev
25  {
26  namespace Nav2D
27  {
29  {
30  private:
31  double sa;
32  double ca;
33  private:
34  double x;
35  double y;
36  double theta;
37  public:
39  MapGrid2DOrigin(double x_init, double y_init, double t_init);
40  inline double get_x() const { return x; }
41  inline double get_y() const { return y; }
42  inline double get_theta() const { return theta; }
43  void setOrigin(double x_init, double y_init, double t_init);
44  bool operator != (const MapGrid2DOrigin& other) const;
45  public:
46  inline double get_ca() const { return ca; }
47  inline double get_sa() const { return sa; }
48  };
49 
51  {
52  public:
53  MapGrid2DInfo();
54 
56  double m_resolution;
58  size_t m_width;
59  size_t m_height;
60 
61  //------------------------------utility functions-------------------------------
62  //convert a cell (from the upper-left corner) to the map reference frame (located in m_origin, measured in meters)
63  XYWorld cell2World(XYCell cell) const;
64  yarp::dev::Nav2D::Map2DLocation toLocation(XYCell cell) const;
65  XYCell toXYCell(yarp::dev::Nav2D::Map2DLocation loc) const;
66 
67  //convert a world location (wrt the map reference frame located in m_origin, measured in meters), to a cell from the upper-left corner.
68  XYCell world2Cell(XYWorld world) const;
69  XYCell world2Cell_unsafeFast(XYWorld world) const;
70  yarp::dev::Nav2D::Map2DLocation toLocation(XYWorld cell) const;
71  XYWorld toXYWorld(yarp::dev::Nav2D::Map2DLocation loc) const;
72 
77  bool isInsideMap(XYCell cell) const;
78 
84  bool isInsideMap(XYWorld world) const;
85  };
86  }
87  }
88 }
89 
90 #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:57
double m_resolution
meters/pixel
Definition: MapGrid2DInfo.h:56
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:336
#define YARP_dev_API
Definition: api.h:18