Drake
drake::pydrake Namespace Reference

Namespaces

 detail
 
 internal
 
 pysystems
 
 test
 

Classes

class  MirrorDef
 Defines a function in object a and mirrors def calls to object b. More...
 
struct  overload_cast_impl
 
struct  wrap_arg_default
 Default case for argument wrapping, with pure pass-through. More...
 

Typedefs

template<typename T , T Value>
using constant = std::integral_constant< T, Value >
 
template<typename T >
using wrap_change_t = detail::wrap_function_impl< wrap_change >::wrap_type_t< T >
 
using Callback = std::function< const double &(MyClassChange *, const int &)>
 
using CallbackWrapped = std::function< const_ptr< double >(ptr< MyClassChange >, const int *)>
 
template<template< typename... > class wrap_arg_policy, typename Signature >
using wrap_arg_function = typename detail::wrap_function_impl< wrap_arg_policy >::template wrap_arg< std::function< Signature > >
 Policy for explicitly wrapping functions for a given policy. More...
 
using T = double
 
template<typename T , T... Values>
using constant_pack = type_pack< type_pack< constant< T, Values > >... >
 

Functions

 PYBIND11_MODULE (bazel_workaround_4594_libdrake, m)
 
 PYBIND11_MODULE (autodiffutils, m)
 
 PYBIND11_MODULE (automotive, m)
 
template<typename... Ts>
py::tuple GetPyParam (type_pack< Ts... >={})
 Gets the canonical Python parameters for each C++ type. More...
 
template<typename T >
std::string TemporaryClassName (const std::string &name="TemporaryName")
 Provides a temporary, unique name for a class instantiation that will be passed to AddTemplateClass. More...
 
py::object AddTemplateClass (py::handle scope, const std::string &name, py::handle py_class, py::tuple param)
 Adds a template class instantiation. More...
 
template<typename Class , typename... Options>
py::class_< Class, Options... > DefineTemplateClassWithDefault (py::handle scope, const std::string &default_name, py::tuple param, const char *doc_string="", const std::string &template_suffix="_")
 Provides a convenience wrapper for defining a template class instantiation and a default instantiation (if not already defined). More...
 
template<typename Func >
py::object AddTemplateFunction (py::handle scope, const std::string &name, Func &&func, py::tuple param)
 Declares a template function. More...
 
template<typename Method >
py::object AddTemplateMethod (py::handle scope, const std::string &name, Method &&method, py::tuple param)
 Declares a template method. More...
 
void DeprecateAttribute (py::object cls, py::str name, py::str message)
 Deprecates an attribute name of a class cls. More...
 
void WarnDeprecated (py::str message)
 Raises a deprecation warning. More...
 
 PYBIND11_MODULE (eigen_geometry, m)
 
template<typename Derived >
auto ToEigenRef (Eigen::VectorBlock< Derived > *derived)
 Provides a mutable Ref<> for a pointer. More...
 
template<typename T >
py::object ToArray (T *ptr, int size, py::tuple shape)
 Converts a raw array to a numpy array. More...
 
template<typename T >
py::object ToArray (const T *ptr, int size, py::tuple shape)
 Converts a raw array to a numpy array (const variant). More...
 
void drake_set_assertion_failure_to_throw_exception ()
 
 PYBIND11_MODULE (_module_py, m)
 
bool PyEquals (py::object lhs, py::object rhs)
 
template<typename... Ts>
bool CheckPyParam (const string &py_expr_expected, type_pack< Ts... > param={})
 
 GTEST_TEST (CppParamTest, PrimitiveTypes)
 
 GTEST_TEST (CppParamTest, CustomTypes)
 
 GTEST_TEST (CppParamTest, LiteralTypes)
 
 GTEST_TEST (CppParamTest, Packs)
 
int main (int argc, char **argv)
 
 PYBIND11_MODULE (eigen_geometry_test_util, m)
 
template<typename Func >
auto WrapIdentity (Func &&func)
 
void Void ()
 
void IntToVoid (int)
 
int ReturnInt ()
 
