This file contains auxiliary functions for haptix_sim. More...
#include <iostream>
#include <string>
#include <mutex>
#include <ignition/transport.hh>
#include "haptix/comm/haptix.h"
#include "msg/hxCollideMode.pb.h"
#include "msg/hxColor.pb.h"
#include "msg/hxContactPoint_V.pb.h"
#include "msg/hxEmpty.pb.h"
#include "msg/hxJoint.pb.h"
#include "msg/hxLink.pb.h"
#include "msg/hxModel.pb.h"
#include "msg/hxQuaternion.pb.h"
#include "msg/hxSimInfo.pb.h"
#include "msg/hxTime.pb.h"
#include "msg/hxTransform.pb.h"
#include "msg/hxVector3.pb.h"
Go to the source code of this file.
Functions | |
static ignition::transport::Node * | getHxNode () |
template<typename REQ , typename REP , typename T > | |
hxResult | hxs_call (const std::string &_service, const std::string &_funcName, const REQ _req, REP _rep, T _dst, bool(*_f)(const REP _rep, T _dst)) |
Function that requests a given service and converts the protobuf response to a C-struct. More... | |
template<typename REQ , typename REP > | |
hxResult | hxs_call (const std::string &_service, const std::string &_funcName, const REQ _req, REP _rep) |
Function that requests a given service. More... | |
static bool | hxs_convertCollisionMode (const haptix::comm::msgs::hxCollideMode _in, hxsCollideMode *_out) |
static bool | hxs_convertColor (const haptix::comm::msgs::hxColor _in, hxsColor *_out) |
static bool | hxs_convertContactPoints (const haptix::comm::msgs::hxContactPoint_V _in, hxsContactPoints *_out) |
static bool | hxs_convertJoint (const haptix::comm::msgs::hxJoint _in, hxsJoint *_out) |
static bool | hxs_convertLink (const haptix::comm::msgs::hxLink _in, hxsLink *_out) |
static bool | hxs_convertModel (const haptix::comm::msgs::hxModel _in, hxsModel *_out) |
static bool | hxs_convertQuaternion (const haptix::comm::msgs::hxQuaternion _in, hxsQuaternion *_out) |
static bool | hxs_convertQuaternion (const hxsQuaternion *_in, haptix::comm::msgs::hxQuaternion *_out) |
template<typename T , typename T2 > | |
bool | hxs_convertScalar (T _in, T2 *_out) |
static bool | hxs_convertSimInfo (const haptix::comm::msgs::hxSimInfo _in, hxsSimInfo *_out) |
static bool | hxs_convertTransform (const haptix::comm::msgs::hxTransform _in, hxsTransform *_out) |
static bool | hxs_convertTransform (const hxsTransform *_in, haptix::comm::msgs::hxTransform *_out) |
static bool | hxs_convertVector3 (const haptix::comm::msgs::hxVector3 _in, hxsVector3 *_out) |
static bool | hxs_convertVector3 (const hxsVector3 *_in, haptix::comm::msgs::hxVector3 *_out) |
static bool | hxs_convertWrench (const hxsWrench *_in, haptix::comm::msgs::hxWrench *_out) |
Variables | |
static ignition::transport::Node * | haptixSimUtilsNode = NULL |
ignition transport node. More... | |
unsigned int | kTimeout = 1000 |
Timeout used for the service requests (ms.). More... | |
static std::string | lastResult |
Error string, to be retrieved by hx_last_result() More... | |
static std::mutex | lastResultLock |
This file contains auxiliary functions for haptix_sim.
hxResult hxs_call | ( | const std::string & | _service, |
const std::string & | _funcName, | ||
const REQ | _req, | ||
REP | _rep, | ||
T | _dst, | ||
bool(*)(const REP _rep, T _dst) | _f | ||
) |
Function that requests a given service and converts the protobuf response to a C-struct.
The conversion from Protobuf to C-struct is done via a function that is also passed as a parameter.
[in] | _service | Service name to request. |
[in] | _funcName | Name of the caller function. |
[in] | _req | Protobuf message used in the service request. |
[out] | _rep | Protobuf message used in the service response. |
[out] | _dst | Target C-Struct that will be converted from _rep. |
[in] | _f | Function that will be able to convert the _rep Protobuf message into the C-struct _dst. |
References hxERROR, hxOK, kTimeout, and lastResult.
hxResult hxs_call | ( | const std::string & | _service, |
const std::string & | _funcName, | ||
const REQ | _req, | ||
REP | _rep | ||
) |
Function that requests a given service.
[in] | _service | Service name to request. |
[in] | _funcName | Name of the caller function. |
[in] | _req | Protobuf message used in the service request. |
[out] | _rep | Protobuf message used in the service response. |
References hxERROR, hxOK, kTimeout, and lastResult.
|
static |
ignition transport node.
unsigned int kTimeout = 1000 |
Timeout used for the service requests (ms.).
Referenced by hxs_call().
|
static |
Error string, to be retrieved by hx_last_result()
Referenced by hxs_call().