YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ControlBoard_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_CONTROLBOARD_NWS_YARP_H
7#define YARP_DEV_CONTROLBOARD_NWS_YARP_H
8
12#include <yarp/os/RpcServer.h>
13
19#include <yarp/dev/IMotor.h>
28#include <yarp/dev/IAxisInfo.h>
34#include <yarp/dev/IMotor.h>
36
38#include <yarp/os/Stamp.h>
39#include <yarp/sig/Vector.h>
40
43
44#include <string>
45
49
72{
73private:
74 std::mutex m_mutex;
75
76 // thrift
77 std::unique_ptr<ControlBoardRPCd> m_RPC;
78 yarp::os::RpcServer m_rpcPort;
79
80 yarp::os::BufferedPort<yarp::sig::Vector> outputPositionStatePort; // Port /state:o streaming out the encoder positions
81 yarp::os::BufferedPort<yarp::dev::CommandMessageData> inputStreamingPort; // Input streaming port for high frequency commands
82 yarp::os::Port extendedOutputStatePort; // Port /stateExt:o streaming out the struct with the robot data
83
84 yarp::os::PortWriterBuffer<yarp::dev::JointStateData> extendedOutputState_buffer; // Buffer associated to the extendedOutputStatePort port
85 yarp::os::PortReaderBuffer<yarp::os::Bottle> inputRPC_buffer; // Buffer associated to the inputRPCPort port
86
87 // RPCMessagesParser RPC_parser; // Message parser associated to the inputRPCPort port
88 StreamingMessagesParser streaming_parser; // Message parser associated to the inputStreamingPort port
89
90 std::string partName; // to open ports and print more detailed debug messages
91 yarp::sig::Vector times; // time for each joint
92 yarp::os::Stamp time; // envelope to attach to the state port
93
94 size_t subdevice_joints {0};
95 yarp::sig::VectorOf<double> tmpVariableForFloatSignals; // temporary variable to store float signals before copying them into the jointData struct
96 std::vector<yarp::dev::ControlModeEnum> tmpVariableForControlModes;
97 std::vector<yarp::dev::InteractionModeEnum> tmpVariableForInteractionModes;
98 bool subdevice_ready = false;
99 AllInterfacesStruct m_allInterfaces;
100
101 bool setDevice(yarp::dev::DeviceDriver* device, bool owned);
102
103 void closeDevice();
104 void closePorts();
105
106public:
112 ~ControlBoard_nws_yarp() override = default;
113
114 // yarp::dev::DeviceDriver
115 bool close() override;
116 bool open(yarp::os::Searchable& prop) override;
117
118 // yarp::dev::WrapperSingle
119 bool attach(yarp::dev::PolyDriver* poly) override;
120 bool detach() override;
121
122 // rpc port
123 bool read(yarp::os::ConnectionReader& connection) override;
124
125 // yarp::os::PeriodicThread
126 void run() override;
127};
128
129
130#endif // YARP_DEV_CONTROLBOARD_NWS_YARP_H
define control board standard interfaces
define control board standard interfaces
define control board standard interfaces
contains the definition of a Vector type
This class is the parameters parser for class ControlBoard_nws_yarp.
controlBoard_nws_yarp: A controlBoard network wrapper server for YARP.
~ControlBoard_nws_yarp() override=default
void run() override
Loop function.
ControlBoard_nws_yarp & operator=(const ControlBoard_nws_yarp &)=delete
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
ControlBoard_nws_yarp & operator=(ControlBoard_nws_yarp &&)=delete
ControlBoard_nws_yarp(const ControlBoard_nws_yarp &)=delete
bool close() override
Close the DeviceDriver.
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
bool detach() override
Detach the object (you must have first called attach).
ControlBoard_nws_yarp(ControlBoard_nws_yarp &&)=delete
Callback implementation after buffered input.
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 mini-server for network communication.
Definition Port.h:46
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