int IntToInt (int value)
 
 GTEST_TEST (WrapFunction, FunctionPointer)
 
 GTEST_TEST (WrapFunction, Lambda)
 
 GTEST_TEST (WrapFunction, Methods)
 
void ArgMoveOnly (MoveOnlyValue arg)
 
const intArgMoveOnlyConst (const MoveOnlyValue &arg)
 
intArgMoveOnlyMutable (MoveOnlyValue &arg)
 
 GTEST_TEST (WrapFunction, ArgMoveOnly)
 
 GTEST_TEST (WrapFunction, MoveOnlyFunctor)
 
 GTEST_TEST (WrapFunction, ConstFunctor)
 
template<typename Func >
auto WrapChange (Func &&func)
 
template<typename Actual , typename Expected >
void check_type ()
 
 GTEST_TEST (WrapFunction, ChangeTypeCheck)
 
intChangeBasic (const int &a, const double &b, int *x, double *y)
 
 GTEST_TEST (WrapFunction, ChangeBasic)
 
 GTEST_TEST (WrapFunction, ChangeComprehensive)
 
Callback ChangeCallback (const Callback &)
 
 GTEST_TEST (WrapFunction, ChangeCallback)
 
void ChangeCallbackNested (const std::function< Callback(const Callback &)> &)
 
 GTEST_TEST (WrapFunction, ChangeCallbackNested)
 
template<typename Func >
auto WrapChangeCallbackOnly (Func &&func)
 
Callback ChangeCallbackOnly (double *, Callback, const Callback &)
 
 GTEST_TEST (WrapFunction, ChangeCallbackOnly)
 
 PYBIND11_MODULE (wrap_test_util, m)
 
template<typename Type >
auto BindTypeSafeIndex (py::module m, const std::string &name, const std::string &class_doc="")
 Binds a TypeSafeIndex instantiation. More...
 
template<template< typename... > class wrap_arg_policy, bool use_functions = true, typename Func = void>
auto WrapFunction (Func &&func)
 Wraps the types used in a function signature to produce a new function with wrapped arguments and return value (if non-void). More...
 
template<typename Func >
auto WrapCallbacks (Func &&func)
 Ensures that any std::function<> arguments are wrapped such that any T& (which can infer for T = const U) is wrapped as U* (and conversely unwrapped when returned). More...
 
template<typename PyClass , typename Class , typename T >
void DefReadWriteKeepAlive (PyClass *cls, const char *name, T Class::*member)
 Idempotent to pybind11's def_readwrite(), with the exception that the setter is protected with keep_alive on a member variable that is a bare pointer. More...
 
 PYBIND11_MODULE (acrobot, m)
 
 PYBIND11_MODULE (compass_gait, m)
 
 PYBIND11_MODULE (manipulation_station, m)
 
 PYBIND11_MODULE (pendulum, m)
 
 PYBIND11_MODULE (rimless_wheel, m)
 
 PYBIND11_MODULE (van_der_pol, m)
 
 PYBIND11_MODULE (lcm, m)
 
 PYBIND11_MODULE (api, m)
 
 PYBIND11_MODULE (dragway, m)
 
 PYBIND11_MODULE (planner, m)
 
 PYBIND11_MODULE (math, m)
 
void init_acrobot (py::module m)
 
void init_all (py::module m)
 
 PYBIND11_MODULE (benchmarks, m)
 
 PYBIND11_MODULE (collision, m)
 
 PYBIND11_MODULE (inverse_kinematics, m)
 
 PYBIND11_MODULE (joints, m)
 
 PYBIND11_MODULE (multibody_tree, m)
 
 PYBIND11_MODULE (parsing, m)
 
 PYBIND11_MODULE (rigid_body_plant, m)
 
 PYBIND11_MODULE (rigid_body, m)
 
 PYBIND11_MODULE (rigid_body_tree, m)
 
 PYBIND11_MODULE (shapes, m)
 
template<typename PyClass >
void DefCopyAndDeepCopy (PyClass *ppy_class)
 Binds Pythonic __copy__ and __deepcopy__ for a class's copy constructor. More...
 
