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 
43 {
44 public:
46 
47 public:
48  virtual bool open(yarp::os::Searchable& config) override;
49 
51 
52  //module cleanup
53  virtual bool close() override;
54 
55 public:
62 
68  bool gotoTargetByRelativeLocation(double x, double y, double theta) override;
69 
75  bool gotoTargetByRelativeLocation(double x, double y) override;
76 
83 
89  bool getRelativeLocationOfCurrentTarget(double& x, double& y, double& theta) override;
90 
96 
101  bool stopNavigation() override;
102 
107  bool suspendNavigation(double time) override;
108 
113  bool resumeNavigation() override;
114 
121 
128 
136 
142  bool recomputeCurrentNavigationPath() override;
143 
152  virtual bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout = 0.1) override;
153 };
define control board standard interfaces
virtual void threadRelease() override
Release method.
fakeNavigationThread(double _period, yarp::os::Searchable &_cfg)
virtual void run() override
Loop function.
virtual bool threadInit() override
Initialization method.
bool resumeNavigation() override
//Resumes a previously paused navigation task.
virtual bool close() override
Close the DeviceDriver.
bool getNavigationStatus(yarp::dev::Nav2D::NavigationStatusEnum &status) override
//Gets the status of the current navigation task.
bool getCurrentNavigationWaypoint(yarp::dev::Nav2D::Map2DLocation &curr_waypoint) override
Returns the current waypoint pursued by the navigation algorithm.
bool getRelativeLocationOfCurrentTarget(double &x, double &y, double &theta) override
//Gets the last target set through a setNewRelTarget command, expressed in absolute coordinates.
bool stopNavigation() override
//Stops the current navigation task.
bool suspendNavigation(double time) override
//Pauses the current navigation task.
virtual bool applyVelocityCommand(double x_vel, double y_vel, double theta_vel, double timeout=0.1) override
Apply a velocity command.
bool gotoTargetByRelativeLocation(double x, double y, double theta) override
//Sets a new relative target, expressed in local (robot) coordinate frame.
virtual bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool recomputeCurrentNavigationPath() override
Forces the navigation system to recompute the path from the current robot position to the current goa...
bool getAbsoluteLocationOfCurrentTarget(yarp::dev::Nav2D::Map2DLocation &target) override
//Gets the last target set through a setNewAbsTarget() command.
fakeNavigationThread * navThread
bool gotoTargetByAbsoluteLocation(yarp::dev::Nav2D::Map2DLocation loc) override
Sets a new navigation target, expressed in the absolute (map) coordinate frame.
bool getAllNavigationWaypoints(yarp::dev::Nav2D::TrajectoryTypeEnum trajectory_type, yarp::dev::Nav2D::Map2DPath &waypoints) override
Returns the list of waypoints generated by the navigation algorithm.
bool getCurrentNavigationMap(yarp::dev::Nav2D::NavigationMapTypeEnum map_type, yarp::dev::Nav2D::MapGrid2D &map) override
Returns the current navigation map processed by the navigation algorithm.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition: Searchable.h:69