YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Odometry2D_nws_ros.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_ODOMETRY2D_NWS_YARP_H
7#define YARP_ODOMETRY2D_NWS_YARP_H
8
9#include <yarp/os/Node.h>
11#include <yarp/os/Publisher.h>
12#include <yarp/os/Stamp.h>
13
17
21
22#ifndef _USE_MATH_DEFINES
23#define _USE_MATH_DEFINES
24#endif
25
26#define DEG2RAD M_PI/180.0
27#define DEFAULT_THREAD_PERIOD 0.02 //s
28
94// public yarp::os::PortReader
95{
96public:
99
100 // DeviceDriver
101 bool open(yarp::os::Searchable &params) override;
102 bool close() override;
103
104 // WrapperSingle
105 bool attach(yarp::dev::PolyDriver* driver) override;
106 bool detach() override;
107
108 // PeriodicThread
109 bool threadInit() override;
110 void threadRelease() override;
111 void run() override;
112
113
114private:
115 // parameters from configuration
116 std::string m_topicName;
117 std::string m_nodeName;
118 std::string m_odomFrame;
119 std::string m_baseFrame;
120 bool m_enable_publish_tf = true;
121
122 // timestamp
123 yarp::os::Stamp m_lastStateStamp;
124
125 // period for thread
126 double m_period{DEFAULT_THREAD_PERIOD};
127
128 //ros node
129 yarp::os::Node* m_node;
130
131 //interfaces
132 yarp::dev::PolyDriver m_driver;
133 yarp::dev::Nav2D::IOdometry2D *m_odometry2D_interface{nullptr};
136
137};
138
139#endif // YARP_ODOMETRY2D_NWS_YARP_H
#define DEFAULT_THREAD_PERIOD
Odometry2D_nws_ros: A ros nws to get odometry and publish it on a ros topic. The attached device must...
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
bool detach() override
Detach the object (you must have first called attach).
bool threadInit() override
Initialization method.
void run() override
Loop function.
void threadRelease() override
Release method.
bool attach(yarp::dev::PolyDriver *driver) override
Attach to another object.
bool close() override
Close the DeviceDriver.
Interface implemented by all device drivers.
IOdometry2D interface.
Definition IOdometry2D.h:22
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.
The Node class.
Definition Node.h:23
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition Searchable.h:56
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21