YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Odometry2D_nwc_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_DEV_ODOMETRY2D_NWC_YARP_H
7#define YARP_DEV_ODOMETRY2D_NWC_YARP_H
8
9
10#include <yarp/os/Network.h>
11#include <yarp/os/Stamp.h>
15#include <yarp/sig/Vector.h>
16#include <yarp/os/Time.h>
17
18#include <mutex>
19
20#include "IOdometry2DMsgs.h"
22
24 public yarp::os::BufferedPort<yarp::dev::OdometryData>
25{
26 const int DATA_TIMEOUT_ms=100; //ms
27
29 std::mutex mutex;
30 yarp::os::Stamp lastStamp;
31 double deltaT;
32 double deltaTMax;
33 double deltaTMin;
34 double prev;
35 double now;
36
37 int count;
38
39public:
42 void onRead(yarp::dev::OdometryData& v) override;
43
44public:
45 bool timeout_occurred = false;
46 inline void resetStat();
48 inline int getIterations();
49 // time is in ms
50 void getEstFrequency(int &ite, double &av, double &min, double &max);
51};
52
65{
66protected:
69 std::mutex m_mutex;
72
73public:
74 /* DeviceDriver methods */
75 bool open(yarp::os::Searchable& config) override;
76 bool close() override;
77
78 /* IOdometry2D methods */
79 virtual yarp::dev::ReturnValue getOdometry(yarp::dev::OdometryData& odom, double* timestamp = nullptr) override;
80 virtual yarp::dev::ReturnValue resetOdometry() override;
81};
82
83#endif // YARP_DEV_ODOMETRY2D_NWC_YARP_H
contains the definition of a Vector type
This class is the parameters parser for class Odometry2D_nwc_yarp.
Odometry2D_nwc_yarp: The client side of any IOdometry2D capable device.
OdometryData2DInputPortProcessor m_inputPort
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
virtual yarp::dev::ReturnValue getOdometry(yarp::dev::OdometryData &odom, double *timestamp=nullptr) override
Gets the odometry of the robot, including its velocity expressed in the world and in the local refere...
bool close() override
Close the DeviceDriver.
virtual yarp::dev::ReturnValue resetOdometry() override
Resets the odometry of the robot to zero.
void onRead(yarp::dev::OdometryData &v) override
void getEstFrequency(int &ite, double &av, double &min, double &max)
bool getLast(yarp::dev::OdometryData &data, yarp::os::Stamp &stmp)
Interface implemented by all device drivers.
IOdometry2D interface.
Definition IOdometry2D.h:23
A mini-server for performing network communication in the background.
A mini-server for network communication.
Definition Port.h:46
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