YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ControlBoard_nws_yarp.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
8
11
12#include <yarp/os/LogStream.h>
14
15#include <numeric>
16#include <cmath>
17
18using namespace yarp::os;
19using namespace yarp::dev;
20using namespace yarp::sig;
22
23const double DEFAULT_PERIOD = 0.02;
24
29
30void ControlBoard_nws_yarp::closePorts()
31{
32 m_rpcPort.interrupt();
33 m_rpcPort.removeCallbackLock();
34 m_rpcPort.close();
35
36 inputStreamingPort.interrupt();
37 inputStreamingPort.close();
38
39 outputPositionStatePort.interrupt();
40 outputPositionStatePort.close();
41
42 extendedOutputStatePort.interrupt();
43 extendedOutputStatePort.close();
44}
45
47{
48 // Ensure that the device is not running
49 if (isRunning()) {
50 stop();
51 }
52
53 closeDevice();
54 closePorts();
55
56 return true;
57}
58
60{
61 if (!parseParams(config)) { return false; }
62
63 //rpc port
64 std::string server_rpc_portname = m_name + "/nws/rpc:i";
65 if (!m_rpcPort.open(server_rpc_portname))
66 {
67 yCError(CONTROLBOARD, "Failed to open port %s", server_rpc_portname.c_str());
68 return false;
69 }
70 m_rpcPort.setReader(*this);
71
72 std::string rootName = m_name;
73
74 //streaming port
75 if (!inputStreamingPort.open(rootName + "/command:i")) {
76 yCError(CONTROLBOARD) << "Error opening port " << rootName + "/rpc:i";
77 closePorts();
78 return false;
79 }
80 inputStreamingPort.setStrict();
81 inputStreamingPort.useCallback(streaming_parser);
82
83 if (!outputPositionStatePort.open(rootName + "/state:o")) {
84 yCError(CONTROLBOARD) << "Error opening port " << rootName + "/state:o";
85 closePorts();
86 return false;
87 }
88
89 // Extended output state port
90 if (!extendedOutputStatePort.open(rootName + "/stateExt:o")) {
91 yCError(CONTROLBOARD) << "Error opening port " << rootName + "/state:o";
92 closePorts();
93 return false;
94 }
95 extendedOutputState_buffer.attach(extendedOutputStatePort);
96
97 // In case attach is not deferred and the controlboard already owns a valid device
98 // we can start the thread. Otherwise this will happen when attachAll is called
99 if (subdevice_ready) {
101 if (!start()) {
102 yCError(CONTROLBOARD) << "Error starting thread";
103 return false;
104 }
105 }
106
107 return true;
108}
109
110bool ControlBoard_nws_yarp::setDevice(yarp::dev::DeviceDriver* driver, bool owned)
111{
112 // Save the pointer and subDeviceOwned
114
115 subdevice_ptr->view(m_allInterfaces.iJointFault);
116 if (!m_allInterfaces.iJointFault) {
117 yCWarning(CONTROLBOARD, "Part <%s>: iJointFault interface was not found in subdevice.", partName.c_str());
118 }
119
120 subdevice_ptr->view(m_allInterfaces.iPidControl);
121 if (!m_allInterfaces.iPidControl) {
122 yCWarning(CONTROLBOARD, "Part <%s>: IPidControl interface was not found in subdevice.", partName.c_str());
123 }
124
125 subdevice_ptr->view(m_allInterfaces.iPositionControl);
126 if (!m_allInterfaces.iPositionControl) {
127 yCWarning(CONTROLBOARD, "Part <%s>: IPositionControl interface was not found in subdevice.", partName.c_str());
128 }
129
130 subdevice_ptr->view(m_allInterfaces.iPositionDirect);
131 if (!m_allInterfaces.iPositionDirect) {
132 yCWarning(CONTROLBOARD, "Part <%s>: IPositionDirect interface was not found in subdevice.", partName.c_str());
133 }
134
135 subdevice_ptr->view(m_allInterfaces.iVelocityControl);
136 if (!m_allInterfaces.iVelocityControl) {
137 yCWarning(CONTROLBOARD, "Part <%s>: IVelocityControl interface was not found in subdevice.", partName.c_str());
138 }
139
140 subdevice_ptr->view(m_allInterfaces.iEncodersTimed);
141 if (!m_allInterfaces.iEncodersTimed) {
142 yCWarning(CONTROLBOARD, "Part <%s>: IEncodersTimed interface was not found in subdevice.", partName.c_str());
143 }
144
145 subdevice_ptr->view(m_allInterfaces.iMotor);
146 if (!m_allInterfaces.iMotor) {
147 yCWarning(CONTROLBOARD, "Part <%s>: IMotor interface was not found in subdevice.", partName.c_str());
148 }
149
150 subdevice_ptr->view(m_allInterfaces.iMotorEncoders);
151 if (!m_allInterfaces.iMotorEncoders) {
152 yCWarning(CONTROLBOARD, "Part <%s>: IMotorEncoders interface was not found in subdevice.", partName.c_str());
153 }
154
155 subdevice_ptr->view(m_allInterfaces.iAmplifierControl);
156 if (!m_allInterfaces.iAmplifierControl) {
157 yCWarning(CONTROLBOARD, "Part <%s>: IAmplifierControl interface was not found in subdevice.", partName.c_str());
158 }
159
160 subdevice_ptr->view(m_allInterfaces.iControlLimits);
161 if (!m_allInterfaces.iControlLimits) {
162 yCWarning(CONTROLBOARD, "Part <%s>: IControlLimits interface was not found in subdevice.", partName.c_str());
163 }
164
165 subdevice_ptr->view(m_allInterfaces.iControlCalibration);
166 if (!m_allInterfaces.iControlCalibration) {
167 yCWarning(CONTROLBOARD, "Part <%s>: IControlCalibration interface was not found in subdevice.", partName.c_str());
168 }
169
170 subdevice_ptr->view(m_allInterfaces.iTorqueControl);
171 if (!m_allInterfaces.iTorqueControl) {
172 yCWarning(CONTROLBOARD, "Part <%s>: ITorqueControl interface was not found in subdevice.", partName.c_str());
173 }
174
175 subdevice_ptr->view(m_allInterfaces.iImpedanceControl);
176 if (!m_allInterfaces.iImpedanceControl) {
177 yCWarning(CONTROLBOARD, "Part <%s>: IImpedanceControl interface was not found in subdevice.", partName.c_str());
178 }
179
180 subdevice_ptr->view(m_allInterfaces.iControlMode);
181 if (!m_allInterfaces.iControlMode) {
182 yCWarning(CONTROLBOARD, "Part <%s>: IControlMode interface was not found in subdevice.", partName.c_str());
183 }
184
185 subdevice_ptr->view(m_allInterfaces.iAxisInfo);
186 if (!m_allInterfaces.iAxisInfo) {
187 yCWarning(CONTROLBOARD, "Part <%s>: IAxisInfo interface was not found in subdevice.", partName.c_str());
188 }
189
190 subdevice_ptr->view(m_allInterfaces.iPreciselyTimed);
191 if (!m_allInterfaces.iPreciselyTimed) {
192 yCWarning(CONTROLBOARD, "Part <%s>: IPreciselyTimed interface was not found in subdevice.", partName.c_str());
193 }
194
195 subdevice_ptr->view(m_allInterfaces.iInteractionMode);
196 if (!m_allInterfaces.iInteractionMode) {
197 yCWarning(CONTROLBOARD, "Part <%s>: IInteractionMode interface was not found in subdevice.", partName.c_str());
198 }
199
200 subdevice_ptr->view(m_allInterfaces.iRemoteCalibrator);
201 if (!m_allInterfaces.iRemoteCalibrator) {
202 yCWarning(CONTROLBOARD, "Part <%s>: iRemoteCalibrator interface was not found in subdevice.", partName.c_str());
203 }
204
205 subdevice_ptr->view(m_allInterfaces.iRemoteVariables);
206 if (!m_allInterfaces.iRemoteVariables) {
207 yCWarning(CONTROLBOARD, "Part <%s>: IRemoteVariables interface was not found in subdevice.", partName.c_str());
208 }
209
210 subdevice_ptr->view(m_allInterfaces.iPWMControl);
211 if (!m_allInterfaces.iPWMControl) {
212 yCWarning(CONTROLBOARD, "Part <%s>: IPWMControl interface was not found in subdevice.", partName.c_str());
213 }
214
215 subdevice_ptr->view(m_allInterfaces.iCurrentControl);
216 if (!m_allInterfaces.iCurrentControl) {
217 yCWarning(CONTROLBOARD, "Part <%s>: ICurrentControl interface was not found in subdevice.", partName.c_str());
218 }
219
220 subdevice_ptr->view(m_allInterfaces.iJointBrake);
221 if (!m_allInterfaces.iJointBrake) {
222 yCWarning(CONTROLBOARD, "Part <%s>: iJointBrake interface was not found in subdevice.", partName.c_str());
223 }
224
225 subdevice_ptr->view(m_allInterfaces.iVelocityDirect);
226 if (!m_allInterfaces.iVelocityDirect) {
227 yCWarning(CONTROLBOARD, "Part <%s>: iVelocityDirect interface was not found in subdevice.", partName.c_str());
228 }
229
230 // Get the number of controlled joints
231 size_t tmp_axes = 0;
232 if (m_allInterfaces.iAxisInfo)
233 {
234 if (!m_allInterfaces.iAxisInfo->getAxes(tmp_axes)) {
235 yCError(CONTROLBOARD) << "Part <%s>: iAxisInfo->getAxes() failed for subdevice " << partName.c_str();
236 return false;
237 }
238 }
239 else if (m_allInterfaces.iEncodersTimed)
240 {
241 if (!m_allInterfaces.iEncodersTimed->getAxes(tmp_axes)) {
242 yCError(CONTROLBOARD) << "Part <%s>: iEncodersTimed->getAxes() failed for subdevice " << partName.c_str();
243 return false;
244 }
245 }
246 else if (m_allInterfaces.iPositionControl)
247 {
248 if (!m_allInterfaces.iPositionControl->getAxes(tmp_axes)) {
249 yCError(CONTROLBOARD) << "Part <%s>: iPositionControl->getAxes() failed for subdevice " << partName.c_str();
250 return false;
251 }
252 }
253 else if (m_allInterfaces.iVelocityControl)
254 {
255 if (!m_allInterfaces.iVelocityControl->getAxes(tmp_axes)) {
256 yCError(CONTROLBOARD) << "Part <%s>: iVelocityControl->getAxes() failed for subdevice " << partName.c_str();
257 return false;
258 }
259 }
260
261 if (tmp_axes <= 0) {
262 yCError(CONTROLBOARD, "Part <%s>: attached device has an invalid number of joints (%d)", partName.c_str(), tmp_axes);
263 return false;
264 }
265 subdevice_joints = static_cast<size_t>(tmp_axes);
266 times.resize(subdevice_joints);
267
268 // Initialization
269 streaming_parser.init(subdevice_ptr);
270 streaming_parser.initialize();
271
272 return true;
273}
274
275void ControlBoard_nws_yarp::closeDevice()
276{
277 // Reset callbacks
278 streaming_parser.reset();
279
280 subdevice_joints = 0;
281 subdevice_ready = false;
282
283 times.clear();
284
285 // Clear all interfaces
286 m_allInterfaces.iPidControl = nullptr;
287 m_allInterfaces.iPositionControl = nullptr;
288 m_allInterfaces.iPositionDirect = nullptr;
289 m_allInterfaces.iVelocityControl = nullptr;
290 m_allInterfaces.iEncodersTimed = nullptr;
291 m_allInterfaces.iMotor = nullptr;
292 m_allInterfaces.iMotorEncoders = nullptr;
293 m_allInterfaces.iAmplifierControl = nullptr;
294 m_allInterfaces.iControlLimits = nullptr;
295 m_allInterfaces.iControlCalibration = nullptr;
296 m_allInterfaces.iTorqueControl = nullptr;
297 m_allInterfaces.iImpedanceControl = nullptr;
298 m_allInterfaces.iControlMode = nullptr;
299 m_allInterfaces.iAxisInfo = nullptr;
300 m_allInterfaces.iPreciselyTimed = nullptr;
301 m_allInterfaces.iInteractionMode = nullptr;
302 m_allInterfaces.iRemoteVariables = nullptr;
303 m_allInterfaces.iPWMControl = nullptr;
304 m_allInterfaces.iCurrentControl = nullptr;
305 m_allInterfaces.iJointFault = nullptr;
306 m_allInterfaces.iVelocityDirect = nullptr;
307}
308
310{
311 // Check if we already instantiated a subdevice previously
312 if (subdevice_ready) {
313 return false;
314 }
315
316 if (!setDevice(poly, false)) {
317 return false;
318 }
319
321 if (!start()) {
322 yCError(CONTROLBOARD) << "Error starting thread";
323 return false;
324 }
325
326 m_RPC = std::make_unique<ControlBoardRPCd>(this->subdevice_joints, m_allInterfaces);
327
328 return true;
329}
330
332{
333 // Ensure that the device is not running
334 if (isRunning()) {
335 stop();
336 }
337
338 closeDevice();
339
340 return true;
341}
342
344{
345 // check we are not overflowing with input messages
346 constexpr int reads_for_warning = 20;
347 if (inputStreamingPort.getPendingReads() >= reads_for_warning) {
348 yCIWarning(CONTROLBOARD, id()) << "Number of streaming input messages to be read is " << inputStreamingPort.getPendingReads() << " and can overflow";
349 }
350 // handle stateExt first
351 JointStateData& data = extendedOutputState_buffer.get();
352
353 data.jointPosition.resize(subdevice_joints);
354 data.jointVelocity.resize(subdevice_joints);
355 data.jointAcceleration.resize(subdevice_joints);
356 data.motorPosition.resize(subdevice_joints);
357 data.motorVelocity.resize(subdevice_joints);
358 data.motorAcceleration.resize(subdevice_joints);
359 data.torque.resize(subdevice_joints);
360 data.pwmDutycycle.resize(subdevice_joints);
361 data.temperature.resize(subdevice_joints);
362 data.current.resize(subdevice_joints);
363 data.controlMode.resize(subdevice_joints);
364 data.interactionMode.resize(subdevice_joints);
365
366 // resize the temporary vector
367 tmpVariableForFloatSignals.resize(subdevice_joints);
368 tmpVariableForControlModes.resize(subdevice_joints);
369 tmpVariableForInteractionModes.resize(subdevice_joints);
370
371 // Get data from HW
372 if (m_allInterfaces.iEncodersTimed) {
373 data.jointPosition_isValid = m_allInterfaces.iEncodersTimed->getEncodersTimed(data.jointPosition.data(), times.data());
376 } else {
377 data.jointPosition_isValid = false;
378 data.jointVelocity_isValid = false;
379 data.jointAcceleration_isValid = false;
380 }
381
382 if (m_allInterfaces.iMotorEncoders) {
386 } else {
387 data.motorPosition_isValid = false;
388 data.motorVelocity_isValid = false;
389 data.motorAcceleration_isValid = false;
390 }
391
392 if (m_allInterfaces.iMotor) {
393 // the temperature is a double in the interface, but a float in the jointData struct.
394 data.temperature_isValid = m_allInterfaces.iMotor->getTemperatures(tmpVariableForFloatSignals.data());
395
396 // The temperature values are stored as double in the interface but need to be converted to float in the jointData struct.
397 // We manually copy them, and while this conversion may lead to a minor loss of precision, it is negligible for temperature values,
398 // which typically do not require double precision. std::copy ensures a safe and efficient conversion.
399 std::copy(tmpVariableForFloatSignals.begin(), tmpVariableForFloatSignals.end(), data.temperature.begin());
400 } else {
401 data.temperature_isValid = false;
402 }
403
404 if (m_allInterfaces.iTorqueControl) {
405 data.torque_isValid = m_allInterfaces.iTorqueControl->getTorques(data.torque.data());
406 } else {
407 data.torque_isValid = false;
408 }
409
410 if (m_allInterfaces.iPWMControl) {
411 // the pwmDutycycle is a double in the interface, but a float in the jointData struct.
412 data.pwmDutycycle_isValid = m_allInterfaces.iPWMControl->getDutyCycles(tmpVariableForFloatSignals.data());
413
414 // The pwmDutycycle values are stored as double in the interface but need to be converted to float in the jointData struct.
415 // We manually copy them, and while this conversion may lead to a minor loss of precision, it is negligible for pwmDutycycle values,
416 // which typically do not require double precision. std::copy ensures a safe and efficient conversion.
417 std::copy(tmpVariableForFloatSignals.begin(), tmpVariableForFloatSignals.end(), data.pwmDutycycle.begin());
418 } else {
419 data.pwmDutycycle_isValid = false;
420 }
421
422 if (m_allInterfaces.iCurrentControl) {
423 data.current_isValid = m_allInterfaces.iCurrentControl->getCurrents(data.current.data());
424 } else if (m_allInterfaces.iAmplifierControl) {
425 data.current_isValid = m_allInterfaces.iAmplifierControl->getCurrents(data.current.data());
426 } else {
427 data.current_isValid = false;
428 }
429
430 if (m_allInterfaces.iControlMode) {
431 data.controlMode_isValid = m_allInterfaces.iControlMode->getControlModes(tmpVariableForControlModes);
432 for (size_t i =0; i< tmpVariableForControlModes.size(); i++)
433 {
434 data.controlMode[i] = static_cast<int>(tmpVariableForControlModes[i]);
435 }
436 } else {
437 data.controlMode_isValid = false;
438 }
439
440 if (m_allInterfaces.iInteractionMode) {
441 data.interactionMode_isValid = m_allInterfaces.iInteractionMode->getInteractionModes(tmpVariableForInteractionModes);
442 for (size_t i =0; i< tmpVariableForInteractionModes.size(); i++)
443 {
444 data.interactionMode[i] = static_cast<int>(tmpVariableForInteractionModes[i]);
445 }
446 } else {
447 data.interactionMode_isValid = false;
448 }
449
450 // Check if the encoders timestamps are consistent.
451 for (double tt : times)
452 {
453 if (std::abs(times[0] - tt) > 1.0)
454 {
455 yCIErrorThrottle(CONTROLBOARD, id(), 1.0) << "Encoder timestamps are not consistent! Data will not be published.";
456 return;
457 }
458 }
459
460 // Update the port envelope time by averaging all timestamps
461 time.update(std::accumulate(times.begin(), times.end(), 0.0) / subdevice_joints);
463
464 extendedOutputStatePort.enableBackgroundWrite(true);
465 extendedOutputStatePort.setEnvelope(averageTime);
466 extendedOutputState_buffer.write();
467
468 // handle state:o
469 yarp::sig::Vector& v = outputPositionStatePort.prepare();
470 v.resize(subdevice_joints);
471 std::copy(data.jointPosition.begin(), data.jointPosition.end(), v.begin());
472
473 outputPositionStatePort.setEnvelope(averageTime);
474 outputPositionStatePort.write();
475}
476
478{
479 if (!connection.isValid()) {
480 return false;
481 }
482 if (!m_RPC) {
483 return false;
484 }
485
486 std::lock_guard<std::mutex> lock(m_mutex);
487 bool b = m_RPC->read(connection);
488 if (b) {
489 return true;
490 }
491 yCDebug(CONTROLBOARD) << "read() Command failed";
492 return false;
493}
const yarp::os::LogComponent & CONTROLBOARD()
const double DEFAULT_PERIOD
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
void run() override
Loop function.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
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).
void init(yarp::dev::DeviceDriver *x)
Initialization.
Interface implemented by all device drivers.
virtual yarp::dev::ReturnValue getCurrents(double *vals)=0
virtual yarp::dev::ReturnValue getAxes(size_t &ax)=0
Get the number of controlled axes.
virtual yarp::dev::ReturnValue getControlModes(std::vector< yarp::dev::ControlModeEnum > &mode)=0
Get the current control mode (multiple joints).
virtual yarp::dev::ReturnValue getCurrents(double *currs)=0
Get the instantaneous current measurement for all motors.
virtual yarp::dev::ReturnValue getEncodersTimed(double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
virtual yarp::dev::ReturnValue getEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all axes.
virtual yarp::dev::ReturnValue getEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all axes.
virtual yarp::dev::ReturnValue getAxes(size_t &ax)=0
Get the number of controlled axes.
virtual yarp::dev::ReturnValue getInteractionModes(const std::vector< int > &joints, std::vector< yarp::dev::InteractionModeEnum > &modes)=0
Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
virtual yarp::dev::ReturnValue getMotorEncoders(double *encs)=0
Read the position of all motor encoders.
virtual yarp::dev::ReturnValue getMotorEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all motor encoders.
virtual yarp::dev::ReturnValue getMotorEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all motor encoders.
virtual yarp::dev::ReturnValue getTemperatures(double *vals)=0
Get temperature of all the motors.
virtual yarp::dev::ReturnValue getDutyCycles(double *vals)=0
Gets the current dutycycle of the output of the amplifier (i.e.
virtual yarp::dev::ReturnValue getAxes(size_t &ax)=0
Get the number of controlled axes.
virtual yarp::dev::ReturnValue getTorques(double *t)=0
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
virtual yarp::dev::ReturnValue getAxes(size_t &axes)=0
Get the number of controlled axes.
yarp::sig::VectorOf< float > pwmDutycycle
yarp::sig::VectorOf< int > controlMode
yarp::sig::VectorOf< int > interactionMode
yarp::sig::VectorOf< double > motorAcceleration
yarp::sig::VectorOf< double > jointPosition
yarp::sig::VectorOf< double > torque
yarp::sig::VectorOf< double > motorVelocity
yarp::sig::VectorOf< double > jointVelocity
yarp::sig::VectorOf< double > current
yarp::sig::VectorOf< float > temperature
yarp::sig::VectorOf< double > jointAcceleration
yarp::sig::VectorOf< double > motorPosition
A container for a device driver.
Definition PolyDriver.h:23
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void setReader(PortReader &reader) override
Set an external reader for port data.
void close() override
Stop port activity.
void interrupt() override
Interrupt any current reads or writes attached to the port.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
int getPendingReads() override
Get the number of objects ready to be read.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
void setStrict(bool strict=true) override
Call this to strictly keep all messages, or allow old ones to be quietly dropped.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An interface for reading from a network connection.
virtual bool isValid() const =0
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
T & get()
A synonym of PortWriterBuffer::prepare.
void write(bool forceStrict=false)
Try to write the last buffer returned by PortWriterBuffer::get.
void attach(Port &port)
Set the Port to which objects will be written.
void enableBackgroundWrite(bool backgroundFlag)
control whether writing from this port is done in the background.
Definition Port.cpp:492
void interrupt() override
Interrupt any current reads or writes attached to the port.
Definition Port.cpp:347
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
Definition Port.cpp:506
void close() override
Stop port activity.
Definition Port.cpp:330
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition Port.cpp:79
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
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
Definition Stamp.cpp:124
void resize(size_t size) override
Resize the vector.
Definition Vector.h:231
iterator begin() noexcept
Returns an iterator to the beginning of the VectorOf.
Definition Vector.h:487
T * data()
Return a pointer to the first element of the vector.
Definition Vector.h:216
iterator end() noexcept
Returns an iterator to the end of the VectorOf.
Definition Vector.h:494
#define yCError(component,...)
#define yCWarning(component,...)
#define yCIErrorThrottle(component, id, period,...)
#define yCDebug(component,...)
#define yCIWarning(component, id,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
Definition OSTestMsg.cpp:13
The main, catch-all namespace for YARP.
Definition dirs.h:16
yarp::dev::IJointBrake * iJointBrake
yarp::dev::IRemoteCalibrator * iRemoteCalibrator
yarp::dev::IControlMode * iControlMode
yarp::dev::IJointFault * iJointFault
yarp::dev::IPidControl * iPidControl
yarp::dev::IAmplifierControl * iAmplifierControl
yarp::dev::ITorqueControl * iTorqueControl
yarp::dev::IPWMControl * iPWMControl
yarp::dev::IImpedanceControl * iImpedanceControl
yarp::dev::IVelocityDirect * iVelocityDirect
yarp::dev::IVelocityControl * iVelocityControl
yarp::dev::IInteractionMode * iInteractionMode
yarp::dev::IEncodersTimed * iEncodersTimed
yarp::dev::IRemoteVariables * iRemoteVariables
yarp::dev::IControlLimits * iControlLimits
yarp::dev::IAxisInfo * iAxisInfo
yarp::dev::IPositionDirect * iPositionDirect
yarp::dev::ICurrentControl * iCurrentControl
yarp::dev::IPreciselyTimed * iPreciselyTimed
yarp::dev::IMotorEncoders * iMotorEncoders
yarp::dev::IControlCalibration * iControlCalibration
yarp::dev::IMotor * iMotor
yarp::dev::IPositionControl * iPositionControl