YARP
Yet Another Robot Platform
fakeLocalizerDev.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <yarp/os/Network.h>
20 #include <yarp/os/RFModule.h>
21 #include <yarp/os/Time.h>
22 #include <yarp/os/Port.h>
23 #include <yarp/os/LogStream.h>
24 #include <yarp/os/Node.h>
25 #include <yarp/dev/PolyDriver.h>
26 #include <yarp/os/Bottle.h>
27 #include <yarp/sig/Vector.h>
28 #include <yarp/dev/INavigation2D.h>
30 #include <yarp/os/PeriodicThread.h>
31 #include <math.h>
32 #include <mutex>
33 
34 using namespace yarp::os;
35 
36 
39 {
40 protected:
41  //general
48  std::mutex m_mutex;
50  std::string m_local_name;
51 
52 public:
53  fakeLocalizerThread(double _period, yarp::os::Searchable& _cfg);
54  virtual bool threadInit() override;
55  virtual void threadRelease() override;
56  virtual void run() override;
57 
58 public:
59  bool initializeLocalization(const yarp::dev::Nav2D::Map2DLocation& loc);
60  bool getCurrentLoc(yarp::dev::Nav2D::Map2DLocation& loc);
61 };
62 
63 
67 {
68 public:
70  virtual bool open(yarp::os::Searchable& config) override;
71 
72  fakeLocalizer();
73  virtual ~fakeLocalizer();
74 
75  virtual bool close() override;
76 
77 public:
82  bool getLocalizationStatus(yarp::dev::Nav2D::LocalizationStatusEnum& status) override;
83 
88  bool getEstimatedPoses(std::vector<yarp::dev::Nav2D::Map2DLocation>& poses) override;
89 
95  bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation& loc) override;
96 
102  bool setInitialPose(const yarp::dev::Nav2D::Map2DLocation& loc) override;
103 
110  virtual bool setInitialPose(const yarp::dev::Nav2D::Map2DLocation& loc, const yarp::sig::Matrix& cov) override;
111 
118  virtual bool getCurrentPosition(yarp::dev::Nav2D::Map2DLocation& loc, yarp::sig::Matrix& cov) override;
119 
125  virtual bool getEstimatedOdometry(yarp::dev::OdometryData& odom) override;
126 
131  virtual bool startLocalizationService() override;
132 
137  virtual bool stopLocalizationService() override;
138 };
define control board standard interfaces
contains the definition of a Vector type
yarp::dev::Nav2D::Map2DLocation m_current_loc
yarp::dev::Nav2D::Map2DLocation m_current_odom
yarp::dev::Nav2D::Map2DLocation m_initial_loc
std::string m_local_name
yarp::os::Searchable & m_cfg
yarp::dev::Nav2D::Map2DLocation m_initial_odom
fakeLocalizerThread * locThread
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
ILocalization2D interface.
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition: Searchable.h:69
A class for a Matrix.
Definition: Matrix.h:46
An interface to the operating system, including Port based communication.