YARP
Yet Another Robot Platform
navigation2DServer.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/BufferedPort.h>
24 #include <yarp/os/PeriodicThread.h>
25 #include <yarp/dev/PolyDriver.h>
28 #include <yarp/dev/INavigation2D.h>
30 #include <math.h>
31 
32 #ifndef NAV_SERVER_H
33 #define NAV_SERVER_H
34 
35 #define DEFAULT_THREAD_PERIOD 0.02 //s
36 
40 // public yarp::dev::INavigation2DTargetActions,
41 // public yarp::dev::INavigation2DControlActions,
43 {
44 protected:
45 // yarp::os::BufferedPort<yarp::os::Bottle> m_yarpview_target_Port;
47  std::string m_rpcPortName;
48  std::string m_streamingPortName;
49  std::string m_yarpviewPortName;
51 
52  //drivers and interfaces
56 
57  double m_period;
59 
60 public:
65 
66 public:
67  virtual bool open(yarp::os::Searchable& prop) override;
68  virtual bool close() override;
69  virtual bool detachAll() override;
70  virtual bool attachAll(const yarp::dev::PolyDriverList &l) override;
71  virtual void run() override;
72 
74  virtual bool read(yarp::os::ConnectionReader& connection) override;
75 
76 private:
77  std::string getStatusAsString(yarp::dev::Nav2D::NavigationStatusEnum status);
78  bool parse_respond_string(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
79  bool parse_respond_vocab(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
80 };
81 
82 #endif
navigation2DServer::detachAll
virtual bool detachAll() override
Detach the object (you must have first called attach).
Definition: navigation2DServer.cpp:76
navigation2DServer::pNav
yarp::dev::PolyDriver pNav
Definition: navigation2DServer.h:53
INavigation2D.h
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:72
navigation2DServer::m_rpcPort
yarp::os::Port m_rpcPort
Definition: navigation2DServer.h:46
Network.h
navigation2DServer::open
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
Definition: navigation2DServer.cpp:87
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:68
Port.h
yarp::dev::Nav2D::INavigation2DTargetActions
Definition: INavigation2D.h:64
yarp::dev::DeviceDriver
Definition: DeviceDriver.h:37
navigation2DServer::m_navigation_status
yarp::dev::Nav2D::NavigationStatusEnum m_navigation_status
Definition: navigation2DServer.h:50
yarp::dev::Nav2D::NavigationStatusEnum
NavigationStatusEnum
Definition: INavigation2D.h:31
yarp::dev::PolyDriverList
Definition: PolyDriverList.h:21
ControlBoardInterfaces.h
navigation2DServer::m_stats_time_last
double m_stats_time_last
Definition: navigation2DServer.h:58
navigation2DServer::read
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: navigation2DServer.cpp:470
navigation2DServer::run
virtual void run() override
Loop function.
Definition: navigation2DServer.cpp:503
navigation2DServer::m_rpcPortName
std::string m_rpcPortName
Definition: navigation2DServer.h:47
yarp::os::Port
Definition: Port.h:49
yarp::os::PortReader
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:27
PolyDriver.h
yarp::dev::PolyDriver
Definition: PolyDriver.h:25
navigation2DServer
Definition: navigation2DServer.h:37
navigation2DServer::m_period
double m_period
Definition: navigation2DServer.h:57
navigation2DServer::initialize_YARP
bool initialize_YARP(yarp::os::Searchable &config)
Definition: navigation2DServer.cpp:146
RFModule.h
BufferedPort.h
IMultipleWrapper.h
yarp::os::PeriodicThread
Definition: PeriodicThread.h:24
PeriodicThread.h
ILocalization2D.h
yarp::dev::Nav2D::INavigation2DControlActions
Definition: INavigation2D.h:123
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:39
navigation2DServer::iNav_ctrl
yarp::dev::Nav2D::INavigation2DControlActions * iNav_ctrl
Definition: navigation2DServer.h:54
yarp::dev::IMultipleWrapper
Definition: IMultipleWrapper.h:29
navigation2DServer::iNav_target
yarp::dev::Nav2D::INavigation2DTargetActions * iNav_target
Definition: navigation2DServer.h:55
navigation2DServer::m_streamingPortName
std::string m_streamingPortName
Definition: navigation2DServer.h:48
navigation2DServer::navigation2DServer
navigation2DServer()
Default module constructor.
Definition: navigation2DServer.cpp:42
Time.h
navigation2DServer::close
virtual bool close() override
Close the DeviceDriver.
Definition: navigation2DServer.cpp:157
navigation2DServer::m_yarpviewPortName
std::string m_yarpviewPortName
Definition: navigation2DServer.h:49
navigation2DServer::attachAll
virtual bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
Definition: navigation2DServer.cpp:49