Namespaces | |
test | |
Functions | |
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... 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... | |
void | MaybePauseForUser (std::string_view message={}) |
Pauses execution for the user to examine visualization output, for use within bazel unit tests. More... | |
PythonRemoteVariable drake::common::CallPython | ( | const std::string & | function_name, |
Types... | args | ||
) |
Calls a Python client with a given function and arguments, returning a handle to the result.
For example uses, see call_python_test.cc
.
void drake::common::CallPythonInit | ( | const std::string & | filename | ) |
Initializes CallPython
for a given file.
If this function is not called, then the filename defaults to /tmp/python_rpc
.
std::exception | If either this function or CallPython have already been called. |
std::string drake::common::GetRpcPipeTempDirectory | ( | ) |
Returns a directory location suitable for temporary files for the call_* clients and libraries.
std::exception | If the path referred to by TEST_TMPDIR or /tmp does not exist or is not a directory. |
void drake::common::MaybePauseForUser | ( | std::string_view | message = {} | ) |
Pauses execution for the user to examine visualization output, for use within bazel unit tests.
This function will not pause execution when running as a bazel test, but when running as a command-line executable, it will enable users to see the visualization outputs.
The caller can provide additional user instructions in message
. The message will only be written to the console if the pause is actually enabled.
The complete behavior is somewhat more subtle, depending on the bazel rules used to build the program, and the way it is invoked:
PythonRemoteVariable drake::common::ToPythonKwargs | ( | Types... | args | ) |
Creates a keyword-argument list to be unpacked.
args | Argument list in the form of (key1, value1, key2, value2, ...). |
PythonRemoteVariable drake::common::ToPythonTuple | ( | Types... | args | ) |
Creates a tuple in Python.