Drake
drake::common Namespace Reference

Namespaces

 internal
 
 test
 

Classes

class  MatlabRemoteVariable
 Holds a reference to a variable stored on the matlab client, which can be passed back into a future lcm_call_matlab call. More...
 
class  PythonRemoteVariable
 Presents variable stored in Python side. More...
 

Functions

void ToMatlabArray (const MatlabRemoteVariable &var, MatlabArray *matlab_array)
 
void ToMatlabArray (double var, MatlabArray *matlab_array)
 
void ToMatlabArray (int var, MatlabArray *matlab_array)
 
void ToMatlabArray (const std::string &str, MatlabArray *matlab_array)
 
template<typename Derived >
void ToMatlabArray (const Eigen::MatrixBase< Derived > &mat, MatlabArray *matlab_array)
 
template<typename... Types>
MatlabRemoteVariable CallMatlabSingleOutput (const std::string &function_name, Types... args)
 Special cases the call with one output. More...
 
template<typename... Types>
std::vector< MatlabRemoteVariableCallMatlab (int num_outputs, const std::string &function_name, Types... args)
 Invokes a mexCallMATLAB call on the remote client. More...
 
template<typename... Types>
void CallMatlab (const std::string &function_name, Types... args)
 Special cases the call with zero outputs, since it's so common. More...
 
template<typename T >
MatlabRemoteVariable NewRemoteVariable (T value)
 Creates a new remote variable with the corresponding value set. More...
 
void ToMatlabArray (const PythonRemoteVariable &var, MatlabArray *matlab_array)
 
void CallPythonInit (const std::string &filename)
 Initializes CallPython for a given file. More...
 
template<typename... Types>
PythonRemoteVariable CallPython (const std::string &function_name, Types... args)
 Calls a Python client with a given function and arguments, returning a handle to the result. More...
 
template<typename... Types>
PythonRemoteVariable ToPythonTuple (Types... args)
 Creates a tuple in Python. More...
 
template<typename T >
PythonRemoteVariable NewPythonVariable (T value)
 Creates a new remote variable with the corresponding value set. More...
 
template<typename... Types>
PythonRemoteVariable ToPythonKwargs (Types... args)
 Creates a keyword-argument list to be unpacked. More...
 
std::string GetRpcPipeTempDirectory ()
 Returns a directory location suitable for temporary files for the call_* clients and libraries. More...
 
 GTEST_TEST (TestCallMatlab, DispEigenMatrix)
 
 GTEST_TEST (TestCallMatlab, RemoteVarTest)
 
 GTEST_TEST (TestCallMatlab, SimplePlot)
 
 GTEST_TEST (TestCallMatlab, MeshTest)
 
 GTEST_TEST (TestCallPython, Start)
 
 GTEST_TEST (TestCallPython, DispStr)
 
 GTEST_TEST (TestCallPython, CheckKwargs)
 
 GTEST_TEST (TestCallPython, SetVar)
 
 GTEST_TEST (TestCallPython, DispEigenMatrix)
 
 GTEST_TEST (TestCallPython, RemoteVarTest)
 
 GTEST_TEST (TestCallPython, Plot2d)
 
 GTEST_TEST (TestCallPython, Plot3d)
 
 GTEST_TEST (TestCallPython, Finish)
 

Variables

static int globally_unique_id = 0
 
static int py_globally_unique_id = 0
 

Function Documentation

◆ CallMatlab() [1/2]

std::vector<MatlabRemoteVariable> drake::common::CallMatlab ( int  num_outputs,
const std::string &  function_name,
Types...  args 
)

Invokes a mexCallMATLAB call on the remote client.

Parameters
num_outputsNumber of return variables (left-side arguments) to request from matlab. As in matlab, you need not request all of the outputs for any given method.
function_nameName of the matlab function to call. Any argument that could have been passed to mexCallMATLAB is allowed. https://www.mathworks.com/help/matlab/apiref/mexcallmatlab.html
argument1Any data type which has a ToMatlabArray method implemented.
argument2Same as above. ...

See call_matlab_test.cc for some simple examples.

◆ CallMatlab() [2/2]

void drake::common::CallMatlab ( const std::string &  function_name,
Types...  args 
)

Special cases the call with zero outputs, since it's so common.

◆ CallMatlabSingleOutput()

MatlabRemoteVariable CallMatlabSingleOutput ( const std::string &  function_name,
Types...  args 
)

