Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
rc::dynamics::RemoteInterface Class Reference

#include <remote_interface.h>

List of all members.

Public Types

enum  State { RUNNING, STOPPED }

Public Member Functions

void addDestinationToStream (const std::string &stream, const std::string &destination)
DataReceiver::Ptr createReceiverForStream (const std::string &stream, const std::string &destInterface="", unsigned int destPort=0)
void deleteAllDestinationsFromStream (const std::string &stream)
void deleteDestinationFromStream (const std::string &stream, const std::string &destination)
std::list< std::string > getAvailableStreams ()
std::list< std::string > getDestinationsOfStream (const std::string &stream)
std::string getPbMsgTypeOfStream (const std::string &stream)
State getState ()
void start (bool flagRestart=false)
void stop ()
virtual ~RemoteInterface ()

Static Public Member Functions

static Ptr create (const std::string &rcVisardIP, unsigned int requestsTimeout=5000)

Protected Member Functions

void checkStreamTypeAvailable (const std::string &stream)
void cleanUpRequestedStreams ()
 RemoteInterface (const std::string &rcVisardIP, unsigned int requestsTimeout=5000)

Protected Attributes

std::list< std::string > _availStreams
std::string _baseUrl
std::map< std::string,
std::string > 
_protobufMap
std::map< std::string,
std::list< std::string > > 
_reqStreams
int _timeoutCurl
std::string _visardAddrs

Static Protected Attributes

static std::map< std::string,
RemoteInterface::Ptr > 
_remoteInterfaces = map<string,RemoteInterface::Ptr>()

Detailed Description

Simple remote interface to access the dynamic state estimates of an rc_visard device as data streams.

It offers methods to * interface the rc_dynamics module on the rc_visard device, i.e. starting, stopping, and checking its state * manage data streams, i.e. adding, deleting, and checking destinations of the streams * an easy-to-use convenience function to directly start listening to a specific data stream (see createReceiverForStream())

NOTE: For convenience, a RemoteInterface object automatically keeps track of all data stream destinations requested by itself on the rc_visard device, and deletes them again when it is going to be destructed. Therefore, it is highly important that a RemoteInterface is destructed properly. In order to do so it, is recommended to wrap method calls of RemoteInterface objects with try-catch-blocks as they might throw exceptions and therefore avoid proper destruction of the object.

Definition at line 80 of file remote_interface.h.


Member Enumeration Documentation

Enumerator:
RUNNING 
STOPPED 

Definition at line 86 of file remote_interface.h.


Constructor & Destructor Documentation

Definition at line 189 of file remote_interface.cc.

rc::dynamics::RemoteInterface::RemoteInterface ( const std::string &  rcVisardIP,
unsigned int  requestsTimeout = 5000 
) [protected]

Definition at line 158 of file remote_interface.cc.


Member Function Documentation

void rc::dynamics::RemoteInterface::addDestinationToStream ( const std::string &  stream,
const std::string &  destination 
)

Adds a destination to a stream, i.e. request rc_visard to stream data of the specified type to the given destination.

Parameters:
streamstream type, e.g. "pose", "pose_rt" or "dynamics"
destinationstring-represented destination of the data stream, e.g. "192.168.0.1:30000"

Definition at line 280 of file remote_interface.cc.

void rc::dynamics::RemoteInterface::checkStreamTypeAvailable ( const std::string &  stream) [protected]

Definition at line 402 of file remote_interface.cc.

Definition at line 364 of file remote_interface.cc.

RemoteInterface::Ptr rc::dynamics::RemoteInterface::create ( const std::string &  rcVisardIP,
unsigned int  requestsTimeout = 5000 
) [static]

Creates a local instance of rc_visard's remote pose interface

Parameters:
rcVisardIPrc_visard's inet address as string, e.g "192.168.0.12"
requestsTimeouttimeout in [ms] for doing REST-API calls

Definition at line 139 of file remote_interface.cc.

