YARP
Yet Another Robot Platform
fakeNavigationDev.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/dev/INavigation2D.h>
25 #include <yarp/os/PeriodicThread.h>
26 #include <math.h>
27 
28 
31 {
32 public:
33  fakeNavigationThread(double _period, yarp::os::Searchable& _cfg);
34  virtual bool threadInit() override;
35  virtual void threadRelease() override;
36  virtual void run() override;
37 };
38 
48 {
49 public:
51 
52 public:
53  virtual bool open(yarp::os::Searchable& config) override;
54 
56 
57  //module cleanup
58  virtual bool close() override;
59 
60 public:
67 
73  bool gotoTargetByRelativeLocation(double x, double y, double theta) override;
74 
80  bool gotoTargetByRelativeLocation(double x, double y) override;
81 
88 
94  bool getRelativeLocationOfCurrentTarget(double& x, double& y, double& theta) override;
95 
101 
106  bool stopNavigation() override;
107 
112  bool suspendNavigation(double time) override;
113 
118  bool resumeNavigation() override;
119 
126 
133 
141 
147  bool recomputeCurrentNavigationPath() override;
148 
157  virtual bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout = 0.1) override;
158 };
INavigation2D.h
fakeNavigation::resumeNavigation
bool resumeNavigation() override
//Resumes a previously paused navigation task.
Definition: fakeNavigationDev.cpp:125
Network.h
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
fakeNavigationThread::threadRelease
virtual void threadRelease() override
Release method.
Definition: fakeNavigationDev.cpp:182
fakeNavigation::fakeNavigation
fakeNavigation()
Definition: fakeNavigationDev.cpp:74
Port.h
fakeNavigation::stopNavigation
bool stopNavigation() override
//Stops the current navigation task.
Definition: fakeNavigationDev.cpp:113
yarp::dev::Nav2D::INavigation2DTargetActions
Definition: INavigation2D.h:71
fakeNavigation::getAbsoluteLocationOfCurrentTarget
bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &target) override
//Gets the last target set through a setNewAbsTarget() command.
Definition: fakeNavigationDev.cpp:155
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
yarp::dev::Nav2D::TrajectoryTypeEnum
TrajectoryTypeEnum
Definition: INavigation2D.h:52
fakeNavigation::navThread
fakeNavigationThread * navThread
Definition: fakeNavigationDev.h:50
fakeNavigation::open
virtual bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: fakeNavigationDev.cpp:38
yarp::dev::Nav2D::NavigationStatusEnum
NavigationStatusEnum
Definition: INavigation2D.h:32
ControlBoardInterfaces.h
define control board standard interfaces
fakeNavigationThread::run
virtual void run() override
Loop function.
Definition: fakeNavigationDev.cpp:187
fakeNavigationThread
Definition: fakeNavigationDev.h:31
fakeNavigationThread::threadInit
virtual bool threadInit() override
Initialization method.
Definition: fakeNavigationDev.cpp:177
fakeNavigation::recomputeCurrentNavigationPath
bool recomputeCurrentNavigationPath() override
Forces the navigation system to recompute the path from the current robot position to the current goa...
Definition: fakeNavigationDev.cpp:161
yarp::dev::Nav2D::MapGrid2D
Definition: MapGrid2D.h:32
fakeNavigation::gotoTargetByAbsoluteLocation
bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Sets a new navigation target, expressed in the absolute (map) coordinate frame.
Definition: fakeNavigationDev.cpp:89
fakeNavigation
fakeNavigation: Documentation to be added
Definition: fakeNavigationDev.h:48
fakeNavigation::getCurrentNavigationMap
bool getCurrentNavigationMap(yarp::dev::Nav2D::NavigationMapTypeEnum map_type, yarp::dev::Nav2D::MapGrid2D &map) override
Returns the current navigation map processed by the navigation algorithm.
Definition: fakeNavigationDev.cpp:143
RFModule.h
yarp::dev::Nav2D::Map2DPath
Definition: Map2DPath.h:27
yarp::os::PeriodicThread
An abstraction for a periodic thread.
Definition: PeriodicThread.h:25
fakeNavigation::suspendNavigation
bool suspendNavigation(double time) override
//Pauses the current navigation task.
Definition: fakeNavigationDev.cpp:119
fakeNavigation::getNavigationStatus
bool getNavigationStatus(yarp::dev::Nav2D::NavigationStatusEnum &status) override
//Gets the status of the current navigation task.
Definition: fakeNavigationDev.cpp:149
fakeNavigation::close
virtual bool close() override
Close the DeviceDriver.
Definition: fakeNavigationDev.cpp:80
fakeNavigationThread::fakeNavigationThread
fakeNavigationThread(double _period, yarp::os::Searchable &_cfg)
Definition: fakeNavigationDev.cpp:173
PeriodicThread.h
fakeNavigation::gotoTargetByRelativeLocation
bool gotoTargetByRelativeLocation(double x, double y, double theta) override
//Sets a new relative target, expressed in local (robot) coordinate frame.
Definition: fakeNavigationDev.cpp:95
yarp::dev::Nav2D::Map2DLocation
Definition: Map2DLocation.h:30
yarp::dev::Nav2D::INavigation2DControlActions
Definition: INavigation2D.h:130
fakeNavigation::getAllNavigationWaypoints
bool getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints) override
Returns the list of waypoints generated by the navigation algorithm.
Definition: fakeNavigationDev.cpp:131
fakeNavigation::getCurrentNavigationWaypoint
bool getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint) override
Returns the current waypoint pursued by the navigation algorithm.
Definition: fakeNavigationDev.cpp:137
yarp::dev::Nav2D::NavigationMapTypeEnum
NavigationMapTypeEnum
Definition: INavigation2D.h:46
Time.h
fakeNavigation::getRelativeLocationOfCurrentTarget
bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
//Gets the last target set through a setNewRelTarget command, expressed in absolute coordinates.
Definition: fakeNavigationDev.cpp:167
fakeNavigation::applyVelocityCommand
virtual bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1) override
Apply a velocity command.
Definition: fakeNavigationDev.cpp:107