YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Odometry2D_nws_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_ODOMETRY2D_NWS_YARP_H
7#define YARP_ODOMETRY2D_NWS_YARP_H
8
10#include <yarp/os/Stamp.h>
11
16#include <yarp/os/RpcServer.h>
17
19
20#define DEFAULT_THREAD_PERIOD 0.02 //s
21
41{
42public:
45
46 // DeviceDriver
47 bool open(yarp::os::Searchable &params) override;
48 bool close() override;
49
50 // WrapperSingle
51 bool attach(yarp::dev::PolyDriver* driver) override;
52 bool detach() override;
53
54 // PeriodicThread
55 bool threadInit() override;
56 void threadRelease() override;
57 void run() override;
58
59private:
60 std::mutex m_mutex;
61
62 //thrift
63 std::unique_ptr<IOdometry2DRPCd> m_RPC;
64
65 //rpc port
66 bool read(yarp::os::ConnectionReader& connection) override;
67
68 //buffered ports
72 yarp::os::RpcServer m_rpcPort;
73
74 //yarp streaming data
75 std::string m_odometerStreamingPortName;
76 std::string m_odometryStreamingPortName;
77 std::string m_velocityStreamingPortName;
78 std::string m_rpcPortName;
79 std::string m_deviceName;
80 size_t m_stampCount{0};
81 yarp::dev::OdometryData m_oldOdometryData{0,0,0,0,0,0,0,0,0};
82
83 // timestamp
84 yarp::os::Stamp m_lastStateStamp;
85
86 //interfaces
87 yarp::dev::PolyDriver m_driver;
88 yarp::dev::Nav2D::IOdometry2D *m_odometry2D_interface{nullptr};
89
90};
91
92#endif // YARP_ODOMETRY2D_NWS_YARP_H
This class is the parameters parser for class Odometry2D_nws_yarp.
Odometry2D_nws_yarp: A yarp nws to get the odometry and publish it on 3 yarp ports:
bool close() override
Close the DeviceDriver.
bool attach(yarp::dev::PolyDriver *driver) override
Attach to another object.
bool detach() override
Detach the object (you must have first called attach).
void run() override
Loop function.
bool threadInit() override
Initialization method.
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
void threadRelease() override
Release method.
Interface implemented by all device drivers.
IOdometry2D interface.
Definition IOdometry2D.h:23
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A mini-server for performing network communication in the background.
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:24
A port that is specialized as an RPC server.
Definition RpcServer.h:23
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21