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
67{
68private:
69 std::mutex m_mutex;
70
71 // thrift
72 std::unique_ptr<ControlBoardRPCd> m_RPC;
73 yarp::os::RpcServer m_rpcPort;
74
75 yarp::os::BufferedPort<yarp::sig::Vector> outputPositionStatePort; // Port /state:o streaming out the encoder positions
76 yarp::os::BufferedPort<yarp::dev::CommandMessageData> inputStreamingPort; // Input streaming port for high frequency commands
77 yarp::os::BufferedPort<yarp::dev::JointStateData> extendedOutputStatePort; // Port /stateExt:o streaming out the struct with the robot data
78
79
80 // RPCMessagesParser RPC_parser; // Message parser associated to the inputRPCPort port
81 StreamingMessagesParser streaming_parser; // Message parser associated to the inputStreamingPort port
82
83 std::string partName; // to open ports and print more detailed debug messages
84 yarp::sig::Vector times; // time for each joint
85 yarp::os::Stamp time; // envelope to attach to the state port
86
87 size_t subdevice_joints {0};
88 yarp::sig::VectorOf<double> tmpVariableForFloatSignals; // temporary variable to store float signals before copying them into the jointData struct
89 std::vector<yarp::dev::ControlModeEnum> tmpVariableForControlModes;
90 std::vector<yarp::dev::InteractionModeEnum> tmpVariableForInteractionModes;
91 bool subdevice_ready = false;
92 AllInterfacesStruct m_allInterfaces;
93
94 bool setDevice(yarp::dev::DeviceDriver* device, bool owned);
95
96 void closeDevice();
97 void closePorts();
98
99public:
105 ~ControlBoard_nws_yarp() override = default;
106
107 // yarp::dev::DeviceDriver
108 bool close() override;
109 bool open(yarp::os::Searchable& prop) override;
110
111 // yarp::dev::WrapperSingle
112 bool attach(yarp::dev::PolyDriver* poly) override;
113 bool detach() override;
114
115 // rpc port
116 bool read(yarp::os::ConnectionReader& connection) override;
117
118 // yarp::os::PeriodicThread
119 void run() override;
120};
121
122
123#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 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:18
typename vector_selector< T >::type VectorOf
Definition Vector.h:174