YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
JoypadControl_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_DEV_JOYPADCONTROL_NWS_YARP_H
7#define YARP_DEV_JOYPADCONTROL_NWS_YARP_H
8
13#include <yarp/dev/PolyDriver.h>
16#include <yarp/os/Bottle.h>
17#include <yarp/os/RpcServer.h>
18
19#include <map>
20#include <vector>
21#include <memory>
22
31#include <yarp/dev/AllJoyData.h>
32
34
50{
52
53 std::unique_ptr<IJoypadControlRPCd> m_RPCMsgs;
54
55 yarp::dev::IJoypadController* m_IJoypad = nullptr;
56
57 yarp::os::RpcServer m_rpcPort;
58
65
67
68 size_t m_numberOfAxes=0;
69 size_t m_numberOfSticks=0;
70 size_t m_numberOfTouchSurfaces=0;
71 size_t m_numberOfButtons=0;
72 size_t m_numberOfHats=0;
73 size_t m_numberOfTrackballs=0;
74
75 std::vector<double> m_curr_axes;
76 std::vector<yarp::dev::StickData> m_curr_sticks;
77 yarp::dev::TouchesDataList m_curr_touches;
78 std::vector<double> m_curr_buttons;
79 std::vector<unsigned char> m_curr_hats;
80 std::vector<yarp::dev::TrackballData> m_curr_trackballs;
81
82 std::vector<double> m_last_axes;
83 std::vector<yarp::dev::StickData> m_last_sticks;
84 yarp::dev::TouchesDataList m_last_touches;
85 std::vector<double> m_last_buttons;
86 std::vector<unsigned char> m_last_hats;
87 std::vector<yarp::dev::TrackballData> m_last_trackballs;
88
89 //polar mode is used in streaming.
91
92 bool openPorts();
93
94public:
100 ~JoypadControl_nws_yarp() override;
101
102 bool open(yarp::os::Searchable& params) override;
103 bool close() override;
104 bool attach(yarp::dev::PolyDriver* poly) override;
105 bool detach() override;
106 bool threadInit() override;
107 void threadRelease() override;
108 void run() override;
109
110 //rpc port
111 bool read(yarp::os::ConnectionReader& connection) override;
112};
113
114#endif
This class is the parameters parser for class JoypadControl_nws_yarp.
JoypadControl_nws_yarp: joypad input network wrapper on server side
bool detach() override
Detach the object (you must have first called attach).
void threadRelease() override
Release method.
JoypadControl_nws_yarp(JoypadControl_nws_yarp &&)=delete
JoypadControl_nws_yarp(const JoypadControl_nws_yarp &)=delete
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void run() override
Loop function.
bool threadInit() override
Initialization method.
JoypadControl_nws_yarp & operator=(const JoypadControl_nws_yarp &)=delete
JoypadControl_nws_yarp & operator=(JoypadControl_nws_yarp &&)=delete
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
bool close() override
Close the DeviceDriver.
Interface implemented by all device drivers.
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