Simple remote interface to access the dynamic state estimates of an rc_visard device as data streams. More...
#include <remote_interface.h>

Classes | |
| class | DynamicsNotRunning |
| Thrown if rc_dynamics is requested to receive dynamics data but component is not running. More... | |
| class | InvalidState |
| Thrown if the current_state response of the dynamics service does not correspond to those in the State struct. More... | |
| class | NotAccepted |
| Thrown if a service call is not accepted. More... | |
| class | NotAvailable |
| Thrown if a REST API call is rejected because of 404; i.e. URL not found. More... | |
| struct | ReturnCode |
| struct | State |
| An enum mirroring the state-machine states enum in rc_dynamics/dynamicsRos.h. More... | |
| class | TooManyRequests |
| Thrown if a REST API call is rejected because of too many requests. More... | |
| class | TooManyStreamDestinations |
| Thrown if too many streams are running already on rc_visard. More... | |
Public Types | |
| using | Ptr = std::shared_ptr< RemoteInterface > |
Public Member Functions | |
| void | addDestinationToStream (const std::string &stream, const std::string &destination) |
| Adds a destination to a stream, i.e. More... | |
| bool | checkSystemReady () |
| Connects with rc_visard and checks the system state of the rc_visard device. More... | |
| DataReceiver::Ptr | createReceiverForStream (const std::string &stream, const std::string &dest_interface="", unsigned int dest_port=0) |
| Convenience method that automatically. More... | |
| void | deleteDestinationFromStream (const std::string &stream, const std::string &destination) |
| Deletes a destination from a stream, i.e. More... | |
| void | deleteDestinationsFromStream (const std::string &stream, const std::list< std::string > &destinations) |
| Deletes given destinations from a stream, i.e. More... | |
| std::list< std::string > | getAvailableStreams () |
| Returns a list all available streams on rc_visard. More... | |
| roboception::msgs::Frame | getCam2ImuTransform (unsigned int timeout_ms=0) |
| Returns the transformation from camera to IMU coordinate frame. More... | |
| std::list< std::string > | getDestinationsOfStream (const std::string &stream) |
| Returns a list of all destinations registered to the specified rc_dynamics stream. More... | |
| std::string | getDynamicsState () |
| Returns the current state of rc_dynamics module. More... | |
| std::string | 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. More... | |
| std::string | getSlamState () |
| Returns the current state of rc_slam module. More... | |
| roboception::msgs::Trajectory | getSlamTrajectory (const TrajectoryTime &start=TrajectoryTime::RelativeToStart(), const TrajectoryTime &end=TrajectoryTime::RelativeToEnd(), unsigned int timeout_ms=0) |
| Returns the Slam trajectory from the sensor. More... | |
| std::string | getStereoInsState () |
| Returns the current state of rc_stereo_ins module. More... | |
| ReturnCode | loadSlamMap (unsigned int timeout_ms=0) |
| Loads the SLAM map on the sensor. More... | |
| ReturnCode | removeSlamMap (unsigned int timeout_ms=0) |
| Removes the SLAM map on the sensor. More... | |
| std::string | resetSlam () |
| Resets the SLAM module The Stereo INS will keep running, if it is. More... | |
| std::string | restart () |
| Restarts the rc_dynamics module to Stereo INS only mode. More... | |
| std::string | restartSlam () |
| Restarts the rc_dynamics module to SLAM mode. More... | |
| ReturnCode | saveSlamMap (unsigned int timeout_ms=0) |
| Saves the SLAM map on the sensor. More... | |
| std::string | start () |
| Sets rc_dynamics module to running state. More... | |
| std::string | startSlam () |
| Sets rc_dynamics module to running state. More... | |
| std::string | stop () |
| Stops rc_dynamics module. More... | |
| std::string | stopSlam () |
| Stops only the SLAM module (via the rc_dynamics module). More... | |
| virtual | ~RemoteInterface () |
Static Public Member Functions | |
| static Ptr | create (const std::string &rc_visard_ip, unsigned int requests_timeout=5000) |
| Creates a local instance of rc_visard's remote pose interface. More... | |
Protected Member Functions | |
| std::string | callDynamicsService (std::string service_name) |
| Common functionality for start(), startSlam(), stop(), ... More... | |
| ReturnCode | callSlamService (std::string service_name, unsigned int timeout_ms=0) |
| call slam services which have a return code with value and message More... | |
| void | checkStreamTypeAvailable (const std::string &stream) |
| void | cleanUpRequestedStreams () |
| std::string | getState (const std::string &node) |
| RemoteInterface (const std::string &rc_visard_ip, unsigned int requests_timeout=5000) | |
Protected Attributes | |
| std::list< std::string > | avail_streams_ |
| std::string | base_url_ |
| bool | initialized_ |
| indicates if remote_interface was initialized properly at least once, see checkSystemReady() More... | |
| std::map< std::string, std::string > | protobuf_map_ |
| std::map< std::string, std::list< std::string > > | req_streams_ |
| int | timeout_curl_ |
| std::string | visard_addrs_ |
| float | visard_version_ |
| rc_visard's firmware version as double, i.e. major.minor, e.g. 1.6 More... | |
Static Protected Attributes | |
| static std::map< std::string, RemoteInterface::Ptr > | remote_interfaces_ = map<string, RemoteInterface::Ptr>() |
Simple remote interface to access the dynamic state estimates of an rc_visard device as data streams.
It offers methods to
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 79 of file remote_interface.h.
| using rc::dynamics::RemoteInterface::Ptr = std::shared_ptr<RemoteInterface> |
Definition at line 82 of file remote_interface.h.
|
virtual |
Definition at line 253 of file remote_interface.cc.
|
protected |
Definition at line 239 of file remote_interface.cc.
| 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.
| stream | stream type, e.g. "pose", "pose_rt" or "dynamics" |
| destination | string-represented destination of the data stream, e.g. "192.168.0.1:30000" |
Definition at line 572 of file remote_interface.cc.
|
protected |
Common functionality for start(), startSlam(), stop(), ...
Definition at line 360 of file remote_interface.cc.
|
protected |
call slam services which have a return code with value and message
Definition at line 495 of file remote_interface.cc.
|
protected |
Definition at line 830 of file remote_interface.cc.
| bool rc::dynamics::RemoteInterface::checkSystemReady | ( | ) |
Connects with rc_visard and checks the system state of the rc_visard device.
Definition at line 279 of file remote_interface.cc.
|
protected |
Definition at line 818 of file remote_interface.cc.
|
static |
Creates a local instance of rc_visard's remote pose interface.
| rc_visard_ip | rc_visard's inet address as string, e.g "192.168.0.12" |
| requests_timeout | timeout in [ms] for doing REST-API calls, which don't have an explicit timeout parameter |
Definition at line 223 of file remote_interface.cc.
| DataReceiver::Ptr rc::dynamics::RemoteInterface::createReceiverForStream | ( | const std::string & | stream, |
| const std::string & | dest_interface = "", |
||
| unsigned int | dest_port = 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 (re)start(_slam) 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.
| dest_interface | empty or one of this hosts network interfaces, e.g. "eth0" |
| dest_port | 0 or this hosts port number |
Definition at line 772 of file remote_interface.cc.
| 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.
| stream | stream type, e.g. "pose", "pose_rt" or "dynamics" |
| destination | string-represented destination of the data stream, e.g. "192.168.0.1:30000" |
Definition at line 592 of file remote_interface.cc.
| void rc::dynamics::RemoteInterface::deleteDestinationsFromStream | ( | const std::string & | stream, |
| const std::list< std::string > & | destinations | ||
| ) |
Deletes given destinations from a stream, i.e.
request rc_visard to stop streaming data of the specified type to the given destinations.
| stream | stream type, e.g. "pose", "pose_rt" or "dynamics" |
| destinations | list string-represented destination of the data stream, e.g. "192.168.0.1:30000" |
Definition at line 611 of file remote_interface.cc.
| list< string > rc::dynamics::RemoteInterface::getAvailableStreams | ( | ) |
Returns a list all available streams on rc_visard.
Definition at line 536 of file remote_interface.cc.
| roboception::msgs::Frame rc::dynamics::RemoteInterface::getCam2ImuTransform | ( | unsigned int | timeout_ms = 0 | ) |
Returns the transformation from camera to IMU coordinate frame.
This is equivalent to the cam2imu_transform in the Dynamics message.
| timeout_ms | timeout in ms for the call (default 0: no timeout) |
Definition at line 761 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.
| stream | a specific rc_dynamics data stream (e.g. "pose" or "dynamics") |
Definition at line 552 of file remote_interface.cc.
| string rc::dynamics::RemoteInterface::getDynamicsState | ( | ) |
Returns the current state of rc_dynamics module.
Definition at line 345 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.
| stream | a specific rc_dynamics data stream (e.g. "pose", "pose_rt" or "dynamics") |
Definition at line 546 of file remote_interface.cc.
| string rc::dynamics::RemoteInterface::getSlamState | ( | ) |
Returns the current state of rc_slam module.
Definition at line 350 of file remote_interface.cc.
| roboception::msgs::Trajectory rc::dynamics::RemoteInterface::getSlamTrajectory | ( | const TrajectoryTime & | start = TrajectoryTime::RelativeToStart(), |
| const TrajectoryTime & | end = TrajectoryTime::RelativeToEnd(), |
||
| unsigned int | timeout_ms = 0 |
||
| ) |
Returns the Slam trajectory from the sensor.
Using the start and end arguments only a subsection of the trajectory can be queried. If both are left empy, the full trajectory is returned.
| start | specifies the start of the returned trajectory subsection (if empty, the trajectory is returned from its very beginning) |
| end | specifies the end of the returned trajectory subsection (if empty, the trajectory is included up to its very end) |
Definition at line 737 of file remote_interface.cc.
|
protected |
Definition at line 331 of file remote_interface.cc.
| string rc::dynamics::RemoteInterface::getStereoInsState | ( | ) |
Returns the current state of rc_stereo_ins module.
Definition at line 355 of file remote_interface.cc.
| RemoteInterface::ReturnCode rc::dynamics::RemoteInterface::loadSlamMap | ( | unsigned int | timeout_ms = 0 | ) |
Loads the SLAM map on the sensor.
| timeout_ms | timeout in ms for the call (default 0: no timeout) |
Definition at line 527 of file remote_interface.cc.
| RemoteInterface::ReturnCode rc::dynamics::RemoteInterface::removeSlamMap | ( | unsigned int | timeout_ms = 0 | ) |
Removes the SLAM map on the sensor.
| timeout_ms | timeout in ms for the call (default 0: no timeout) |
Definition at line 531 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::resetSlam | ( | ) |
Resets the SLAM module The Stereo INS will keep running, if it is.
| InvalidState | if the entered state does not match the known states in State |
Definition at line 444 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::restart | ( | ) |
Restarts the rc_dynamics module to Stereo INS only mode.
Equivalent to stop() and start()
| InvalidState | if the entered state does not match the known states in State |
Definition at line 419 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::restartSlam | ( | ) |
Restarts the rc_dynamics module to SLAM mode.
Equivalent to stop() and startSlam()
| InvalidState | if the entered state does not match the known states in State |
Definition at line 423 of file remote_interface.cc.
| RemoteInterface::ReturnCode rc::dynamics::RemoteInterface::saveSlamMap | ( | unsigned int | timeout_ms = 0 | ) |
Saves the SLAM map on the sensor.
| timeout_ms | timeout in ms for the call (default 0: no timeout) |
Definition at line 523 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::start | ( | ) |
Sets rc_dynamics module to running state.
Only start the Stereo INS. To start SLAM use startSlam(). To restart use the restart() method.
| InvalidState | if the entered state does not match the known states in State |
Definition at line 427 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::startSlam | ( | ) |
Sets rc_dynamics module to running state.
Also starts up the Stereo INS, if not already running.
| InvalidState | if the entered state does not match the known states in State |
Definition at line 431 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::stop | ( | ) |
Stops rc_dynamics module.
If SLAM is running it will be stopped too.
| InvalidState | if the entered state does not match the known states in State |
Definition at line 435 of file remote_interface.cc.
| std::string rc::dynamics::RemoteInterface::stopSlam | ( | ) |
Stops only the SLAM module (via the rc_dynamics module).
The Stereo INS will keep running.
| InvalidState | if the entered state does not match the known states in State |
Definition at line 439 of file remote_interface.cc.
|
protected |
Definition at line 389 of file remote_interface.h.
|
protected |
Definition at line 391 of file remote_interface.h.
|
protected |
indicates if remote_interface was initialized properly at least once, see checkSystemReady()
Definition at line 386 of file remote_interface.h.
|
protected |
Definition at line 390 of file remote_interface.h.
|
staticprotected |
Definition at line 374 of file remote_interface.h.
|
protected |
Definition at line 388 of file remote_interface.h.
|
protected |
Definition at line 392 of file remote_interface.h.
|
protected |
Definition at line 385 of file remote_interface.h.
|
protected |
rc_visard's firmware version as double, i.e. major.minor, e.g. 1.6
Definition at line 387 of file remote_interface.h.