Special cases the call with one output.

◆ CallPython()

PythonRemoteVariable CallPython ( const std::string &  function_name,
Types...  args 
)

Calls a Python client with a given function and arguments, returning a handle to the result.

◆ CallPythonInit()

void CallPythonInit ( const std::string &  filename)

Initializes CallPython for a given file.

If this function is not called, then the file defaults to /tmp/python_rpc.

Exceptions
std::runtime_errorIf either this function or CallPython have already been called.

◆ GetRpcPipeTempDirectory()

std::string GetRpcPipeTempDirectory ( )

Returns a directory location suitable for temporary files for the call_* clients and libraries.

Returns
The value of the environment variable TEST_TMPDIR if defined or otherwise /tmp. Any trailing / will be stripped from the output.
Exceptions
std::runtime_errorIf the path referred to by TEST_TMPDIR or /tmp does not exist or is not a directory.

◆ GTEST_TEST() [1/13]

drake::common::GTEST_TEST ( TestCallMatlab  ,
DispEigenMatrix   
)

◆ GTEST_TEST() [2/13]

drake::common::GTEST_TEST ( TestCallMatlab  ,
RemoteVarTest   
)

◆ GTEST_TEST() [3/13]

drake::common::GTEST_TEST ( TestCallPython  ,
Start   
)

◆ GTEST_TEST() [4/13]

drake::common::GTEST_TEST ( TestCallPython  ,
DispStr   
)

◆ GTEST_TEST() [5/13]

drake::common::GTEST_TEST ( TestCallPython  ,
CheckKwargs   
)

◆ GTEST_TEST() [6/13]

drake::common::GTEST_TEST ( TestCallMatlab  ,
SimplePlot   
)

◆ GTEST_TEST() [7/13]

drake::common::GTEST_TEST ( TestCallPython  ,
SetVar   
)

◆ GTEST_TEST() [8/13]

drake::common::GTEST_TEST ( TestCallPython  ,
DispEigenMatrix   
)

◆ GTEST_TEST() [9/13]

drake::common::GTEST_TEST ( TestCallMatlab  ,
MeshTest   
)

◆ GTEST_TEST() [10/13]

drake::common::GTEST_TEST ( TestCallPython  ,
RemoteVarTest   
)

◆ GTEST_TEST() [11/13]

drake::common::GTEST_TEST ( TestCallPython  ,
Plot2d   
)

◆ GTEST_TEST() [12/13]

drake::common::GTEST_TEST ( TestCallPython  ,
Plot3d   
)

◆ GTEST_TEST() [13/13]

drake::common::GTEST_TEST ( TestCallPython  ,
Finish   
)

◆ NewPythonVariable()

PythonRemoteVariable NewPythonVariable ( T  value)

Creates a new remote variable with the corresponding value set.

◆ NewRemoteVariable()

MatlabRemoteVariable drake::common::NewRemoteVariable ( T  value)

Creates a new remote variable with the corresponding value set.

◆ ToMatlabArray() [1/6]

void ToMatlabArray ( const PythonRemoteVariable var,
MatlabArray *  matlab_array 
)

◆ ToMatlabArray() [2/6]

void ToMatlabArray ( const MatlabRemoteVariable var,
MatlabArray *  matlab_array 
)

◆ ToMatlabArray() [3/6]

void ToMatlabArray ( double  var,
MatlabArray *  matlab_array 
)

◆ ToMatlabArray() [4/6]

void ToMatlabArray ( int  var,
MatlabArray *  matlab_array 
)

◆ ToMatlabArray() [5/6]

void drake::common::ToMatlabArray ( const Eigen::MatrixBase< Derived > &  mat,
MatlabArray *  matlab_array 
)

◆ ToMatlabArray() [6/6]

void ToMatlabArray ( const std::string &  str,
MatlabArray *  matlab_array 
)

◆ ToPythonKwargs()

PythonRemoteVariable drake::common::ToPythonKwargs ( Types...  args)

Creates a keyword-argument list to be unpacked.

Parameters
argsArgument list in the form of (key1, value1, key2, value2, ...).

◆ ToPythonTuple()

PythonRemoteVariable ToPythonTuple ( Types...  args)

Creates a tuple in Python.

Variable Documentation

◆ globally_unique_id

int globally_unique_id = 0
static

◆ py_globally_unique_id

int py_globally_unique_id = 0
static