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 
45 // public yarp::dev::INavigation2DTargetActions,
46 // public yarp::dev::INavigation2DControlActions,
48 {
49 protected:
50 // yarp::os::BufferedPort<yarp::os::Bottle> m_yarpview_target_Port;
52  std::string m_rpcPortName;
53  std::string m_streamingPortName;
54  std::string m_yarpviewPortName;
56 
57  //drivers and interfaces
61 
62  double m_period;
64 
65 public:
70 
71 public:
72  virtual bool open(yarp::os::Searchable& prop) override;
73  virtual bool close() override;
74  virtual bool detachAll() override;
75  virtual bool attachAll(const yarp::dev::PolyDriverList &l) override;
76  virtual void run() override;
77 
79  virtual bool read(yarp::os::ConnectionReader& connection) override;
80 
81 private:
82  std::string getStatusAsString(yarp::dev::Nav2D::NavigationStatusEnum status);
83  bool parse_respond_string(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
84  bool parse_respond_vocab(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
85 };
86 
87 #endif
navigation2DServer::detachAll
virtual bool detachAll() override
Detach the object (you must have first called attach).
Definition: navigation2DServer.cpp:81
navigation2DServer::pNav
yarp::dev::PolyDriver pNav
Definition: navigation2DServer.h:58
INavigation2D.h
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
navigation2DServer::m_rpcPort
yarp::os::Port m_rpcPort
Definition: navigation2DServer.h:51
Network.h
navigation2DServer::open
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
Definition: navigation2DServer.cpp:92
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
Port.h
yarp::dev::Nav2D::INavigation2DTargetActions
Definition: INavigation2D.h:71
yarp::dev::DeviceDriver
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
navigation2DServer::m_navigation_status
yarp::dev::Nav2D::NavigationStatusEnum m_navigation_status
Definition: navigation2DServer.h:55
yarp::dev::Nav2D::NavigationStatusEnum
NavigationStatusEnum
Definition: INavigation2D.h:32
yarp::dev::PolyDriverList
Definition: PolyDriverList.h:22
ControlBoardInterfaces.h
define control board standard interfaces
navigation2DServer::m_stats_time_last
double m_stats_time_last
Definition: navigation2DServer.h:63
navigation2DServer::read
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
Definition: navigation2DServer.cpp:475
navigation2DServer::run
virtual void run() override
Loop function.
Definition: navigation2DServer.cpp:508
navigation2DServer::m_rpcPortName
std::string m_rpcPortName
Definition: navigation2DServer.h:52
yarp::os::Port
A mini-server for network communication.
Definition: Port.h:50
yarp::os::PortReader
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
PolyDriver.h
yarp::dev::PolyDriver
A container for a device driver.
Definition: PolyDriver.h:27
navigation2DServer
navigation2DServer: Documentation to be added
Definition: navigation2DServer.h:48
navigation2DServer::m_period
double m_period
Definition: navigation2DServer.h:62
navigation2DServer::initialize_YARP
bool initialize_YARP(yarp::os::Searchable &config)
Definition: navigation2DServer.cpp:151
RFModule.h
BufferedPort.h
IMultipleWrapper.h
yarp::os::PeriodicThread
An abstraction for a periodic thread.
Definition: PeriodicThread.h:25
PeriodicThread.h
ILocalization2D.h
yarp::dev::Nav2D::INavigation2DControlActions
Definition: INavigation2D.h:130
yarp::os::ConnectionReader
An interface for reading from a network connection.
Definition: ConnectionReader.h:40
navigation2DServer::iNav_ctrl
yarp::dev::Nav2D::INavigation2DControlActions * iNav_ctrl
Definition: navigation2DServer.h:59
yarp::dev::IMultipleWrapper
Interface for an object that can wrap/attach to to another.
Definition: IMultipleWrapper.h:30
navigation2DServer::iNav_target
yarp::dev::Nav2D::INavigation2DTargetActions * iNav_target
Definition: navigation2DServer.h:60
navigation2DServer::m_streamingPortName
std::string m_streamingPortName
Definition: navigation2DServer.h:53
navigation2DServer::navigation2DServer
navigation2DServer()
Default module constructor.
Definition: navigation2DServer.cpp:47
Time.h
navigation2DServer::close
virtual bool close() override
Close the DeviceDriver.
Definition: navigation2DServer.cpp:162
navigation2DServer::m_yarpviewPortName
std::string m_yarpviewPortName
Definition: navigation2DServer.h:54
navigation2DServer::attachAll
virtual bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
Definition: navigation2DServer.cpp:54