void ExecuteExtraPythonCode (py::module m)
 Executes Python code to introduce additional symbols for a given module. More...
 
 PYBIND11_MODULE (gurobi, m)
 
 PYBIND11_MODULE (ik, m)
 
 PYBIND11_MODULE (ipopt, m)
 
 PYBIND11_MODULE (mathematicalprogram, m)
 
 PYBIND11_MODULE (mosek, m)
 
 PYBIND11_MODULE (osqp, m)
 
 PYBIND11_MODULE (symbolic, m)
 
 PYBIND11_MODULE (analysis, m)
 
 PYBIND11_MODULE (controllers, m)
 
 PYBIND11_MODULE (framework, m)
 
void DefineFrameworkPySemantics (py::module m)
 
void DefineFrameworkPySystems (py::module m)
 
void DefineFrameworkPyValues (py::module m)
 
 PYBIND11_MODULE (primitives, m)
 
 PYBIND11_MODULE (rendering, m)
 
 PYBIND11_MODULE (sensors, m)
 
 PYBIND11_MODULE (test_util, m)
 
 PYBIND11_MODULE (trajectory_optimization, m)
 
 PYBIND11_MODULE (autodiffutils_test_util, m)
 
 PYBIND11_MODULE (odr_test_module, m)
 
 PYBIND11_MODULE (trajectories, m)
 

Variables

