YARP
Yet Another Robot Platform

virtualAnalogServer: An analog wrapper for virtual device A virtual device is a software emulated device, for example force-torque computed from a real sensor and then relocated to another part of the robot or some kind of estimated measurement needed by the robot. More...

#include <VirtualAnalogWrapper/VirtualAnalogWrapper.h>

+ Inheritance diagram for VirtualAnalogWrapper:

Public Member Functions

 VirtualAnalogWrapper ()=default
 
 VirtualAnalogWrapper (const VirtualAnalogWrapper &)=delete
 
 VirtualAnalogWrapper (VirtualAnalogWrapper &&)=delete
 
VirtualAnalogWrapperoperator= (const VirtualAnalogWrapper &)=delete
 
VirtualAnalogWrapperoperator= (VirtualAnalogWrapper &&)=delete
 
 ~VirtualAnalogWrapper () override
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
void run () override
 Main body of the new thread. More...
 
bool attachAll (const yarp::dev::PolyDriverList &p) override
 Attach to a list of objects. More...
 
bool detachAll () override
 Detach the object (you must have first called attach). More...
 
bool perform_first_check (int elems)
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 ~DeviceDriver () override=default
 Destructor. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 
- Public Member Functions inherited from yarp::os::Thread
 Thread ()
 Constructor. More...
 
virtual ~Thread ()
 Destructor. More...
 
virtual void onStop ()
 Call-back, called while halting the thread (before join). More...
 
bool start ()
 Start the new thread running. More...
 
bool stop ()
 Stop the thread. More...
 
virtual void beforeStart ()
 Called just before a new thread starts. More...
 
virtual void afterStart (bool success)
 Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). More...
 
virtual bool threadInit ()
 Initialization method. More...
 
virtual void threadRelease ()
 Release method. More...
 
bool isStopping ()
 Returns true if the thread is stopping (Thread::stop has been called). More...
 
bool isRunning ()
 Returns true if the thread is running (Thread::start has been called successfully and the thread has not stopped). More...
 
long int getKey ()
 Get a unique identifier for the thread. More...
 
int setPriority (int priority, int policy=-1)
 Set the priority and scheduling policy of the thread, if the OS supports that. More...
 
int getPriority ()
 Query the current priority of the thread, if the OS supports that. More...
 
int getPolicy ()
 Query the current scheduling policy of the thread, if the OS supports that. More...
 
bool join (double seconds=-1)
 The function returns when the thread execution has completed. More...
 
void setOptions (int stackSize=0)
 Set the stack size for the new thread. More...
 
- Public Member Functions inherited from yarp::dev::IMultipleWrapper
virtual ~IMultipleWrapper ()
 Destructor. More...
 

Protected Attributes

std::mutex mMutex
 
bool mIsVerbose {false}
 
int mNSubdevs {0}
 
std::vector< int > mChan2Board
 
std::vector< int > mChan2BAddr
 
double lastRecv {0.0}
 
bool first_check {false}
 
std::vector< AnalogSubDevicemSubdevices
 
yarp::os::BufferedPort< yarp::os::BottlemPortInputTorques
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Thread
static int getCount ()
 Check how many threads are running. More...
 
static long int getKeyOfCaller ()
 Get a unique identifier for the calling thread. More...
 
static void yield ()
 Reschedule the execution of current thread, allowing other threads to run. More...
 
static void setDefaultStackSize (int stackSize)
 Set the default stack size for all threads created after this point. More...
 

Detailed Description

virtualAnalogServer: An analog wrapper for virtual device A virtual device is a software emulated device, for example force-torque computed from a real sensor and then relocated to another part of the robot or some kind of estimated measurement needed by the robot.

This virtual wrapper will open a port and accept the incoming estimated measurement and send them to the real robot using the attached device.

Definition at line 62 of file VirtualAnalogWrapper.h.

Constructor & Destructor Documentation

◆ VirtualAnalogWrapper() [1/3]

VirtualAnalogWrapper::VirtualAnalogWrapper ( )
default

◆ VirtualAnalogWrapper() [2/3]

