YARP
Yet Another Robot Platform
navigation2DServer.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: LGPL-2.1-or-later
4  */
5 
6 #include <yarp/os/Network.h>
7 #include <yarp/os/RFModule.h>
8 #include <yarp/os/Time.h>
9 #include <yarp/os/Port.h>
10 #include <yarp/os/BufferedPort.h>
11 #include <yarp/os/PeriodicThread.h>
12 #include <yarp/dev/PolyDriver.h>
15 #include <yarp/dev/INavigation2D.h>
17 #include <math.h>
18 
19 #ifndef NAV_SERVER_H
20 #define NAV_SERVER_H
21 
22 #define DEFAULT_THREAD_PERIOD 0.02 //s
23 
32 // public yarp::dev::INavigation2DTargetActions,
33 // public yarp::dev::INavigation2DControlActions,
35 {
36 protected:
37 // yarp::os::BufferedPort<yarp::os::Bottle> m_yarpview_target_Port;
39  std::string m_rpcPortName;
40  std::string m_streamingPortName;
41  std::string m_yarpviewPortName;
43 
44  //drivers and interfaces
48 
49  double m_period;
51 
52 public:
57 
58 public:
59  virtual bool open(yarp::os::Searchable& prop) override;
60  virtual bool close() override;
61  virtual bool detachAll() override;
62  virtual bool attachAll(const yarp::dev::PolyDriverList &l) override;
63  virtual void run() override;
64 
66  virtual bool read(yarp::os::ConnectionReader& connection) override;
67 
68 private:
69  std::string getStatusAsString(yarp::dev::Nav2D::NavigationStatusEnum status);
70  bool parse_respond_string(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
71  bool parse_respond_vocab(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
72 
73 private:
74  std::string m_current_goal_name;
75  bool set_current_goal_name(const std::string& name);
76  bool get_current_goal_name(std::string& name);
77  bool clear_current_goal_name();
78 };
79 
80 #endif
define control board standard interfaces
navigation2DServer: Documentation to be added
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:35
Interface for an object that can wrap/attach to to another.
A container for a device driver.
Definition: PolyDriver.h:24
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
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:25
A mini-server for network communication.
Definition: Port.h:47
A base class for nested structures that can be searched.
Definition: Searchable.h:66