const auto py_reference = py::return_value_policy::reference
 Used when returning T& orconst T&`, as pybind's default behavior is to copy lvalue references. More...
 
const auto py_reference_internal = py::return_value_policy::reference_internal
 Used when returning references to objects that are internally owned by self. More...
 
template<typename Return , typename... Args>
constexpr auto overload_cast_explicit = overload_cast_impl<Return, Args...>{}
 Provides option to provide explicit signature when py::overload_cast<Args...> fails to infer the Return argument. More...
 

Typedef Documentation

◆ Callback

using Callback = std::function<const double&(MyClassChange*, const int&)>

◆ CallbackWrapped

using CallbackWrapped = std::function<const_ptr<double>(ptr<MyClassChange>, const int*)>

◆ constant

using constant = std::integral_constant<T, Value>

◆ constant_pack

using constant_pack = type_pack<type_pack<constant<T, Values> >...>

◆ T

using T = double

◆ wrap_arg_function

using wrap_arg_function = typename detail::wrap_function_impl<wrap_arg_policy>:: template wrap_arg<std::function<Signature> >

Policy for explicitly wrapping functions for a given policy.

◆ wrap_change_t

using wrap_change_t = detail::wrap_function_impl<wrap_change>::wrap_type_t<T>

Function Documentation

◆ AddTemplateClass()

py::object drake::pydrake::AddTemplateClass ( py::handle  scope,
const std::string &  name,
py::handle  py_class,
py::tuple  param 
)
inline

Adds a template class instantiation.

Parameters
scopeParent scope of the template.
nameName of the template.
py_classClass instantiation to be added.
Note
The class name should be unique. If you would like automatic unique names, consider constructing the class binding as py::class_<Class, ...>(m, TemporaryClassName<Class>().c_str()).
Parameters
paramParameters for the instantiation.

◆ AddTemplateFunction()

py::object drake::pydrake::AddTemplateFunction ( py::handle  scope,
const std::string &  name,
Func &&  func,
py::tuple  param 
)

Declares a template function.

Parameters
scopeParent scope of the template.
nameName of the template.
funcFunction to be added.
paramParameters for the instantiation.

◆ AddTemplateMethod()

py::object drake::pydrake::AddTemplateMethod ( py::handle  scope,
const std::string &  name,
Method &&  method,
py::tuple  param 
)

Declares a template method.

Parameters
scopeParent scope of the template. This should be a class.
nameName of the template.
methodMethod to be added.
paramParameters for the instantiation.

◆ ArgMoveOnly()

void drake::pydrake::ArgMoveOnly ( MoveOnlyValue  arg)

◆ ArgMoveOnlyConst()

const int& drake::pydrake::ArgMoveOnlyConst ( const MoveOnlyValue &  arg)

◆ ArgMoveOnlyMutable()

int& drake::pydrake::ArgMoveOnlyMutable ( MoveOnlyValue &  arg)

◆ BindTypeSafeIndex()

auto drake::pydrake::BindTypeSafeIndex ( py::module  m,
const std::string &  name,
const std::string &  class_doc = "" 
)

Binds a TypeSafeIndex instantiation.

◆ ChangeBasic()

int* drake::pydrake::ChangeBasic ( const int a,
const double b,
int x,
double y 
)

◆ ChangeCallback()

Callback drake::pydrake::ChangeCallback ( const Callback )

◆ ChangeCallbackNested()

void drake::pydrake::ChangeCallbackNested ( const std::function< Callback(const Callback &)> &  )

◆ ChangeCallbackOnly()

Callback drake::pydrake::ChangeCallbackOnly ( double ,
Callback  ,
const Callback  
)

◆ check_type()

void drake::pydrake::check_type ( )

◆ CheckPyParam()

bool drake::pydrake::CheckPyParam ( const string &  py_expr_expected,
type_pack< Ts... >  param = {} 
)

◆ DefCopyAndDeepCopy()

void drake::pydrake::DefCopyAndDeepCopy ( PyClass *  ppy_class)

Binds Pythonic __copy__ and __deepcopy__ for a class's copy constructor.

Note
Do not use this if the class's copy constructor does not imply a deep copy.

◆ DefineFrameworkPySemantics()

void DefineFrameworkPySemantics ( py::module  m)

◆ DefineFrameworkPySystems()

void DefineFrameworkPySystems ( py::module  m)

◆ DefineFrameworkPyValues()

void DefineFrameworkPyValues ( py::module  m)

◆ DefineTemplateClassWithDefault()

py::class_<Class, Options...> drake::pydrake::DefineTemplateClassWithDefault ( py::handle  scope,
const std::string &  default_name,
py::tuple  param,
const char *  doc_string = "",
const std::string &  template_suffix = "_" 
)

Provides a convenience wrapper for defining a template class instantiation and a default instantiation (if not already defined).

The default instantiation is named default_name, while the template is named default_name + template_suffix.

Returns
pybind11 class

◆ DefReadWriteKeepAlive()

void drake::pydrake::DefReadWriteKeepAlive ( PyClass *  cls,
const char *  name,
T Class::*  member 
)

Idempotent to pybind11's def_readwrite(), with the exception that the setter is protected with keep_alive on a member variable that is a bare pointer.

Should not be used for unique_ptr members.

Template Parameters
PyClassthe python class.
Classthe C++ class.
Ttype for the member we wish to apply keep alive semantics.

◆ DeprecateAttribute()

void drake::pydrake::DeprecateAttribute ( py::object  cls,
py::str  name,
py::str  message 
)
inline

Deprecates an attribute name of a class cls.

This only works with class attributes (unbound members or methods) as it is implemented with a Python property descriptor.

◆ drake_set_assertion_failure_to_throw_exception()

void drake::pydrake::drake_set_assertion_failure_to_throw_exception ( )

◆ ExecuteExtraPythonCode()

void drake::pydrake::ExecuteExtraPythonCode ( py::module  m)
inline

Executes Python code to introduce additional symbols for a given module.

For a module with local name {name}, the code executed will be _{name}_extra.py. See #9599 for relevant background.

◆ GetPyParam()

py::tuple drake::pydrake::GetPyParam ( type_pack< Ts... >  = {})
inline

Gets the canonical Python parameters for each C++ type.

Returns
Python tuple of canonical parameters.
Exceptions
std::runtime_erroron the first type it encounters that is neither aliased nor registered in pybind11.

◆ GTEST_TEST() [1/16]

drake::pydrake::GTEST_TEST ( CppParamTest  ,
PrimitiveTypes   
)

◆ GTEST_TEST() [2/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
FunctionPointer   
)

◆ GTEST_TEST() [3/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
Lambda   
)

◆ GTEST_TEST() [4/16]

drake::pydrake::GTEST_TEST ( CppParamTest  ,
CustomTypes   
)

◆ GTEST_TEST() [5/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
Methods   
)

◆ GTEST_TEST() [6/16]

drake::pydrake::GTEST_TEST ( CppParamTest  ,
LiteralTypes   
)

◆ GTEST_TEST() [7/16]

drake::pydrake::GTEST_TEST ( CppParamTest  ,
Packs   
)

◆ GTEST_TEST() [8/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ArgMoveOnly   
)

◆ GTEST_TEST() [9/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
MoveOnlyFunctor   
)

◆ GTEST_TEST() [10/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ConstFunctor   
)

◆ GTEST_TEST() [11/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeTypeCheck   
)

◆ GTEST_TEST() [12/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeBasic   
)

◆ GTEST_TEST() [13/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeComprehensive   
)

◆ GTEST_TEST() [14/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeCallback   
)

◆ GTEST_TEST() [15/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeCallbackNested   
)

◆ GTEST_TEST() [16/16]

drake::pydrake::GTEST_TEST ( WrapFunction  ,
ChangeCallbackOnly   
)

◆ init_acrobot()

void drake::pydrake::init_acrobot ( py::module  m)

◆ init_all()

void drake::pydrake::init_all ( py::module  m)

◆ IntToInt()

int drake::pydrake::IntToInt ( int  value)

◆ IntToVoid()

void drake::pydrake::IntToVoid ( int  )

◆ main()

int drake::pydrake::main ( int  argc,
char **  argv 
)

◆ PYBIND11_MODULE() [1/46]

drake::pydrake::PYBIND11_MODULE ( bazel_workaround_4594_libdrake  ,
 
)

◆ PYBIND11_MODULE() [2/46]

drake::pydrake::PYBIND11_MODULE ( framework  ,
 
)

◆ PYBIND11_MODULE() [3/46]

drake::pydrake::PYBIND11_MODULE ( ipopt  ,
 
)

◆ PYBIND11_MODULE() [4/46]

drake::pydrake::PYBIND11_MODULE ( gurobi  ,
 
)

◆ PYBIND11_MODULE() [5/46]

drake::pydrake::PYBIND11_MODULE ( mosek  ,
 
)

◆ PYBIND11_MODULE() [6/46]

drake::pydrake::PYBIND11_MODULE ( osqp  ,
 
)

◆ PYBIND11_MODULE() [7/46]

drake::pydrake::PYBIND11_MODULE ( van_der_pol  ,
 
)

◆ PYBIND11_MODULE() [8/46]

drake::pydrake::PYBIND11_MODULE ( planner  ,
 
)

◆ PYBIND11_MODULE() [9/46]

drake::pydrake::PYBIND11_MODULE ( inverse_kinematics  ,
 
)

◆ PYBIND11_MODULE() [10/46]

drake::pydrake::PYBIND11_MODULE ( shapes  ,
 
)

◆ PYBIND11_MODULE() [11/46]

drake::pydrake::PYBIND11_MODULE ( autodiffutils_test_util  ,
 
)

◆ PYBIND11_MODULE() [12/46]

drake::pydrake::PYBIND11_MODULE ( odr_test_module  ,
 
)

◆ PYBIND11_MODULE() [13/46]

drake::pydrake::PYBIND11_MODULE ( trajectories  ,
 
)

◆ PYBIND11_MODULE() [14/46]

drake::pydrake::PYBIND11_MODULE ( collision  ,
 
)

◆ PYBIND11_MODULE() [15/46]

drake::pydrake::PYBIND11_MODULE ( compass_gait  ,
 
)

◆ PYBIND11_MODULE() [16/46]

drake::pydrake::PYBIND11_MODULE ( rimless_wheel  ,
 
)

◆ PYBIND11_MODULE() [17/46]

drake::pydrake::PYBIND11_MODULE ( rigid_body  ,
 
)

◆ PYBIND11_MODULE() [18/46]

drake::pydrake::PYBIND11_MODULE ( ik  ,
 
)

◆ PYBIND11_MODULE() [19/46]

drake::pydrake::PYBIND11_MODULE ( dragway  ,
 
)

◆ PYBIND11_MODULE() [20/46]

drake::pydrake::PYBIND11_MODULE ( trajectory_optimization  ,
 
)

◆ PYBIND11_MODULE() [21/46]

drake::pydrake::PYBIND11_MODULE ( joints  ,
 
)

◆ PYBIND11_MODULE() [22/46]

drake::pydrake::PYBIND11_MODULE ( parsing  ,
 
)

◆ PYBIND11_MODULE() [23/46]

drake::pydrake::PYBIND11_MODULE ( analysis  ,
 
)

◆ PYBIND11_MODULE() [24/46]

drake::pydrake::PYBIND11_MODULE ( autodiffutils  ,
 
)

◆ PYBIND11_MODULE() [25/46]

PYBIND11_MODULE ( lcm  ,
 
)

◆ PYBIND11_MODULE() [26/46]

drake::pydrake::PYBIND11_MODULE ( api  ,
 
)

◆ PYBIND11_MODULE() [27/46]

drake::pydrake::PYBIND11_MODULE ( manipulation_station  ,
 
)

◆ PYBIND11_MODULE() [28/46]

drake::pydrake::PYBIND11_MODULE ( rendering  ,
 
)

◆ PYBIND11_MODULE() [29/46]

drake::pydrake::PYBIND11_MODULE ( pendulum  ,
 
)

◆ PYBIND11_MODULE() [30/46]

drake::pydrake::PYBIND11_MODULE ( acrobot  ,
 
)

◆ PYBIND11_MODULE() [31/46]

drake::pydrake::PYBIND11_MODULE ( rigid_body_plant  ,
 
)

◆ PYBIND11_MODULE() [32/46]

drake::pydrake::PYBIND11_MODULE ( math  ,
 
)

◆ PYBIND11_MODULE() [33/46]

drake::pydrake::PYBIND11_MODULE ( eigen_geometry_test_util  ,
 
)

◆ PYBIND11_MODULE() [34/46]

drake::pydrake::PYBIND11_MODULE ( automotive  ,
 
)

◆ PYBIND11_MODULE() [35/46]

drake::pydrake::PYBIND11_MODULE ( controllers  ,
 
)

◆ PYBIND11_MODULE() [36/46]

drake::pydrake::PYBIND11_MODULE ( wrap_test_util  ,
 
)

◆ PYBIND11_MODULE() [37/46]

drake::pydrake::PYBIND11_MODULE ( symbolic  ,
 
)

◆ PYBIND11_MODULE() [38/46]

drake::pydrake::PYBIND11_MODULE ( rigid_body_tree  ,
 
)

◆ PYBIND11_MODULE() [39/46]

drake::pydrake::PYBIND11_MODULE ( _module_py  ,
 
)

◆ PYBIND11_MODULE() [40/46]

drake::pydrake::PYBIND11_MODULE ( primitives  ,
 
)

◆ PYBIND11_MODULE() [41/46]

drake::pydrake::PYBIND11_MODULE ( sensors  ,
 
)

◆ PYBIND11_MODULE() [42/46]

drake::pydrake::PYBIND11_MODULE ( benchmarks  ,
 
)

◆ PYBIND11_MODULE() [43/46]

drake::pydrake::PYBIND11_MODULE ( eigen_geometry  ,
 
)

◆ PYBIND11_MODULE() [44/46]

drake::pydrake::PYBIND11_MODULE ( test_util  ,
 
)

◆ PYBIND11_MODULE() [45/46]

drake::pydrake::PYBIND11_MODULE ( mathematicalprogram  ,
 
)

◆ PYBIND11_MODULE() [46/46]

drake::pydrake::PYBIND11_MODULE ( multibody_tree  ,
 
)

◆ PyEquals()

bool drake::pydrake::PyEquals ( py::object  lhs,
py::object  rhs 
)

◆ ReturnInt()

int drake::pydrake::ReturnInt ( )

◆ TemporaryClassName()

std::string drake::pydrake::TemporaryClassName ( const std::string &  name = "TemporaryName")

Provides a temporary, unique name for a class instantiation that will be passed to AddTemplateClass.

◆ ToArray() [1/2]

py::object drake::pydrake::ToArray ( T ptr,
int  size,
py::tuple  shape 
)

Converts a raw array to a numpy array.

◆ ToArray() [2/2]

py::object drake::pydrake::ToArray ( const T ptr,
int  size,
py::tuple  shape 
)

Converts a raw array to a numpy array (const variant).

◆ ToEigenRef()

auto drake::pydrake::ToEigenRef ( Eigen::VectorBlock< Derived > *  derived)

Provides a mutable Ref<> for a pointer.

Meant to be used for decorating methods passed to pybind11 (e.g. virtual function dispatch).

◆ Void()

void drake::pydrake::Void ( )

◆ WarnDeprecated()

void drake::pydrake::WarnDeprecated ( py::str  message)
inline

Raises a deprecation warning.

Note
If you are deprecating a class's member or method, please use DeprecateAttribute so that the warning is issued immediately when accessed, not only when it is called.

◆ WrapCallbacks()

auto drake::pydrake::WrapCallbacks ( Func &&  func)

Ensures that any std::function<> arguments are wrapped such that any T& (which can infer for T = const U) is wrapped as U* (and conversely unwrapped when returned).

Use this when you have a callback in C++ that has a lvalue reference (const or mutable) to a C++ argument or return value. Otherwise, pybind11 may try and copy the object, will be bad if either the type is a non-copyable or if you are trying to mutate the object; in this case, the copy is mutated, but not the original you care about. For more information, see: https://github.com/pybind/pybind11/issues/1241

◆ WrapChange()

auto drake::pydrake::WrapChange ( Func &&  func)

◆ WrapChangeCallbackOnly()

auto drake::pydrake::WrapChangeCallbackOnly ( Func &&  func)

◆ WrapFunction()

auto drake::pydrake::WrapFunction ( Func &&  func)

Wraps the types used in a function signature to produce a new function with wrapped arguments and return value (if non-void).

The wrapping is based on wrap_arg_policy. Any types that are of the form std::function<F> will be recursively wrapped, such that callbacks will be of a wrapped form (arguments and return types wrapped). The original form of the callbacks will still be called in the wrapped callback.

Template Parameters
wrap_arg_policyUser-supplied argument wrapper, that must supply the static functions wrap(Arg arg) -> Wrapped and unwrap(Wrapped wrapped) -> Arg. Arg arg is the original argument, and Wrapped wrapped is the wrapped / transformed argument type. N.B. This template template parameter uses a parameter pack to allow for SFINAE. If passing a using template alias, ensure that the alias template template parameter uses a parameter pack of the exact same form.
use_functionsIf true (default), will recursively wrap callbacks. If your policy provides handling for functions, then you should set this to false.
Parameters
funcFunctor to be wrapped. Returns a function with wrapped arguments and return type. If functor is a method pointer, it will return a function of the form Return ([const] Class* self, ...).
Returns
Wrapped function lambda. N.B. Construct a std::function<> from this if you encounter inference issues downstream of this method.

◆ WrapIdentity()

auto drake::pydrake::WrapIdentity ( Func &&  func)

Variable Documentation

◆ overload_cast_explicit

constexpr auto overload_cast_explicit = overload_cast_impl<Return, Args...>{}

Provides option to provide explicit signature when py::overload_cast<Args...> fails to infer the Return argument.

◆ py_reference

const auto py_reference = py::return_value_policy::reference

Used when returning T& orconst T&`, as pybind's default behavior is to copy lvalue references.

◆ py_reference_internal

const auto py_reference_internal = py::return_value_policy::reference_internal

Used when returning references to objects that are internally owned by self.

Implies both py_reference and py::keep_alive<0, 1>, which implies "Keep alive, reference: `return` keeps` self` alive".