YARP
Yet Another Robot Platform
Localization2DServer.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 #ifndef YARP_DEV_LOCALIZATION2DSERVER_H
20 #define YARP_DEV_LOCALIZATION2DSERVER_H
21 
22 
23 #include <yarp/os/Network.h>
24 #include <yarp/os/RFModule.h>
25 #include <yarp/os/Time.h>
26 #include <yarp/os/Port.h>
27 #include <yarp/os/Stamp.h>
28 #include <yarp/os/Node.h>
29 #include <yarp/os/Publisher.h>
30 #include <yarp/os/BufferedPort.h>
31 #include <yarp/os/PeriodicThread.h>
32 #include <yarp/dev/PolyDriver.h>
36 #include <yarp/dev/OdometryData.h>
39 #include <math.h>
40 
62 {
63 protected:
64 
65  //general options
68 
69  //yarp
70  std::string m_local_name;
72  std::string m_rpcPortName;
74  std::string m_2DLocationPortName;
76  std::string m_odometryPortName;
77  std::string m_robot_frame;
78  std::string m_fixed_frame;
79 
80  //ROS
81  std::string m_child_frame_id;
82  std::string m_parent_frame_id;
86 
87  //drivers and interfaces
90 
92  double m_period;
96 
100 
101 private:
102  void publish_2DLocation_on_yarp_port();
103  void publish_odometry_on_yarp_port();
104  void publish_odometry_on_ROS_topic();
105  void publish_odometry_on_TF_topic();
106 
107 public:
109 
110 public:
111  virtual bool open(yarp::os::Searchable& prop) override;
112  virtual bool close() override;
113  virtual bool detachAll() override;
114  virtual bool attachAll(const yarp::dev::PolyDriverList &l) override;
115  virtual void run() override;
116 
118  bool initialize_ROS(yarp::os::Searchable& config);
119  virtual bool read(yarp::os::ConnectionReader& connection) override;
120 };
121 
122 #endif // YARP_DEV_LOCALIZATION2DSERVER_H
define control board standard interfaces
bool initialize_ROS(yarp::os::Searchable &config)
yarp::dev::Nav2D::Map2DLocation m_current_position
yarp::dev::Nav2D::ILocalization2D * iLoc
yarp::os::BufferedPort< yarp::dev::Nav2D::Map2DLocation > m_2DLocationPort
virtual bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
yarp::dev::PolyDriver pLoc
virtual bool close() override
Close the DeviceDriver.
yarp::dev::Nav2D::LocalizationStatusEnum m_current_status
virtual bool detachAll() override
Detach the object (you must have first called attach).
yarp::os::BufferedPort< yarp::dev::OdometryData > m_odometryPort
yarp::os::Publisher< yarp::rosmsg::nav_msgs::Odometry > m_odometry_publisher
yarp::os::Node * m_ros_node
virtual bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
yarp::os::Stamp m_loc_stamp
virtual void run() override
Loop function.
yarp::os::Publisher< yarp::rosmsg::tf2_msgs::TFMessage > m_tf_publisher
yarp::os::Stamp m_odom_stamp
yarp::dev::OdometryData m_current_odometry
virtual bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool initialize_YARP(yarp::os::Searchable &config)
Interface implemented by all device drivers.
Definition: DeviceDriver.h:38
Interface for an object that can wrap/attach to to another.
ILocalization2D interface.
A container for a device driver.
Definition: PolyDriver.h:27
An interface for reading from a network connection.
The Node class.
Definition: Node.h:27
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
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25