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
define control board standard interfaces
navigation2DServer()
Default module constructor.
std::string m_yarpviewPortName
bool initialize_YARP(yarp::os::Searchable &config)
yarp::os::Port m_rpcPort
virtual bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
yarp::dev::Nav2D::NavigationStatusEnum m_navigation_status
std::string m_streamingPortName
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
yarp::dev::PolyDriver pNav
yarp::dev::Nav2D::INavigation2DControlActions * iNav_ctrl
virtual bool detachAll() override
Detach the object (you must have first called attach).
virtual bool close() override
Close the DeviceDriver.
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual void run() override
Loop function.
yarp::dev::Nav2D::INavigation2DTargetActions * iNav_target
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
Interface for an object that can wrap/attach to to another.
A container for a device driver.
Definition: PolyDriver.h:27
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
An interface for reading from a network connection.
An abstraction for a periodic thread.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
A mini-server for network communication.
Definition: Port.h:50
A base class for nested structures that can be searched.
Definition: Searchable.h:69