VirtualAnalogWrapper::VirtualAnalogWrapper ( const VirtualAnalogWrapper )
delete

◆ VirtualAnalogWrapper() [3/3]

VirtualAnalogWrapper::VirtualAnalogWrapper ( VirtualAnalogWrapper &&  )
delete

◆ ~VirtualAnalogWrapper()

VirtualAnalogWrapper::~VirtualAnalogWrapper ( )
inlineoverride

Definition at line 74 of file VirtualAnalogWrapper.h.

Member Function Documentation

◆ attachAll()

bool VirtualAnalogWrapper::attachAll ( const yarp::dev::PolyDriverList p)
overridevirtual

Attach to a list of objects.

Parameters
pthe polydriver list that you want to attach to.
Returns
true/false on success failure.

Implements yarp::dev::IMultipleWrapper.

Definition at line 215 of file VirtualAnalogWrapper.cpp.

◆ close()

bool VirtualAnalogWrapper::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 207 of file VirtualAnalogWrapper.cpp.

◆ detachAll()

bool VirtualAnalogWrapper::detachAll ( )
overridevirtual

Detach the object (you must have first called attach).

Returns
true/false on success failure.

Implements yarp::dev::IMultipleWrapper.

Definition at line 254 of file VirtualAnalogWrapper.cpp.

◆ open()

bool VirtualAnalogWrapper::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 110 of file VirtualAnalogWrapper.cpp.

◆ operator=() [1/2]

VirtualAnalogWrapper& VirtualAnalogWrapper::operator= ( const VirtualAnalogWrapper )
delete

◆ operator=() [2/2]

VirtualAnalogWrapper& VirtualAnalogWrapper::operator= ( VirtualAnalogWrapper &&  )
delete

◆ perform_first_check()

bool VirtualAnalogWrapper::perform_first_check ( int  elems)

Definition at line 270 of file VirtualAnalogWrapper.cpp.

◆ run()

void VirtualAnalogWrapper::run ( )
overridevirtual

Main body of the new thread.

Override this method to do what you want. After Thread::start is called, this method will start running in a separate thread. It is important that this method either keeps checking Thread::isStopping to see if it should stop, or you override the Thread::onStop method to interact with it in some way to shut the new thread down. There is no really reliable, portable way to stop a thread cleanly unless that thread cooperates.

Implements yarp::os::Thread.

Definition at line 289 of file VirtualAnalogWrapper.cpp.

Member Data Documentation

◆ first_check

bool VirtualAnalogWrapper::first_check {false}
protected

Definition at line 106 of file VirtualAnalogWrapper.h.

◆ lastRecv

double VirtualAnalogWrapper::lastRecv {0.0}
protected

Definition at line 105 of file VirtualAnalogWrapper.h.

◆ mChan2BAddr

std::vector<int> VirtualAnalogWrapper::mChan2BAddr
protected

Definition at line 104 of file VirtualAnalogWrapper.h.

◆ mChan2Board

std::vector<int> VirtualAnalogWrapper::mChan2Board
protected

Definition at line 103 of file VirtualAnalogWrapper.h.

◆ mIsVerbose

bool VirtualAnalogWrapper::mIsVerbose {false}
protected

Definition at line 99 of file VirtualAnalogWrapper.h.

◆ mMutex

std::mutex VirtualAnalogWrapper::mMutex
protected

Definition at line 97 of file VirtualAnalogWrapper.h.

◆ mNSubdevs

int VirtualAnalogWrapper::mNSubdevs {0}
protected

Definition at line 101 of file VirtualAnalogWrapper.h.

◆ mPortInputTorques

yarp::os::BufferedPort<yarp::os::Bottle> VirtualAnalogWrapper::mPortInputTorques
protected

Definition at line 109 of file VirtualAnalogWrapper.h.

◆ mSubdevices

std::vector<AnalogSubDevice> VirtualAnalogWrapper::mSubdevices
protected

Definition at line 108 of file VirtualAnalogWrapper.h.


The documentation for this class was generated from the following files: