YARP
Yet Another Robot Platform
MapGrid2DInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 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
yarp::dev::Nav2D::MapGrid2DOrigin::get_y
double get_y() const
Definition: MapGrid2DInfo.h:44
yarp::dev::Nav2D::MapGrid2DOrigin::get_x
double get_x() const
Definition: MapGrid2DInfo.h:43
yarp::dev::Nav2D::MapGrid2DInfo::m_width
size_t m_width
cells
Definition: MapGrid2DInfo.h:61
yarp::dev::Nav2D::MapGrid2DInfo::m_resolution
double m_resolution
meters/pixel
Definition: MapGrid2DInfo.h:59
YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:339
Portable.h
yarp::math::Vec2D< double >
yarp::dev::Nav2D::MapGrid2DOrigin
Definition: MapGrid2DInfo.h:32
yarp::dev::Nav2D::MapGrid2DOrigin::get_theta
double get_theta() const
Definition: MapGrid2DInfo.h:45
NavTypes.h
contains definitions for common types used in navigation interfaces
yarp::dev::Nav2D::MapGrid2DOrigin::get_ca
double get_ca() const
Definition: MapGrid2DInfo.h:49
Map2DLocation.h
contains the definition of a Map2DLocation type
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp::dev::Nav2D::MapGrid2DInfo::m_height
size_t m_height
cells
Definition: MapGrid2DInfo.h:62
yarp::dev::Nav2D::Map2DLocation
Definition: Map2DLocation.h:30
yarp::dev::Nav2D::MapGrid2DInfo::m_map_name
std::string m_map_name
Definition: MapGrid2DInfo.h:58
Image.h
yarp::dev::Nav2D::MapGrid2DOrigin::get_sa
double get_sa() const
Definition: MapGrid2DInfo.h:50
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
Vec2D.h
yarp::dev::Nav2D::MapGrid2DInfo
Definition: MapGrid2DInfo.h:54
yarp::dev::Nav2D::MapGrid2DInfo::m_origin
MapGrid2DOrigin m_origin
pose of the map frame w.r.t. the bottom left corner of the map image
Definition: MapGrid2DInfo.h:60
api.h
ConnectionReader.h