DataReceiver::Ptr rc::dynamics::RemoteInterface::createReceiverForStream ( const std::string &  stream,
const std::string &  destInterface = "",
unsigned int  destPort = 0 
)

Convenience method that automatically

1) creates a data receiver (including binding socket to a local network interface) 2) adds a destination to the respective stream on rc_visard device 3) waits/checks for the stream being established 4) (removes the destination automatically from rc_visard device if data receiver is no longer used)

Stream can only be established successfully if rc_dynamics module is running on rc_visard, see getState() and start(...) methods.

If desired interface for receiving is unspecified (or "") this host's network interfaces are scanned to find a suitable IP address among those. Similar, if port number is unspecified (or 0) it will be assigned arbitrarily as available by network interface layer.

Parameters:
destInterfaceempty or one of this hosts network interfaces, e.g. "eth0"
destPort0 or this hosts port number
Returns:
true, if stream could be initialized successfully

Definition at line 316 of file remote_interface.cc.

Deletes all destinations from a stream.

Parameters:
streamstream type, e.g. "pose", "pose_rt" or "dynamics"
void rc::dynamics::RemoteInterface::deleteDestinationFromStream ( const std::string &  stream,
const std::string &  destination 
)

Deletes a destination from a stream, i.e. request rc_visard to stop streaming data of the specified type to the given destination.

Parameters:
streamstream type, e.g. "pose", "pose_rt" or "dynamics"
destinationstring-represented destination of the data stream, e.g. "192.168.0.1:30000"

Definition at line 296 of file remote_interface.cc.

Returns a list all available streams on rc_visard

Returns:

Definition at line 246 of file remote_interface.cc.

list< string > rc::dynamics::RemoteInterface::getDestinationsOfStream ( const std::string &  stream)

Returns a list of all destinations registered to the specified rc_dynamics stream. Streams here are represented as their destinations using IP address and port number.

Parameters:
streama specific rc_dynamics data stream (e.g. "pose" or "dynamics")
Returns:
list of destinations of represented as strings, e.g. "192.168.0.1:30000"

Definition at line 259 of file remote_interface.cc.

string rc::dynamics::RemoteInterface::getPbMsgTypeOfStream ( const std::string &  stream)

Returns the name of the protobuf message class that corresponds to a given data stream and is required for de-serializing the respective messages.

Parameters:
streama specific rc_dynamics data stream (e.g. "pose", "pose_rt" or "dynamics")
Returns:
the corresponding protobuf message type as string (e.g. "Frame" or "Dynamics")

Definition at line 252 of file remote_interface.cc.

Checks state of rc_dynamics module (running, stopped, ...)

Returns:
the current rc_dynamics state

Definition at line 231 of file remote_interface.cc.

void rc::dynamics::RemoteInterface::start ( bool  flagRestart = false)

Sets rc_dynamics module to running state.

Parameters:
flagRestartdo a restart, if enable==true and rc_dynamics module was already running

Definition at line 211 of file remote_interface.cc.

Stops rc_dynamics module

Definition at line 222 of file remote_interface.cc.


Member Data Documentation

std::list<std::string> rc::dynamics::RemoteInterface::_availStreams [protected]

Definition at line 218 of file remote_interface.h.

std::string rc::dynamics::RemoteInterface::_baseUrl [protected]

Definition at line 220 of file remote_interface.h.

std::map<std::string, std::string> rc::dynamics::RemoteInterface::_protobufMap [protected]

Definition at line 219 of file remote_interface.h.

map< string, RemoteInterface::Ptr > rc::dynamics::RemoteInterface::_remoteInterfaces = map<string,RemoteInterface::Ptr>() [static, protected]

Definition at line 208 of file remote_interface.h.

std::map<std::string, std::list<std::string> > rc::dynamics::RemoteInterface::_reqStreams [protected]

Definition at line 217 of file remote_interface.h.

Definition at line 221 of file remote_interface.h.

Definition at line 216 of file remote_interface.h.


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


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:12