pyexotica.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2022, University of Edinburgh, University of Oxford
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
34 #ifdef MSGPACK_FOUND
36 #endif
38 #undef NDEBUG
39 #include <pybind11/eigen.h>
40 #include <pybind11/pybind11.h>
41 #include <pybind11/stl.h>
42 
44 
45 #include <octomap/OcTree.h>
46 #include <ros/package.h>
47 
48 #include <unsupported/Eigen/CXX11/Tensor>
49 
50 #if PY_MAJOR_VERSION < 3
51 #define PY_OLDSTANDARD
52 #endif
53 
54 #ifndef PY_OLDSTANDARD
55 bool PyInt_Check(PyObject* value_py) { return PyLong_Check(value_py); }
56 long PyInt_AsLong(PyObject* value_py) { return PyLong_AsLong(value_py); }
57 #endif
58 
59 bool IsPyString(PyObject* value_py)
60 {
61 #ifndef PY_OLDSTANDARD
62  return PyUnicode_Check(value_py);
63 #else
64  return PyString_Check(value_py) || PyUnicode_Check(value_py);
65 #endif
66 }
67 
68 std::string PyAsStdString(PyObject* value_py)
69 {
70 #ifndef PY_OLDSTANDARD
71  PyObject* tmp = PyUnicode_AsASCIIString(value_py);
72  std::string ret = std::string(PyBytes_AsString(tmp));
73  Py_DECREF(tmp);
74  return ret;
75 #else
76  return std::string(PyString_AsString(value_py));
77 #endif
78 }
79 
80 PyObject* StdStringAsPy(std::string value)
81 {
82 #ifndef PY_OLDSTANDARD
83  return PyUnicode_DecodeASCII(value.c_str(), value.size(), "");
84 #else
85  return PyString_FromString(value.c_str());
86 #endif
87 }
88 
89 using namespace exotica;
90 namespace py = pybind11;
91 
92 std::map<std::string, Initializer> known_initializers;
93 
95 {
96 #if PY_MAJOR_VERSION <= 2
97  PyObject* module = PyImport_ImportModule("StringIO");
98  if (!module) ThrowPretty("Can't load StringIO module.");
99  PyObject* cls = PyObject_GetAttrString(module, "StringIO");
100  if (!cls) ThrowPretty("Can't load StringIO class.");
101 #else
102  PyObject* module = PyImport_ImportModule("io");
103  if (!module) ThrowPretty("Can't load io module.");
104  PyObject* cls = PyObject_GetAttrString(module, "BytesIO");
105  if (!cls) ThrowPretty("Can't load BytesIO class.");
106 #endif
107  PyObject* stringio = PyObject_CallObject(cls, NULL);
108  if (!stringio) ThrowPretty("Can't create StringIO object.");
109  Py_DECREF(module);
110  Py_DECREF(cls);
111  return stringio;
112 }
113 
114 #define ROS_MESSAGE_WRAPPER(MessageType) \
115  namespace pybind11 \
116  { \
117  namespace detail \
118  { \
119  template <> \
120  struct type_caster<MessageType> \
121  { \
122  public: \
123  PYBIND11_TYPE_CASTER(MessageType, _("genpy.Message")); \
124  \
125  bool load(handle src, bool) \
126  { \
127  PyObject* stringio = CreateStringIOObject(); \
128  if (!stringio) ThrowPretty("Can't create StringIO instance."); \
129  PyObject* result = \
130  PyObject_CallMethod(src.ptr(), "serialize", "O", stringio); \
131  if (!result) ThrowPretty("Can't serialize."); \
132  result = PyObject_CallMethod(stringio, "getvalue", nullptr); \
133  if (!result) ThrowPretty("Can't get buffer."); \
134  char* data = PyByteArray_AsString(PyByteArray_FromObject(result)); \
135  int len = PyByteArray_Size(result); \
136  unsigned char* udata = new unsigned char[len]; \
137  for (int i = 0; i < len; ++i) \
138  udata[i] = static_cast<unsigned char>(data[i]); \
139  ros::serialization::IStream stream(udata, len); \
140  ros::serialization::deserialize<MessageType>(stream, value); \
141  delete[] udata; \
142  delete[] data; \
143  Py_DECREF(stringio); \
144  Py_DECREF(result); \
145  return !PyErr_Occurred(); \
146  } \
147  \
148  static handle cast(MessageType src, \
149  return_value_policy /* policy /, handle / parent */) \
150  { \
151  ros::message_traits::DataType<MessageType::Type> type; \
152  ThrowPretty("Can't create python object from message of type '" \
153  << type.value() << "'!"); \
154  } \
155  }; \
156  } \
157  }
158 #include <moveit_msgs/PlanningScene.h>
159 #include <moveit_msgs/PlanningSceneWorld.h>
160 ROS_MESSAGE_WRAPPER(moveit_msgs::PlanningScene);
161 ROS_MESSAGE_WRAPPER(moveit_msgs::PlanningSceneWorld);
162 
164 {
165  return Initializer(init);
166 }
167 
168 std::pair<Initializer, Initializer> LoadFromXML(std::string file_name, const std::string& solver_name = "", const std::string& problem_name = "", bool parsePathAsXML = false)
169 {
170  Initializer solver, problem;
171  XMLLoader::Load(file_name, solver, problem, solver_name, problem_name, parsePathAsXML);
172  return std::pair<Initializer, Initializer>(solver, problem);
173 }
174 
175 void AddInitializers(py::module& module)
176 {
177  py::module inits = module.def_submodule("Initializers", "Initializers for core EXOTica classes.");
178  inits.def("Initializer", &CreateInitializer);
179  std::vector<Initializer> initializers = Setup::GetInitializers();
180  for (const Initializer& i : initializers)
181  {
182  const std::string full_name = i.GetName();
183  const std::string name = full_name.substr(8); // This removes the prefix "exotica/"
184  known_initializers[full_name] = CreateInitializer(i);
185  inits.def((name + "Initializer").c_str(), [full_name]() { return CreateInitializer(known_initializers[full_name]); }, (name + "Initializer constructor.").c_str());
186  }
187 
188  inits.def("load_xml", (Initializer(*)(std::string, bool)) & XMLLoader::Load, "Loads initializer from XML", py::arg("xml"), py::arg("parseAsXMLString") = false);
189  inits.def("load_xml_full", &LoadFromXML, "Loads initializer from XML", py::arg("xml"), py::arg("solver_name") = std::string(""), py::arg("problem_name") = std::string(""), py::arg("parseAsXMLString") = false);
190 }
191 
192 namespace pybind11
193 {
194 namespace detail
195 {
196 template <>
197 struct type_caster<Initializer>
198 {
199 public:
200  PYBIND11_TYPE_CASTER(Initializer, _("Initializer"));
201 
202  bool AddPropertyFromDict(Property& target, PyObject* value_py)
203  {
204  if (target.GetType() == "std::string" || target.GetType() == GetTypeName(typeid(std::string)))
205  {
206  target.Set(PyAsStdString(value_py));
207  return true;
208  }
209  else if (target.GetType() == "int")
210  {
211  if (IsPyString(value_py))
212  {
213  target.Set(ParseInt(PyAsStdString(value_py)));
214  return true;
215  }
216  else if (PyInt_Check(value_py) || PyLong_Check(value_py))
217  {
218  target.Set((int)PyInt_AsLong(value_py));
219  return true;
220  }
221  }
222  else if (target.GetType() == "long")
223  {
224  if (IsPyString(value_py))
225  {
226  target.Set((long)ParseInt(PyAsStdString(value_py)));
227  return true;
228  }
229  else if (PyInt_Check(value_py))
230  {
231  target.Set(PyInt_AsLong(value_py));
232  return true;
233  }
234  else
235  {
236  ThrowPretty("to be implemented - please open an issue.");
237  }
238  }
239  else if (target.GetType() == "double")
240  {
241  if (IsPyString(value_py))
242  {
243  target.Set(ParseDouble(PyAsStdString(value_py)));
244  return true;
245  }
246  else if (PyFloat_Check(value_py))
247  {
248  target.Set(PyFloat_AsDouble(value_py));
249  return true;
250  }
251  }
252  else if (target.GetType() == "Eigen::Matrix<double, -1, 1, 0, -1, 1>")
253  {
254  if (IsPyString(value_py))
255  {
256  target.Set(ParseVector<double, Eigen::Dynamic>(PyAsStdString(value_py)));
257  }
258  else
259  {
260  target.Set(py::cast<Eigen::VectorXd>(value_py));
261  }
262  return true;
263  }
264  else if (target.GetType() == "Eigen::Matrix<int, -1, 1, 0, -1, 1>")
265  {
266  if (IsPyString(value_py))
267  {
268  target.Set(ParseVector<int, Eigen::Dynamic>(PyAsStdString(value_py)));
269  }
270  else
271  {
272  target.Set(py::cast<Eigen::VectorXi>(value_py));
273  }
274  return true;
275  }
276  else if (target.GetType() == "Eigen::Matrix<double, 2, 1, 0, 2, 1>")
277  {
278  if (IsPyString(value_py))
279  {
280  target.Set(ParseVector<double, 2>(PyAsStdString(value_py)));
281  }
282  else
283  {
284  target.Set(py::cast<Eigen::Vector2d>(value_py));
285  }
286  return true;
287  }
288  else if (target.GetType() == "Eigen::Matrix<double, 3, 1, 0, 3, 1>")
289  {
290  if (IsPyString(value_py))
291  {
292  target.Set(ParseVector<double, 3>(PyAsStdString(value_py)));
293  }
294  else
295  {
296  target.Set(py::cast<Eigen::Vector3d>(value_py));
297  }
298  return true;
299  }
300  else if (target.GetType() == GetTypeName(typeid(std::vector<int>)))
301  {
302  if (IsPyString(value_py))
303  {
304  target.Set(ParseIntList(PyAsStdString(value_py)));
305  }
306  else
307  {
308  target.Set(py::cast<std::vector<int>>(value_py));
309  }
310  return true;
311  }
312  else if (target.GetType() == GetTypeName(typeid(std::vector<std::string>)))
313  {
314  if (IsPyString(value_py))
315  {
316  target.Set(ParseList(PyAsStdString(value_py)));
317  }
318  else
319  {
320  target.Set(py::cast<std::vector<std::string>>(value_py));
321  }
322  return true;
323  }
324  else if (target.GetType() == "bool")
325  {
326  if (IsPyString(value_py))
327  {
328  target.Set(ParseBool(PyAsStdString(value_py)));
329  return true;
330  }
331  else if (PyBool_Check(value_py))
332  {
333  target.Set(PyObject_IsTrue(value_py) == 1);
334  return true;
335  }
336  }
337  else if (target.GetType() == "exotica::Initializer")
338  {
339  if (PyList_Check(value_py))
340  {
341  Initializer tmp;
342  int n = PyList_Size(value_py);
343  if (n == 1)
344  {
345  if (!PyToInit(PyList_GetItem(value_py, 0), tmp))
346  {
347  WARNING("Could not create initializer :'(");
348  return false;
349  }
350  }
351  else
352  {
353  WARNING("List size is greater than 1 - this should not happen: " << n);
354  }
355  target.Set(tmp);
356  }
357  else
358  {
359  Initializer tmp;
360  if (!PyToInit(value_py, tmp))
361  {
362  WARNING("Could not convert Python value to exotica::Initializer");
363  return false;
364  }
365  target.Set(tmp);
366  }
367  return true;
368  }
369  else if (target.IsInitializerVectorType())
370  {
371  if (PyList_Check(value_py))
372  {
373  int n = PyList_Size(value_py);
374  std::vector<Initializer> vec(n);
375  for (int i = 0; i < n; ++i)
376  {
377  if (!PyToInit(PyList_GetItem(value_py, i), vec[i]))
378  {
379  WARNING("Could not parse initializer in vector of initializers: #" << i);
380  return false;
381  }
382  }
383  target.Set(vec);
384  return true;
385  }
386  else
387  {
388  HIGHLIGHT("InitializerVectorType failed PyList_Check");
389  }
390  }
391  else
392  {
393  HIGHLIGHT("Skipping unsupported type '" << target.GetType() << "'");
394  }
395 
396  return false;
397  }
398 
399  bool PyToInit(PyObject* source, Initializer& ret)
400  {
401  if (!PyTuple_CheckExact(source))
402  {
403  WARNING_NAMED("PyToInit", "Failed exact tuple check.");
404  return false;
405  }
406 
407  int tuple_size = PyTuple_Size(source);
408  if (tuple_size < 1 || tuple_size > 2)
409  {
410  WARNING_NAMED("PyToInit", "Wrong sized tuple for exotica::Initializer: " << tuple_size);
411  return false;
412  }
413 
414  PyObject* const name_py = PyTuple_GetItem(source, 0);
415  if (!IsPyString(name_py))
416  {
417  WARNING_NAMED("PyToInit", "First element of exotica::Initializer-tuple is not a string.");
418  return false;
419  }
420  const std::string initializer_name = PyAsStdString(name_py);
421 
422  const auto& it = known_initializers.find(initializer_name);
423  if (it == known_initializers.end())
424  {
425  HIGHLIGHT("Unknown initializer type '" << initializer_name << "'");
426  return false;
427  }
428  ret = Initializer(it->second);
429 
430  if (tuple_size == 2)
431  {
432  PyObject* const dict = PyTuple_GetItem(source, 1);
433  if (!PyDict_Check(dict))
434  {
435  WARNING_NAMED("PyToInit", "Second element of exotica::Initializer-tuple is not a dict.");
436  return false;
437  }
438 
439  PyObject *key, *value_py;
440  Py_ssize_t pos = 0;
441 
442  while (PyDict_Next(dict, &pos, &key, &value_py))
443  {
444  const std::string key_str = PyAsStdString(key);
445 
446  if (ret.properties_.count(key_str))
447  {
448  if (!AddPropertyFromDict(ret.properties_.at(key_str), value_py))
449  {
450  HIGHLIGHT("Failed to add property '" << key_str << "'");
451  return false;
452  }
453  }
454  else
455  {
456  // 2020-11-04: Replaced the ignoring behaviour with a warning that still adds the property to the initializer.
457  // This resolves issue #719: Sometimes (e.g. for SphereCollision ), we do casting to derived types inside a TaskMap.
458  // This requires having the properties added to the generic Initializer, even if the base initializer does not contain them.
459  // HIGHLIGHT(initializer_name << ": Ignoring property '" << key_str << "'")
460  ret.AddProperty(Property(key_str, false, boost::any(PyAsStdString(value_py))));
461  // WARNING("Adding property '" << key_str << "' even though Initializer type '" << initializer_name << "' does not know this property.");
462  }
463  }
464  }
465  return true;
466  }
467 
468  bool load(handle src, bool)
469  {
470  return PyToInit(src.ptr(), value);
471  }
472 
473  static PyObject* InitializerToTuple(const Initializer& src)
474  {
475  PyObject* dict = PyDict_New();
476  for (auto& prop : src.properties_)
477  {
478  addPropertyToDict(dict, prop.first, prop.second);
479  }
480  PyObject* name = StdStringAsPy(src.GetName());
481  PyObject* tup = PyTuple_Pack(2, name, dict);
482  Py_DECREF(dict);
483  Py_DECREF(name);
484  return tup;
485  }
486 
487  static void addPropertyToDict(PyObject* dict, const std::string& name, const Property& prop)
488  {
489  if (prop.GetType() == "std::string" || prop.GetType() == GetTypeName(typeid(std::string)))
490  {
491  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<std::string>(prop.Get())).ptr());
492  }
493  else if (prop.GetType() == "int")
494  {
495  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<int>(prop.Get())).ptr());
496  }
497  else if (prop.GetType() == "long")
498  {
499  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<long>(prop.Get())).ptr());
500  }
501  else if (prop.GetType() == "double")
502  {
503  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<double>(prop.Get())).ptr());
504  }
505  else if (prop.GetType() == "Eigen::Matrix<double, -1, 1, 0, -1, 1>")
506  {
507  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<Eigen::VectorXd>(prop.Get())).ptr());
508  }
509  else if (prop.GetType() == "Eigen::Matrix<int, -1, 1, 0, -1, 1>")
510  {
511  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<Eigen::VectorXi>(prop.Get())).ptr());
512  }
513  else if (prop.GetType() == "Eigen::Matrix<double, 2, 1, 0, 2, 1>")
514  {
515  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<Eigen::Vector2d>(prop.Get())).ptr());
516  }
517  else if (prop.GetType() == "Eigen::Matrix<double, 3, 1, 0, 3, 1>")
518  {
519  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<Eigen::Vector3d>(prop.Get())).ptr());
520  }
521  else if (prop.GetType() == GetTypeName(typeid(std::vector<int>)))
522  {
523  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<std::vector<int>>(prop.Get())).ptr());
524  }
525  else if (prop.GetType() == GetTypeName(typeid(std::vector<std::string>)))
526  {
527  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<std::vector<std::string>>(prop.Get())).ptr());
528  }
529  else if (prop.GetType() == "bool")
530  {
531  PyDict_SetItemString(dict, name.c_str(), py::cast(boost::any_cast<bool>(prop.Get())).ptr());
532  }
533  else if (prop.GetType() == "exotica::Initializer")
534  {
535  PyObject* init = InitializerToTuple(boost::any_cast<Initializer>(prop.Get()));
536  PyDict_SetItemString(dict, name.c_str(), init);
537  Py_DECREF(init);
538  }
539  else if (prop.IsInitializerVectorType())
540  {
541  PyObject* vec = PyList_New(0);
542  for (Initializer& i : boost::any_cast<std::vector<Initializer>>(prop.Get()))
543  {
544  PyObject* init = InitializerToTuple(i);
545  PyList_Append(vec, init);
546  Py_DECREF(init);
547  }
548  PyDict_SetItemString(dict, name.c_str(), vec);
549  Py_DECREF(vec);
550  }
551  else
552  {
553  HIGHLIGHT("Skipping unsupported type '" << prop.GetType() << "'");
554  }
555  }
556 
557  static handle cast(Initializer src, return_value_policy /* policy */, handle /* parent */)
558  {
559  return handle(InitializerToTuple(src));
560  }
561 };
562 } // namespace detail
563 } // namespace pybind11
564 
565 template <class T>
567  pybind11::array_t<T> inArray)
568 {
569  // request a buffer descriptor from Python
570  pybind11::buffer_info buffer_info = inArray.request();
571 
572  // extract data an shape of input array
573  T* data = static_cast<T*>(buffer_info.ptr);
574  std::vector<ssize_t> shape = buffer_info.shape;
575 
576  // wrap ndarray in Eigen::Map:
577  // the second template argument is the rank of the tensor and has to be
578  // known at compile time
579  Eigen::TensorMap<Eigen::Tensor<T, 3, Eigen::RowMajor>> in_tensor(
580  data, shape[0], shape[1], shape[2]);
581 
582  Hessian hessian = Hessian::Constant(shape[0], Eigen::MatrixXd::Zero(shape[1], shape[2]));
583  for (int i = 0; i < shape[0]; i++)
584  {
585  for (int j = 0; j < shape[1]; j++)
586  {
587  for (int k = 0; k < shape[2]; k++)
588  {
589  hessian(i)(j, k) = in_tensor(i, j, k);
590  }
591  }
592  }
593  return hessian;
594 }
595 
596 template <class T>
597 py::handle hessian_array(
598  Hessian& inp)
599 {
600  std::vector<ssize_t> shape(3);
601  shape[0] = inp.rows();
602  if (shape[0] > 0)
603  {
604  shape[1] = inp(0).rows();
605  shape[2] = inp(0).cols();
606  }
607  else
608  {
609  shape[1] = shape[2] = 0;
610  }
611 
612  pybind11::array_t<T> array(
613  shape, // shape
614  {shape[1] * shape[2] * sizeof(T), shape[2] * sizeof(T), sizeof(T)}); // stride
615 
616  Eigen::TensorMap<Eigen::Tensor<T, 3, Eigen::RowMajor>> in_tensor(
617  array.mutable_data(), shape[0], shape[1], shape[2]);
618  for (int i = 0; i < shape[0]; i++)
619  {
620  for (int j = 0; j < shape[1]; j++)
621  {
622  for (int k = 0; k < shape[2]; k++)
623  {
624  in_tensor(i, j, k) = inp(i)(j, k);
625  }
626  }
627  }
628  return array.release();
629 }
630 
631 namespace pybind11
632 {
633 namespace detail
634 {
635 template <>
636 struct type_caster<Hessian>
637 {
638 public:
644  PYBIND11_TYPE_CASTER(Hessian, _("Hessian"));
645 
651  bool load(handle src, bool)
652  {
653  value = array_hessian(py::cast<pybind11::array_t<Hessian::Scalar::Scalar>>(src.ptr()));
654  return true;
655  }
656 
664  static handle cast(Hessian src, return_value_policy /* policy */, handle /* parent */)
665  {
666  return hessian_array<Hessian::Scalar::Scalar>(src);
667  }
668 };
669 } // namespace detail
670 } // namespace pybind11
671 
672 PYBIND11_MODULE(_pyexotica, module)
673 {
674  module.doc() = "Exotica Python wrapper";
675 
676  py::class_<Setup, std::unique_ptr<Setup, py::nodelete>> setup(module, "Setup");
677  setup.def(py::init([]() { return Setup::Instance().get(); }));
678  setup.def_static("get_solvers", &Setup::GetSolvers, "Returns a list of available solvers.");
679  setup.def_static("get_problems", &Setup::GetProblems, "Returns a list of available problems.");
680  setup.def_static("get_maps", &Setup::GetMaps, "Returns a list of available task maps.");
681  setup.def_static("get_collision_scenes", &Setup::GetCollisionScenes, "Returns a list of available collision scene plug-ins.");
682  setup.def_static("get_dynamics_solvers", &Setup::GetDynamicsSolvers, "Returns a list of available dynamics solvers plug-ins.");
683  setup.def_static("create_solver", [](const Initializer& init) { return Setup::CreateSolver(init); }, py::return_value_policy::take_ownership); // "Creates an instance of the solver identified by name parameter.", py::arg("solverType"), py::arg("prependExoticaNamespace"));
684  setup.def_static("create_problem", [](const Initializer& init) { return Setup::CreateProblem(init); }, py::return_value_policy::take_ownership); // "Creates an instance of the problem identified by name parameter.", py::arg("problemType"), py::arg("prependExoticaNamespace"));
685  setup.def_static("create_scene", [](const Initializer& init) { return Setup::CreateScene(init); }, py::return_value_policy::take_ownership);
686  setup.def_static("create_dynamics_solver", [](const Initializer& init) { return Setup::CreateDynamicsSolver(init); }, py::return_value_policy::take_ownership);
687  setup.def_static("print_supported_classes", &Setup::PrintSupportedClasses, "Print a list of available plug-ins sorted by class.");
688  setup.def_static("get_initializers", &Setup::GetInitializers, py::return_value_policy::copy, "Returns a list of available initializers with all available parameters/arguments.");
689  setup.def_static("get_package_path", &ros::package::getPath, "ROS package path resolution.");
690  setup.def_static("init_ros",
691  [](const std::string& name, const bool& anonymous) {
692  int argc = 0;
693  if (anonymous)
694  {
696  }
697  else
698  {
699  ros::init(argc, nullptr, name);
700  }
701  Server::InitRos(std::make_shared<ros::NodeHandle>("~"));
702  },
703  "Initializes an internal ROS node for publishing debug information from Exotica (i.e., activates ROS features). Options are setting the name and whether to spawn an anonymous node.",
704  py::arg("name") = "exotica", py::arg("anonymous") = false);
705  setup.def_static("load_solver", &XMLLoader::LoadSolver, "Instantiate solver and problem from an XML file containing both a solver and problem initializer.", py::arg("filepath"));
706  setup.def_static("load_solver_standalone", &XMLLoader::LoadSolverStandalone, "Instantiate only a solver from an XML file containing solely a solver initializer.", py::arg("filepath"));
707  setup.def_static("load_problem", &XMLLoader::LoadProblem, "Instantiate only a problem from an XML file containing solely a problem initializer.", py::arg("filepath"));
708 
709  py::module tools = module.def_submodule("Tools");
710  tools.def("parse_path", &ParsePath);
711  tools.def("parse_bool", &ParseBool);
712  tools.def("parse_double", &ParseDouble);
713  tools.def("parse_vector", &ParseVector<double, Eigen::Dynamic>);
714  tools.def("parse_list", &ParseList);
715  tools.def("parse_int", &ParseInt);
716  tools.def("parse_int_list", &ParseIntList);
717  tools.def("load_obj", [](const std::string& path) { Eigen::VectorXi tri; Eigen::VectorXd vert; LoadOBJ(LoadFile(path), tri, vert); return py::make_tuple(tri, vert); });
718  tools.def("load_octree", &LoadOctree);
719  tools.def("load_octree_as_shape", &LoadOctreeAsShape);
720  tools.def("save_matrix", &SaveMatrix);
721  tools.def("VectorTransform", &Eigen::VectorTransform);
722  tools.def("IdentityTransform", &Eigen::IdentityTransform);
723  tools.def("load_file", &LoadFile);
724  tools.def("path_exists", &PathExists);
725  tools.def("create_composite_trajectory", [](Eigen::MatrixXdRefConst data, double radius) {
726  return Trajectory(data, radius).ToString();
727  },
728  py::arg("data"), py::arg("max_radius") = 1.0);
729 
730  py::module sparse_costs = tools.def_submodule("SparseCosts")
731  .def("huber_cost", &huber_cost)
732  .def("huber_jacobian", &huber_jacobian)
733  .def("huber_hessian", &huber_hessian)
734  .def("smooth_l1_cost", &smooth_l1_cost)
735  .def("smooth_l1_jacobian", &smooth_l1_jacobian)
736  .def("smooth_l1_hessian", &smooth_l1_hessian)
737  .def("pseudo_huber_cost", &pseudo_huber_cost)
738  .def("pseudo_huber_jacobian", &pseudo_huber_jacobian)
739  .def("pseudo_huber_hessian", &pseudo_huber_hessian);
740 
741  py::class_<Timer, std::shared_ptr<Timer>> timer(module, "Timer");
742  timer.def(py::init());
743  timer.def("reset", &Timer::Reset);
744  timer.def("get_duration", &Timer::GetDuration);
745 
746  py::class_<Object, std::shared_ptr<Object>> object(module, "Object");
747  object.def_property_readonly("type", &Object::type, "Object type");
748  object.def_property_readonly("name", &Object::GetObjectName, "Object name");
749  object.def("__repr__", &Object::Print, "String representation of the object", py::arg("prepend") = std::string(""));
750  object.def_readwrite("namespace", &Object::ns_);
751  object.def_readwrite("debug_mode", &Object::debug_);
752 
753  py::enum_<TerminationCriterion>(module, "TerminationCriterion")
754  .value("NotStarted", TerminationCriterion::NotStarted)
755  .value("IterationLimit", TerminationCriterion::IterationLimit)
756  .value("BacktrackIterationLimit", TerminationCriterion::BacktrackIterationLimit)
757  .value("StepTolerance", TerminationCriterion::StepTolerance)
758  .value("FunctionTolerance", TerminationCriterion::FunctionTolerance)
759  .value("GradientTolerance", TerminationCriterion::GradientTolerance)
760  .value("Divergence", TerminationCriterion::Divergence)
761  .value("UserDefined", TerminationCriterion::UserDefined)
762  .value("Convergence", TerminationCriterion::Convergence)
763  .export_values();
764 
765  py::enum_<RotationType>(module, "RotationType")
766  .value("Quaternion", RotationType::QUATERNION)
767  .value("RPY", RotationType::RPY)
768  .value("ZYZ", RotationType::ZYZ)
769  .value("ZYX", RotationType::ZYX)
770  .value("AngleAxis", RotationType::ANGLE_AXIS)
771  .value("Matrix", RotationType::MATRIX)
772  .export_values();
773 
774  py::enum_<BaseType>(module, "BaseType")
775  .value("Fixed", BaseType::FIXED)
776  .value("Floating", BaseType::FLOATING)
777  .value("Planar", BaseType::PLANAR)
778  .export_values();
779 
780  py::class_<KDL::Frame> kdl_frame(module, "KDLFrame");
781  kdl_frame.def(py::init());
782  kdl_frame.def(py::init([](Eigen::MatrixXd other) { return GetFrameFromMatrix(other); }));
783  kdl_frame.def(py::init([](Eigen::VectorXd other) { return GetFrame(other); }));
784  kdl_frame.def(py::init([](const KDL::Frame& other) { return KDL::Frame(other); }));
785  kdl_frame.def("__repr__", [](KDL::Frame* me) { return "KDL::Frame " + ToString(*me); });
786  kdl_frame.def("get_rpy", [](KDL::Frame* me) { return GetRotationAsVector(*me, RotationType::RPY); });
787  kdl_frame.def("get_zyz", [](KDL::Frame* me) { return GetRotationAsVector(*me, RotationType::ZYZ); });
788  kdl_frame.def("get_zyx", [](KDL::Frame* me) { return GetRotationAsVector(*me, RotationType::ZYX); });
789  kdl_frame.def("get_angle_axis", [](KDL::Frame* me) { return GetRotationAsVector(*me, RotationType::ANGLE_AXIS); });
790  kdl_frame.def("get_quaternion", [](KDL::Frame* me) { return GetRotationAsVector(*me, RotationType::QUATERNION); });
791  kdl_frame.def("get_translation", [](KDL::Frame* me) { Eigen::Vector3d tmp; for (int i = 0; i < 3; ++i) { tmp[i] = me->p.data[i]; } return tmp; });
792  kdl_frame.def("get_translation_and_rpy", [](KDL::Frame* me) { return GetFrameAsVector(*me, RotationType::RPY); });
793  kdl_frame.def("get_translation_and_zyz", [](KDL::Frame* me) { return GetFrameAsVector(*me, RotationType::ZYZ); });
794  kdl_frame.def("get_translation_and_zyx", [](KDL::Frame* me) { return GetFrameAsVector(*me, RotationType::ZYX); });
795  kdl_frame.def("get_translation_and_angle_axis", [](KDL::Frame* me) { return GetFrameAsVector(*me, RotationType::ANGLE_AXIS); });
796  kdl_frame.def("get_translation_and_quaternion", [](KDL::Frame* me) { return GetFrameAsVector(*me, RotationType::QUATERNION); });
797  kdl_frame.def("get_frame", [](KDL::Frame* me) { return GetFrame(*me); });
798  kdl_frame.def("inverse", (KDL::Frame(KDL::Frame::*)() const) & KDL::Frame::Inverse);
799  kdl_frame.def("__mul__", [](const KDL::Frame& A, const KDL::Frame& B) { return A * B; }, py::is_operator());
800  kdl_frame.def_readwrite("p", &KDL::Frame::p);
801  kdl_frame.def_static("interpolate", [](KDL::Frame* A, KDL::Frame* B, double alpha) { return KDL::addDelta(*A, KDL::diff(*A, *B) * alpha); });
802  kdl_frame.def_static("diff", [](KDL::Frame* A, KDL::Frame* B) { Eigen::VectorXd ret(6); KDL::Twist t = KDL::diff(*A, *B); for(int i=0; i<6; ++i) ret(i) = t[i]; return ret; });
803  py::implicitly_convertible<Eigen::MatrixXd, KDL::Frame>();
804  py::implicitly_convertible<Eigen::VectorXd, KDL::Frame>();
805 
806  py::class_<KDL::Vector>(module, "KDLVector")
807  .def(py::init())
808  .def(py::init<double, double, double>(),
809  py::arg("x") = 0,
810  py::arg("y") = 0,
811  py::arg("z") = 0)
812  .def("__repr__", [](KDL::Vector* me) { return "KDL::Vector [" + std::to_string(me->data[0]) + ", " + std::to_string(me->data[1]) + ", " + std::to_string(me->data[2]) + "]"; })
813  .def("x", [](KDL::Vector& v) -> double& { return v[0]; })
814  .def("y", [](KDL::Vector& v) -> double& { return v[1]; })
815  .def("z", [](KDL::Vector& v) -> double& { return v[2]; })
816  .def_static("Zero", &KDL::Vector::Zero);
817 
818  py::class_<KDL::RotationalInertia>(module, "KDLRotationalInertia")
819  .def(py::init<double, double, double, double, double, double>(),
820  py::arg("Ixx") = 0,
821  py::arg("Iyy") = 0,
822  py::arg("Izz") = 0,
823  py::arg("Ixy") = 0,
824  py::arg("Ixz") = 0,
825  py::arg("Iyz") = 0)
826  .def_static("Zero", &KDL::RotationalInertia::Zero);
827 
828  py::class_<KDL::RigidBodyInertia>(module, "KDLRigidBodyInertia")
829  .def(py::init<double, KDL::Vector&, KDL::RotationalInertia&>(),
830  py::arg("m") = 0,
831  py::arg("oc") = KDL::Vector::Zero(),
832  py::arg("Ic") = KDL::RotationalInertia::Zero())
833  .def_static("Zero", &KDL::RigidBodyInertia::Zero);
834 
835  py::class_<TaskMap, std::shared_ptr<TaskMap>, Object>(module, "TaskMap")
836  .def_readonly("id", &TaskMap::id)
837  .def_readonly("start", &TaskMap::start)
838  .def_readonly("length", &TaskMap::length)
839  .def_readonly("startJ", &TaskMap::start_jacobian)
840  .def_readonly("lengthJ", &TaskMap::length_jacobian)
841  .def("task_space_dim", (int (TaskMap::*)()) & TaskMap::TaskSpaceDim)
842  .def("task_space_jacobian_dim", &TaskMap::TaskSpaceJacobianDim);
843 
844  py::class_<TaskIndexing>(module, "TaskIndexing")
845  .def_readonly("id", &TaskIndexing::id)
846  .def_readonly("start", &TaskIndexing::start)
847  .def_readonly("length", &TaskIndexing::length)
848  .def_readonly("startJ", &TaskIndexing::start_jacobian)
849  .def_readonly("lengthJ", &TaskIndexing::length_jacobian);
850 
851  py::class_<TimeIndexedTask, std::shared_ptr<TimeIndexedTask>>(module, "TimeIndexedTask")
852  .def_readonly("indexing", &TimeIndexedTask::indexing)
853  .def_readonly("length_Phi", &TimeIndexedTask::length_Phi)
854  .def_readonly("length_jacobian", &TimeIndexedTask::length_jacobian)
855  .def_readonly("num_tasks", &TimeIndexedTask::num_tasks)
856  .def_readonly("y", &TimeIndexedTask::y)
857  .def_readonly("ydiff", &TimeIndexedTask::ydiff)
858  .def_readonly("Phi", &TimeIndexedTask::Phi)
859  .def_readonly("rho", &TimeIndexedTask::rho)
860  .def_readonly("hessian", &TimeIndexedTask::hessian) // Kinematic
861  .def_readonly("jacobian", &TimeIndexedTask::jacobian) // Kinematic
862  .def_readonly("dPhi_dx", &TimeIndexedTask::dPhi_dx) // Dynamic
863  .def_readonly("dPhi_du", &TimeIndexedTask::dPhi_du) // Dynamic
864  .def_readonly("ddPhi_ddx", &TimeIndexedTask::ddPhi_ddx) // Dynamic
865  .def_readonly("ddPhi_ddu", &TimeIndexedTask::ddPhi_ddu) // Dynamic
866  .def_readonly("ddPhi_dxdu", &TimeIndexedTask::ddPhi_dxdu) // Dynamic
867  .def_readonly("S", &TimeIndexedTask::S)
868  .def_readonly("T", &TimeIndexedTask::T)
869  .def_readonly("tasks", &TimeIndexedTask::tasks)
870  .def_readonly("task_maps", &TimeIndexedTask::task_maps)
871  .def("set_goal", &TimeIndexedTask::SetGoal)
872  .def("get_goal", &TimeIndexedTask::GetGoal)
873  .def("set_rho", &TimeIndexedTask::SetRho)
874  .def("get_rho", &TimeIndexedTask::GetRho)
875  .def("get_task_error", &TimeIndexedTask::GetTaskError)
876  .def("get_S", &TimeIndexedTask::GetS);
877 
878  py::class_<EndPoseTask, std::shared_ptr<EndPoseTask>>(module, "EndPoseTask")
879  .def_readonly("length_Phi", &EndPoseTask::length_Phi)
880  .def_readonly("length_jacobian", &EndPoseTask::length_jacobian)
881  .def_readonly("num_tasks", &EndPoseTask::num_tasks)
882  .def_readonly("y", &EndPoseTask::y)
883  .def_readonly("ydiff", &EndPoseTask::ydiff)
884  .def_readonly("Phi", &EndPoseTask::Phi)
885  .def_readonly("hessian", &EndPoseTask::hessian)
886  .def_readonly("jacobian", &EndPoseTask::jacobian)
887  .def_readonly("S", &EndPoseTask::S)
888  .def_readonly("tasks", &EndPoseTask::tasks)
889  .def_readonly("task_maps", &EndPoseTask::task_maps)
890  .def("get_S", &EndPoseTask::GetS)
891  .def("get_task_error", &EndPoseTask::GetTaskError)
892  .def("get_task_jacobian", &EndPoseTask::GetTaskJacobian)
893  .def("set_goal", &EndPoseTask::SetGoal)
894  .def("get_goal", &EndPoseTask::GetGoal)
895  .def("set_rho", &EndPoseTask::SetRho)
896  .def("get_rho", &EndPoseTask::GetRho);
897 
898  py::class_<SamplingTask, std::shared_ptr<SamplingTask>>(module, "SamplingTask")
899  .def_readonly("length_Phi", &SamplingTask::length_Phi)
900  .def_readonly("length_jacobian", &SamplingTask::length_jacobian)
901  .def_readonly("num_tasks", &SamplingTask::num_tasks)
902  .def_readonly("y", &SamplingTask::y)
903  .def_readonly("ydiff", &SamplingTask::ydiff)
904  .def_readonly("Phi", &SamplingTask::Phi)
905  .def_readonly("S", &SamplingTask::S)
906  .def_readonly("tasks", &SamplingTask::tasks)
907  .def_readonly("task_maps", &SamplingTask::task_maps)
908  .def("set_goal", &SamplingTask::SetGoal)
909  .def("get_goal", &SamplingTask::GetGoal)
910  .def("set_rho", &SamplingTask::SetRho)
911  .def("get_rho", &SamplingTask::GetRho);
912 
913  py::class_<TaskSpaceVector, std::shared_ptr<TaskSpaceVector>> task_space_vector(module, "TaskSpaceVector");
914  task_space_vector.def("set_zero", &TaskSpaceVector::SetZero);
915  task_space_vector.def_readonly("data", &TaskSpaceVector::data);
916  task_space_vector.def("__sub__", &TaskSpaceVector::operator-, py::is_operator());
917  task_space_vector.def("__repr__", [](TaskSpaceVector* instance) { return ((std::ostringstream&)(std::ostringstream("") << "TaskSpaceVector (" << instance->data.transpose() << ")")).str(); });
918 
919  py::class_<MotionSolver, std::shared_ptr<MotionSolver>, Object> motion_solver(module, "MotionSolver");
920  motion_solver.def_property("max_iterations", &MotionSolver::GetNumberOfMaxIterations, &MotionSolver::SetNumberOfMaxIterations);
921  motion_solver.def("get_planning_time", &MotionSolver::GetPlanningTime);
922  motion_solver.def("specify_problem", &MotionSolver::SpecifyProblem, "Assign problem to the solver", py::arg("planning_problem"));
923  motion_solver.def(
924  "solve", [](std::shared_ptr<MotionSolver> sol) {
925  Eigen::MatrixXd ret;
926  sol->Solve(ret);
927  return ret;
928  },
929  "Solve the problem");
930  motion_solver.def("get_problem", &MotionSolver::GetProblem);
931 
932  py::class_<FeedbackMotionSolver, std::shared_ptr<FeedbackMotionSolver>, MotionSolver> feedback_motion_solver(module, "FeedbackMotionSolver");
933  feedback_motion_solver.def("get_feedback_control", &FeedbackMotionSolver::GetFeedbackControl);
934 
935  py::class_<PlanningProblem, std::shared_ptr<PlanningProblem>, Object>(module, "PlanningProblem")
936  .def("get_tasks", &PlanningProblem::GetTasks, py::return_value_policy::reference_internal)
937  .def("get_task_maps", &PlanningProblem::GetTaskMaps, py::return_value_policy::reference_internal)
938  .def("get_scene", &PlanningProblem::GetScene, py::return_value_policy::reference_internal)
939  .def("__repr__", &PlanningProblem::Print, "String representation of the object", py::arg("prepend") = std::string(""))
940  .def_readonly("N", &PlanningProblem::N)
941  .def_property_readonly("num_positions", &PlanningProblem::get_num_positions) // deprecated
942  .def_property_readonly("num_velocities", &PlanningProblem::get_num_velocities) // deprecated
943  .def_property_readonly("num_controls", &PlanningProblem::get_num_controls) // deprecated
944  .def_property("start_state", &PlanningProblem::GetStartState, &PlanningProblem::SetStartState)
945  .def_property("start_time", &PlanningProblem::GetStartTime, &PlanningProblem::SetStartTime)
946  .def("get_number_of_problem_updates", &PlanningProblem::GetNumberOfProblemUpdates)
947  .def("reset_number_of_problem_updates", &PlanningProblem::ResetNumberOfProblemUpdates)
948  .def("get_cost_evolution", (std::pair<std::vector<double>, std::vector<double>>(PlanningProblem::*)() const) & PlanningProblem::GetCostEvolution)
949  .def("get_number_of_iterations", &PlanningProblem::GetNumberOfIterations)
950  .def("pre_update", &PlanningProblem::PreUpdate)
951  .def("is_valid", &PlanningProblem::IsValid)
952  .def("apply_start_state", &PlanningProblem::ApplyStartState)
953  .def_readonly("termination_criterion", &PlanningProblem::termination_criterion);
954 
955  // Problem types
956  py::module prob = module.def_submodule("Problems", "Problem types");
957 
958  py::class_<UnconstrainedTimeIndexedProblem, std::shared_ptr<UnconstrainedTimeIndexedProblem>, PlanningProblem> unconstrained_time_indexed_problem(prob, "UnconstrainedTimeIndexedProblem");
959  unconstrained_time_indexed_problem.def("get_duration", &UnconstrainedTimeIndexedProblem::GetDuration);
960  unconstrained_time_indexed_problem.def("update", (void (UnconstrainedTimeIndexedProblem::*)(Eigen::VectorXdRefConst, int)) & UnconstrainedTimeIndexedProblem::Update);
961  unconstrained_time_indexed_problem.def("update", (void (UnconstrainedTimeIndexedProblem::*)(Eigen::VectorXdRefConst)) & UnconstrainedTimeIndexedProblem::Update);
962  unconstrained_time_indexed_problem.def("set_goal", &UnconstrainedTimeIndexedProblem::SetGoal);
963  unconstrained_time_indexed_problem.def("set_rho", &UnconstrainedTimeIndexedProblem::SetRho);
964  unconstrained_time_indexed_problem.def("get_goal", &UnconstrainedTimeIndexedProblem::GetGoal);
965  unconstrained_time_indexed_problem.def("get_rho", &UnconstrainedTimeIndexedProblem::GetRho);
966  unconstrained_time_indexed_problem.def_property("tau", &UnconstrainedTimeIndexedProblem::GetTau, &UnconstrainedTimeIndexedProblem::SetTau);
967  unconstrained_time_indexed_problem.def_readwrite("W", &UnconstrainedTimeIndexedProblem::W);
968  unconstrained_time_indexed_problem.def_property("initial_trajectory", &UnconstrainedTimeIndexedProblem::GetInitialTrajectory, &UnconstrainedTimeIndexedProblem::SetInitialTrajectory);
969  unconstrained_time_indexed_problem.def_property("T", &UnconstrainedTimeIndexedProblem::GetT, &UnconstrainedTimeIndexedProblem::SetT);
970  unconstrained_time_indexed_problem.def_readonly("length_Phi", &UnconstrainedTimeIndexedProblem::length_Phi);
971  unconstrained_time_indexed_problem.def_readonly("length_jacobian", &UnconstrainedTimeIndexedProblem::length_jacobian);
972  unconstrained_time_indexed_problem.def_readonly("num_tasks", &UnconstrainedTimeIndexedProblem::num_tasks);
973  unconstrained_time_indexed_problem.def_readonly("Phi", &UnconstrainedTimeIndexedProblem::Phi);
974  unconstrained_time_indexed_problem.def_readonly("jacobian", &UnconstrainedTimeIndexedProblem::jacobian);
975  unconstrained_time_indexed_problem.def("get_scalar_task_cost", &UnconstrainedTimeIndexedProblem::GetScalarTaskCost);
976  unconstrained_time_indexed_problem.def("get_scalar_task_jacobian", &UnconstrainedTimeIndexedProblem::GetScalarTaskJacobian);
977  unconstrained_time_indexed_problem.def("get_scalar_transition_cost", &UnconstrainedTimeIndexedProblem::GetScalarTransitionCost);
978  unconstrained_time_indexed_problem.def("get_scalar_transition_jacobian", &UnconstrainedTimeIndexedProblem::GetScalarTransitionJacobian);
979  unconstrained_time_indexed_problem.def_readonly("cost", &UnconstrainedTimeIndexedProblem::cost);
980 
981  py::class_<TimeIndexedProblem, std::shared_ptr<TimeIndexedProblem>, PlanningProblem> time_indexed_problem(prob, "TimeIndexedProblem");
982  time_indexed_problem.def("get_duration", &TimeIndexedProblem::GetDuration);
983  time_indexed_problem.def("update", (void (TimeIndexedProblem::*)(Eigen::VectorXdRefConst, int)) & TimeIndexedProblem::Update);
984  time_indexed_problem.def("update", (void (TimeIndexedProblem::*)(Eigen::VectorXdRefConst)) & TimeIndexedProblem::Update);
985  time_indexed_problem.def("set_goal", &TimeIndexedProblem::SetGoal);
986  time_indexed_problem.def("set_rho", &TimeIndexedProblem::SetRho);
987  time_indexed_problem.def("get_goal", &TimeIndexedProblem::GetGoal);
988  time_indexed_problem.def("get_rho", &TimeIndexedProblem::GetRho);
989  time_indexed_problem.def("set_goal_eq", &TimeIndexedProblem::SetGoalEQ);
990  time_indexed_problem.def("set_rho_eq", &TimeIndexedProblem::SetRhoEQ);
991  time_indexed_problem.def("get_goal_eq", &TimeIndexedProblem::GetGoalEQ);
992  time_indexed_problem.def("get_rho_eq", &TimeIndexedProblem::GetRhoEQ);
993  time_indexed_problem.def("set_goal_neq", &TimeIndexedProblem::SetGoalNEQ);
994  time_indexed_problem.def("set_rho_neq", &TimeIndexedProblem::SetRhoNEQ);
995  time_indexed_problem.def("get_goal_neq", &TimeIndexedProblem::GetGoalNEQ);
996  time_indexed_problem.def("get_rho_neq", &TimeIndexedProblem::GetRhoNEQ);
997  time_indexed_problem.def_property("tau", &TimeIndexedProblem::GetTau, &TimeIndexedProblem::SetTau);
998  time_indexed_problem.def_property("q_dot_max", &TimeIndexedProblem::GetJointVelocityLimits, &TimeIndexedProblem::SetJointVelocityLimits); // deprecated
999  time_indexed_problem.def_readwrite("W", &TimeIndexedProblem::W);
1000  time_indexed_problem.def_readwrite("use_bounds", &TimeIndexedProblem::use_bounds);
1001  time_indexed_problem.def_property("initial_trajectory", &TimeIndexedProblem::GetInitialTrajectory, &TimeIndexedProblem::SetInitialTrajectory);
1002  time_indexed_problem.def_property("T", &TimeIndexedProblem::GetT, &TimeIndexedProblem::SetT);
1003  time_indexed_problem.def_readonly("length_Phi", &TimeIndexedProblem::length_Phi);
1004  time_indexed_problem.def_readonly("length_jacobian", &TimeIndexedProblem::length_jacobian);
1005  time_indexed_problem.def_readonly("num_tasks", &TimeIndexedProblem::num_tasks);
1006  time_indexed_problem.def_readonly("Phi", &TimeIndexedProblem::Phi);
1007  time_indexed_problem.def_readonly("jacobian", &TimeIndexedProblem::jacobian);
1008  time_indexed_problem.def("get_cost", &TimeIndexedProblem::GetCost);
1009  time_indexed_problem.def("get_cost_jacobian", &TimeIndexedProblem::GetCostJacobian);
1010  time_indexed_problem.def("get_scalar_task_cost", &TimeIndexedProblem::GetScalarTaskCost);
1011  time_indexed_problem.def("get_scalar_task_jacobian", &TimeIndexedProblem::GetScalarTaskJacobian);
1012  time_indexed_problem.def("get_scalar_transition_cost", &TimeIndexedProblem::GetScalarTransitionCost);
1013  time_indexed_problem.def("get_scalar_transition_jacobian", &TimeIndexedProblem::GetScalarTransitionJacobian);
1014  time_indexed_problem.def("get_equality", (Eigen::VectorXd(TimeIndexedProblem::*)() const) & TimeIndexedProblem::GetEquality);
1015  time_indexed_problem.def("get_equality", (Eigen::VectorXd(TimeIndexedProblem::*)(int) const) & TimeIndexedProblem::GetEquality);
1016  time_indexed_problem.def("get_equality_jacobian", (Eigen::SparseMatrix<double>(TimeIndexedProblem::*)() const) & TimeIndexedProblem::GetEqualityJacobian);
1017  time_indexed_problem.def("get_equality_jacobian", (Eigen::MatrixXd(TimeIndexedProblem::*)(int) const) & TimeIndexedProblem::GetEqualityJacobian);
1018  time_indexed_problem.def("get_inequality", (Eigen::VectorXd(TimeIndexedProblem::*)() const) & TimeIndexedProblem::GetInequality);
1019  time_indexed_problem.def("get_inequality", (Eigen::VectorXd(TimeIndexedProblem::*)(int) const) & TimeIndexedProblem::GetInequality);
1020  time_indexed_problem.def("get_inequality_jacobian", (Eigen::SparseMatrix<double>(TimeIndexedProblem::*)() const) & TimeIndexedProblem::GetInequalityJacobian);
1021  time_indexed_problem.def("get_inequality_jacobian", (Eigen::MatrixXd(TimeIndexedProblem::*)(int) const) & TimeIndexedProblem::GetInequalityJacobian);
1022  time_indexed_problem.def("get_bounds", &TimeIndexedProblem::GetBounds);
1023  time_indexed_problem.def("get_joint_velocity_limits", &TimeIndexedProblem::GetJointVelocityLimits); // deprecated
1024  time_indexed_problem.def_readonly("cost", &TimeIndexedProblem::cost);
1025  time_indexed_problem.def_readonly("inequality", &TimeIndexedProblem::inequality);
1026  time_indexed_problem.def_readonly("equality", &TimeIndexedProblem::equality);
1027 
1028  py::class_<BoundedTimeIndexedProblem, std::shared_ptr<BoundedTimeIndexedProblem>, PlanningProblem> bounded_time_indexed_problem(prob, "BoundedTimeIndexedProblem");
1029  bounded_time_indexed_problem.def("get_duration", &BoundedTimeIndexedProblem::GetDuration);
1030  bounded_time_indexed_problem.def("update", (void (BoundedTimeIndexedProblem::*)(Eigen::VectorXdRefConst, int)) & BoundedTimeIndexedProblem::Update);
1031  bounded_time_indexed_problem.def("update", (void (BoundedTimeIndexedProblem::*)(Eigen::VectorXdRefConst)) & BoundedTimeIndexedProblem::Update);
1032  bounded_time_indexed_problem.def("set_goal", &BoundedTimeIndexedProblem::SetGoal);
1033  bounded_time_indexed_problem.def("set_rho", &BoundedTimeIndexedProblem::SetRho);
1034  bounded_time_indexed_problem.def("get_goal", &BoundedTimeIndexedProblem::GetGoal);
1035  bounded_time_indexed_problem.def("get_rho", &BoundedTimeIndexedProblem::GetRho);
1036  bounded_time_indexed_problem.def_property("tau", &BoundedTimeIndexedProblem::GetTau, &BoundedTimeIndexedProblem::SetTau);
1037  bounded_time_indexed_problem.def_readwrite("W", &BoundedTimeIndexedProblem::W);
1038  bounded_time_indexed_problem.def_property("initial_trajectory", &BoundedTimeIndexedProblem::GetInitialTrajectory, &BoundedTimeIndexedProblem::SetInitialTrajectory);
1039  bounded_time_indexed_problem.def_property("T", &BoundedTimeIndexedProblem::GetT, &BoundedTimeIndexedProblem::SetT);
1040  bounded_time_indexed_problem.def_readonly("length_Phi", &BoundedTimeIndexedProblem::length_Phi);
1041  bounded_time_indexed_problem.def_readonly("length_jacobian", &BoundedTimeIndexedProblem::length_jacobian);
1042  bounded_time_indexed_problem.def_readonly("num_tasks", &BoundedTimeIndexedProblem::num_tasks);
1043  bounded_time_indexed_problem.def_readonly("Phi", &BoundedTimeIndexedProblem::Phi);
1044  bounded_time_indexed_problem.def_readonly("jacobian", &BoundedTimeIndexedProblem::jacobian);
1045  bounded_time_indexed_problem.def("get_scalar_task_cost", &BoundedTimeIndexedProblem::GetScalarTaskCost);
1046  bounded_time_indexed_problem.def("get_scalar_task_jacobian", &BoundedTimeIndexedProblem::GetScalarTaskJacobian);
1047  bounded_time_indexed_problem.def("get_scalar_transition_cost", &BoundedTimeIndexedProblem::GetScalarTransitionCost);
1048  bounded_time_indexed_problem.def("get_scalar_transition_jacobian", &BoundedTimeIndexedProblem::GetScalarTransitionJacobian);
1049  bounded_time_indexed_problem.def("get_bounds", &BoundedTimeIndexedProblem::GetBounds);
1050  bounded_time_indexed_problem.def_readonly("cost", &BoundedTimeIndexedProblem::cost);
1051 
1052  py::class_<UnconstrainedEndPoseProblem, std::shared_ptr<UnconstrainedEndPoseProblem>, PlanningProblem> unconstrained_end_pose_problem(prob, "UnconstrainedEndPoseProblem");
1053  unconstrained_end_pose_problem.def("update", &UnconstrainedEndPoseProblem::Update);
1054  unconstrained_end_pose_problem.def("set_goal", &UnconstrainedEndPoseProblem::SetGoal);
1055  unconstrained_end_pose_problem.def("set_rho", &UnconstrainedEndPoseProblem::SetRho);
1056  unconstrained_end_pose_problem.def("get_goal", &UnconstrainedEndPoseProblem::GetGoal);
1057  unconstrained_end_pose_problem.def("get_rho", &UnconstrainedEndPoseProblem::GetRho);
1058  unconstrained_end_pose_problem.def_readwrite("W", &UnconstrainedEndPoseProblem::W);
1059  unconstrained_end_pose_problem.def_readonly("length_Phi", &UnconstrainedEndPoseProblem::length_Phi);
1060  unconstrained_end_pose_problem.def_readonly("length_jacobian", &UnconstrainedEndPoseProblem::length_jacobian);
1061  unconstrained_end_pose_problem.def_readonly("num_tasks", &UnconstrainedEndPoseProblem::num_tasks);
1062  unconstrained_end_pose_problem.def_readonly("Phi", &UnconstrainedEndPoseProblem::Phi);
1063  unconstrained_end_pose_problem.def_readonly("jacobian", &UnconstrainedEndPoseProblem::jacobian);
1064  unconstrained_end_pose_problem.def_property_readonly("ydiff", [](UnconstrainedEndPoseProblem* prob) { return prob->cost.ydiff; });
1065  unconstrained_end_pose_problem.def_property("q_nominal", &UnconstrainedEndPoseProblem::GetNominalPose, &UnconstrainedEndPoseProblem::SetNominalPose);
1066  unconstrained_end_pose_problem.def("get_scalar_cost", &UnconstrainedEndPoseProblem::GetScalarCost);
1067  unconstrained_end_pose_problem.def("get_scalar_jacobian", &UnconstrainedEndPoseProblem::GetScalarJacobian);
1068  unconstrained_end_pose_problem.def("get_hessian", &UnconstrainedEndPoseProblem::GetHessian);
1069  unconstrained_end_pose_problem.def("get_scalar_task_cost", &UnconstrainedEndPoseProblem::GetScalarTaskCost);
1070  unconstrained_end_pose_problem.def_readonly("cost", &UnconstrainedEndPoseProblem::cost);
1071 
1072  py::class_<EndPoseProblem, std::shared_ptr<EndPoseProblem>, PlanningProblem> end_pose_problem(prob, "EndPoseProblem");
1073  end_pose_problem.def("update", &EndPoseProblem::Update);
1074  end_pose_problem.def("pre_update", &EndPoseProblem::PreUpdate);
1075  end_pose_problem.def("set_goal", &EndPoseProblem::SetGoal);
1076  end_pose_problem.def("set_rho", &EndPoseProblem::SetRho);
1077  end_pose_problem.def("get_goal", &EndPoseProblem::GetGoal);
1078  end_pose_problem.def("get_rho", &EndPoseProblem::GetRho);
1079  end_pose_problem.def("set_goal_eq", &EndPoseProblem::SetGoalEQ);
1080  end_pose_problem.def("set_rho_eq", &EndPoseProblem::SetRhoEQ);
1081  end_pose_problem.def("get_goal_eq", &EndPoseProblem::GetGoalEQ);
1082  end_pose_problem.def("get_rho_eq", &EndPoseProblem::GetRhoEQ);
1083  end_pose_problem.def("set_goal_neq", &EndPoseProblem::SetGoalNEQ);
1084  end_pose_problem.def("set_rho_neq", &EndPoseProblem::SetRhoNEQ);
1085  end_pose_problem.def("get_goal_neq", &EndPoseProblem::GetGoalNEQ);
1086  end_pose_problem.def("get_rho_neq", &EndPoseProblem::GetRhoNEQ);
1087  end_pose_problem.def_readwrite("W", &EndPoseProblem::W);
1088  end_pose_problem.def_readwrite("use_bounds", &EndPoseProblem::use_bounds);
1089  end_pose_problem.def_readonly("length_Phi", &EndPoseProblem::length_Phi);
1090  end_pose_problem.def_readonly("length_jacobian", &EndPoseProblem::length_jacobian);
1091  end_pose_problem.def_readonly("num_tasks", &EndPoseProblem::num_tasks);
1092  end_pose_problem.def_readonly("Phi", &EndPoseProblem::Phi);
1093  end_pose_problem.def_readonly("jacobian", &EndPoseProblem::jacobian);
1094  end_pose_problem.def("get_scalar_cost", &EndPoseProblem::GetScalarCost);
1095  end_pose_problem.def("get_scalar_jacobian", &EndPoseProblem::GetScalarJacobian);
1096  end_pose_problem.def("get_scalar_task_cost", &EndPoseProblem::GetScalarTaskCost);
1097  end_pose_problem.def("get_equality", &EndPoseProblem::GetEquality);
1098  end_pose_problem.def("get_equality_jacobian", &EndPoseProblem::GetEqualityJacobian);
1099  end_pose_problem.def("get_inequality", &EndPoseProblem::GetInequality);
1100  end_pose_problem.def("get_inequality_jacobian", &EndPoseProblem::GetInequalityJacobian);
1101  end_pose_problem.def("get_bounds", &EndPoseProblem::GetBounds);
1102  end_pose_problem.def_readonly("cost", &EndPoseProblem::cost);
1103  end_pose_problem.def_readonly("inequality", &EndPoseProblem::inequality);
1104  end_pose_problem.def_readonly("equality", &EndPoseProblem::equality);
1105 
1106  py::class_<BoundedEndPoseProblem, std::shared_ptr<BoundedEndPoseProblem>, PlanningProblem> bounded_end_pose_problem(prob, "BoundedEndPoseProblem");
1107  bounded_end_pose_problem.def("update", &BoundedEndPoseProblem::Update);
1108  bounded_end_pose_problem.def("set_goal", &BoundedEndPoseProblem::SetGoal);
1109  bounded_end_pose_problem.def("set_rho", &BoundedEndPoseProblem::SetRho);
1110  bounded_end_pose_problem.def("get_goal", &BoundedEndPoseProblem::GetGoal);
1111  bounded_end_pose_problem.def("get_rho", &BoundedEndPoseProblem::GetRho);
1112  bounded_end_pose_problem.def_readwrite("W", &BoundedEndPoseProblem::W);
1113  bounded_end_pose_problem.def_readonly("length_Phi", &BoundedEndPoseProblem::length_Phi);
1114  bounded_end_pose_problem.def_readonly("length_jacobian", &BoundedEndPoseProblem::length_jacobian);
1115  bounded_end_pose_problem.def_readonly("num_tasks", &BoundedEndPoseProblem::num_tasks);
1116  bounded_end_pose_problem.def_readonly("Phi", &BoundedEndPoseProblem::Phi);
1117  bounded_end_pose_problem.def_readonly("jacobian", &BoundedEndPoseProblem::jacobian);
1118  bounded_end_pose_problem.def("get_scalar_cost", &BoundedEndPoseProblem::GetScalarCost);
1119  bounded_end_pose_problem.def("get_scalar_jacobian", &BoundedEndPoseProblem::GetScalarJacobian);
1120  bounded_end_pose_problem.def("get_scalar_task_cost", &BoundedEndPoseProblem::GetScalarTaskCost);
1121  bounded_end_pose_problem.def("get_bounds", &BoundedEndPoseProblem::GetBounds);
1122  bounded_end_pose_problem.def_readonly("cost", &BoundedEndPoseProblem::cost);
1123 
1124  py::class_<SamplingProblem, std::shared_ptr<SamplingProblem>, PlanningProblem> sampling_problem(prob, "SamplingProblem");
1125  sampling_problem.def("update", &SamplingProblem::Update);
1126  sampling_problem.def_property("goal_state", &SamplingProblem::GetGoalState, &SamplingProblem::SetGoalState);
1127  sampling_problem.def("get_space_dim", &SamplingProblem::GetSpaceDim);
1128  sampling_problem.def("get_bounds", &SamplingProblem::GetBounds);
1129  sampling_problem.def_readonly("num_tasks", &SamplingProblem::num_tasks);
1130  sampling_problem.def_readonly("Phi", &SamplingProblem::Phi);
1131  sampling_problem.def_readonly("inequality", &SamplingProblem::inequality);
1132  sampling_problem.def_readonly("equality", &SamplingProblem::equality);
1133  sampling_problem.def("set_goal_eq", &SamplingProblem::SetGoalEQ);
1134  sampling_problem.def("set_rho_eq", &SamplingProblem::SetRhoEQ);
1135  sampling_problem.def("get_goal_eq", &SamplingProblem::GetGoalEQ);
1136  sampling_problem.def("get_rho_eq", &SamplingProblem::GetRhoEQ);
1137  sampling_problem.def("set_goal_neq", &SamplingProblem::SetGoalNEQ);
1138  sampling_problem.def("set_rho_neq", &SamplingProblem::SetRhoNEQ);
1139  sampling_problem.def("get_goal_neq", &SamplingProblem::GetGoalNEQ);
1140  sampling_problem.def("get_rho_neq", &SamplingProblem::GetRhoNEQ);
1141  sampling_problem.def("is_state_valid", &SamplingProblem::IsStateValid);
1142 
1143  py::class_<TimeIndexedSamplingProblem, std::shared_ptr<TimeIndexedSamplingProblem>, PlanningProblem> time_indexed_sampling_problem(prob, "TimeIndexedSamplingProblem");
1144  time_indexed_sampling_problem.def("update", &TimeIndexedSamplingProblem::Update);
1145  time_indexed_sampling_problem.def("get_space_dim", &TimeIndexedSamplingProblem::GetSpaceDim);
1146  time_indexed_sampling_problem.def("get_bounds", &TimeIndexedSamplingProblem::GetBounds);
1147  time_indexed_sampling_problem.def_property("goal_state", &TimeIndexedSamplingProblem::GetGoalState, &TimeIndexedSamplingProblem::SetGoalState);
1148  time_indexed_sampling_problem.def_property("goal_time", &TimeIndexedSamplingProblem::GetGoalTime, &TimeIndexedSamplingProblem::SetGoalTime);
1149  time_indexed_sampling_problem.def_readonly("num_tasks", &TimeIndexedSamplingProblem::num_tasks);
1150  time_indexed_sampling_problem.def_readonly("Phi", &TimeIndexedSamplingProblem::Phi);
1151  time_indexed_sampling_problem.def_readonly("inequality", &TimeIndexedSamplingProblem::inequality);
1152  time_indexed_sampling_problem.def_readonly("equality", &TimeIndexedSamplingProblem::equality);
1153  time_indexed_sampling_problem.def("set_goal_eq", &TimeIndexedSamplingProblem::SetGoalEQ);
1154  time_indexed_sampling_problem.def("set_rho_eq", &TimeIndexedSamplingProblem::SetRhoEQ);
1155  time_indexed_sampling_problem.def("get_goal_eq", &TimeIndexedSamplingProblem::GetGoalEQ);
1156  time_indexed_sampling_problem.def("get_rho_eq", &TimeIndexedSamplingProblem::GetRhoEQ);
1157  time_indexed_sampling_problem.def("set_goal_neq", &TimeIndexedSamplingProblem::SetGoalNEQ);
1158  time_indexed_sampling_problem.def("set_rho_neq", &TimeIndexedSamplingProblem::SetRhoNEQ);
1159  time_indexed_sampling_problem.def("get_goal_neq", &TimeIndexedSamplingProblem::GetGoalNEQ);
1160  time_indexed_sampling_problem.def("get_rho_neq", &TimeIndexedSamplingProblem::GetRhoNEQ);
1161  time_indexed_sampling_problem.def("is_valid", (bool (TimeIndexedSamplingProblem::*)(Eigen::VectorXdRefConst, const double&)) & TimeIndexedSamplingProblem::IsValid);
1162 
1163  py::enum_<ControlCostLossTermType>(module, "ControlCostLossTermType")
1164  // BimodalHuber = 3, SuperHuber = 4, <-- skipped as not actively used right now.
1165  .value("Undefined", ControlCostLossTermType::Undefined)
1166  .value("L2", ControlCostLossTermType::L2)
1167  .value("SmoothL1", ControlCostLossTermType::SmoothL1)
1168  .value("Huber", ControlCostLossTermType::Huber)
1169  .value("PseudoHuber", ControlCostLossTermType::PseudoHuber)
1170  .export_values();
1171 
1172  py::class_<DynamicTimeIndexedShootingProblem, std::shared_ptr<DynamicTimeIndexedShootingProblem>, PlanningProblem>(prob, "DynamicTimeIndexedShootingProblem")
1175  .def("update_terminal_state", &DynamicTimeIndexedShootingProblem::UpdateTerminalState)
1176  .def_property("X", static_cast<const Eigen::MatrixXd& (DynamicTimeIndexedShootingProblem::*)(void)const>(&DynamicTimeIndexedShootingProblem::get_X), &DynamicTimeIndexedShootingProblem::set_X)
1177  .def_property("U", static_cast<const Eigen::MatrixXd& (DynamicTimeIndexedShootingProblem::*)(void)const>(&DynamicTimeIndexedShootingProblem::get_U), &DynamicTimeIndexedShootingProblem::set_U)
1179  .def_property_readonly("tau", &DynamicTimeIndexedShootingProblem::get_tau)
1185  .def_readonly("Phi", &DynamicTimeIndexedShootingProblem::Phi)
1186  .def_readonly("dPhi_dx", &DynamicTimeIndexedShootingProblem::dPhi_dx)
1187  .def_readonly("cost", &DynamicTimeIndexedShootingProblem::cost)
1188  .def("get_state_cost", &DynamicTimeIndexedShootingProblem::GetStateCost)
1189  .def("get_state_cost_jacobian", &DynamicTimeIndexedShootingProblem::GetStateCostJacobian)
1190  .def("get_state_cost_hessian", &DynamicTimeIndexedShootingProblem::GetStateCostHessian)
1191  .def("get_control_cost", &DynamicTimeIndexedShootingProblem::GetControlCost)
1192  .def("get_control_cost_jacobian", &DynamicTimeIndexedShootingProblem::GetControlCostJacobian)
1193  .def("get_control_cost_hessian", &DynamicTimeIndexedShootingProblem::GetControlCostHessian)
1194  .def("get_state_cost_hessian", &DynamicTimeIndexedShootingProblem::GetStateControlCostHessian);
1195 
1196  py::class_<CollisionProxy, std::shared_ptr<CollisionProxy>> collision_proxy(module, "CollisionProxy");
1197  collision_proxy.def(py::init());
1198  collision_proxy.def_readonly("contact_1", &CollisionProxy::contact1);
1199  collision_proxy.def_readonly("contact_2", &CollisionProxy::contact2);
1200  collision_proxy.def_readonly("normal_1", &CollisionProxy::normal1);
1201  collision_proxy.def_readonly("normal_2", &CollisionProxy::normal2);
1202  collision_proxy.def_readonly("distance", &CollisionProxy::distance);
1203  collision_proxy.def_property_readonly("object_1", [](CollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e1->segment.getName() : std::string(""); });
1204  collision_proxy.def_property_readonly("object_2", [](CollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e2->segment.getName() : std::string(""); });
1205  collision_proxy.def_property_readonly("transform_1", [](CollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e1->frame : KDL::Frame(); });
1206  collision_proxy.def_property_readonly("transform_2", [](CollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e2->frame : KDL::Frame(); });
1207  collision_proxy.def("__repr__", &CollisionProxy::Print);
1208 
1209  py::class_<ContinuousCollisionProxy, std::shared_ptr<ContinuousCollisionProxy>> continuous_collision_proxy(module, "ContinuousCollisionProxy");
1210  continuous_collision_proxy.def(py::init());
1211  continuous_collision_proxy.def_readonly("contact_transform_1", &ContinuousCollisionProxy::contact_tf1);
1212  continuous_collision_proxy.def_readonly("contact_transform_2", &ContinuousCollisionProxy::contact_tf2);
1213  continuous_collision_proxy.def_readonly("in_collision", &ContinuousCollisionProxy::in_collision);
1214  continuous_collision_proxy.def_readonly("time_of_contact", &ContinuousCollisionProxy::time_of_contact);
1215  continuous_collision_proxy.def_property_readonly("object_1", [](ContinuousCollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e1->segment.getName() : std::string(""); });
1216  continuous_collision_proxy.def_property_readonly("object_2", [](ContinuousCollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e2->segment.getName() : std::string(""); });
1217  continuous_collision_proxy.def_property_readonly("transform_1", [](ContinuousCollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e1->frame : KDL::Frame(); });
1218  continuous_collision_proxy.def_property_readonly("transform_2", [](ContinuousCollisionProxy* instance) { return (instance->e1 && instance->e2) ? instance->e2->frame : KDL::Frame(); });
1219  continuous_collision_proxy.def("__repr__", &ContinuousCollisionProxy::Print);
1220 
1221  py::class_<Scene, std::shared_ptr<Scene>, Object> scene(module, "Scene");
1222  scene.def_property_readonly("num_positions", &Scene::get_num_positions);
1223  scene.def_property_readonly("num_velocities", &Scene::get_num_velocities);
1224  scene.def_property_readonly("num_controls", &Scene::get_num_controls);
1225  scene.def_property_readonly("num_state", &Scene::get_num_state);
1226  scene.def_property_readonly("num_state_derivative", &Scene::get_num_state_derivative);
1227  scene.def_property_readonly("has_quaternion_floating_base", &Scene::get_has_quaternion_floating_base);
1228  scene.def("update", &Scene::Update, py::arg("x"), py::arg("t") = 0.0);
1229  scene.def("get_controlled_joint_names", (std::vector<std::string>(Scene::*)()) & Scene::GetControlledJointNames);
1230  scene.def("get_controlled_link_names", &Scene::GetControlledLinkNames);
1231  scene.def("get_model_link_names", &Scene::GetModelLinkNames);
1232  scene.def("get_kinematic_tree", &Scene::GetKinematicTree, py::return_value_policy::reference_internal);
1233  scene.def("get_collision_scene", &Scene::GetCollisionScene, py::return_value_policy::reference_internal);
1234  scene.def("get_dynamics_solver", &Scene::GetDynamicsSolver, py::return_value_policy::reference_internal);
1235  scene.def("get_model_joint_names", &Scene::GetModelJointNames);
1236  scene.def("get_model_state", &Scene::GetModelState);
1237  scene.def("get_model_state_map", &Scene::GetModelStateMap);
1238  scene.def("get_tree_names", [](Scene& scene) {
1239  std::vector<std::string> frame_names;
1240  for (const auto& m : scene.GetTreeMap())
1241  {
1242  frame_names.push_back(m.first);
1243  }
1244  return frame_names;
1245  });
1246  scene.def("set_model_state", (void (Scene::*)(Eigen::VectorXdRefConst, double, bool)) & Scene::SetModelState, py::arg("x"), py::arg("t") = 0.0, py::arg("update_trajectory") = false);
1247  scene.def("set_model_state_map", (void (Scene::*)(const std::map<std::string, double>&, double, bool)) & Scene::SetModelState, py::arg("x"), py::arg("t") = 0.0, py::arg("update_trajectory") = false);
1248  scene.def("get_controlled_state", &Scene::GetControlledState);
1249  scene.def("publish_scene", &Scene::PublishScene);
1250  scene.def("publish_proxies", &Scene::PublishProxies);
1251  scene.def("update_planning_scene", &Scene::UpdatePlanningScene);
1252  scene.def("load_scene",
1253  (void (Scene::*)(const std::string&, const KDL::Frame&, bool)) & Scene::LoadScene,
1254  py::arg("scene_string"),
1255  py::arg("offset_transform") = kdl_frame(),
1256  py::arg("update_collision_scene") = true);
1257  scene.def("load_scene_file",
1258  (void (Scene::*)(const std::string&, const KDL::Frame&, bool)) & Scene::LoadSceneFile,
1259  py::arg("file_name"),
1260  py::arg("offset_transform") = kdl_frame(),
1261  py::arg("update_collision_scene") = true);
1262  scene.def("get_scene", &Scene::GetScene);
1263  scene.def("clean_scene", &Scene::CleanScene);
1264  scene.def("is_state_valid", [](Scene* instance, bool self, double safe_distance) { return instance->GetCollisionScene()->IsStateValid(self, safe_distance); }, py::arg("check_self_collision") = true, py::arg("safe_distance") = 0.0);
1265  scene.def("is_collision_free", [](Scene* instance, const std::string& o1, const std::string& o2, double safe_distance) { return instance->GetCollisionScene()->IsCollisionFree(o1, o2, safe_distance); }, py::arg("object_1"), py::arg("object_2"), py::arg("safe_distance") = 0.0);
1266  scene.def("is_allowed_to_collide", [](Scene* instance, const std::string& o1, const std::string& o2, bool self) { return instance->GetCollisionScene()->IsAllowedToCollide(o1, o2, self); }, py::arg("object_1"), py::arg("object_2"), py::arg("check_self_collision") = true);
1267  scene.def("get_collision_distance", [](Scene* instance, bool self) { return instance->GetCollisionScene()->GetCollisionDistance(self); }, py::arg("check_self_collision") = true);
1268  scene.def("get_collision_distance", [](Scene* instance, const std::string& o1, const std::string& o2) { return instance->GetCollisionScene()->GetCollisionDistance(o1, o2); }, py::arg("object_1"), py::arg("object_2"));
1269  scene.def("get_collision_distance",
1270  [](Scene* instance, const std::string& o1, const bool& self) {
1271  return instance->GetCollisionScene()->GetCollisionDistance(o1, self);
1272  },
1273  py::arg("object_1"), py::arg("check_self_collision") = true);
1274  scene.def("get_collision_distance",
1275  [](Scene* instance, const std::vector<std::string>& objects, const bool& self) {
1276  return instance->GetCollisionScene()->GetCollisionDistance(objects, self);
1277  },
1278  py::arg("objects"), py::arg("check_self_collision") = true);
1279  scene.def("update_planning_scene_world",
1280  [](Scene* instance, moveit_msgs::PlanningSceneWorld& world) {
1281  moveit_msgs::PlanningSceneWorldConstPtr my_ptr(
1282  new moveit_msgs::PlanningSceneWorld(world));
1283  instance->UpdatePlanningSceneWorld(my_ptr);
1284  });
1285  scene.def("update_collision_objects", &Scene::UpdateCollisionObjects);
1286  scene.def("get_collision_robot_links", [](Scene* instance) { return instance->GetCollisionScene()->GetCollisionRobotLinks(); });
1287  scene.def("get_collision_world_links", [](Scene* instance) { return instance->GetCollisionScene()->GetCollisionWorldLinks(); });
1288  scene.def("get_root_frame_name", &Scene::GetRootFrameName);
1289  scene.def("get_root_joint_name", &Scene::GetRootJointName);
1290  scene.def("attach_object", &Scene::AttachObject);
1291  scene.def("attach_object_local", (void (Scene::*)(const std::string& name, const std::string& parent, const KDL::Frame& pose)) & Scene::AttachObjectLocal);
1292  scene.def("attach_object_local", (void (Scene::*)(const std::string& name, const std::string& parent, const Eigen::VectorXd& pose)) & Scene::AttachObjectLocal);
1293  scene.def("detach_object", &Scene::DetachObject);
1294  scene.def("has_attached_object", &Scene::HasAttachedObject);
1295  scene.def("fk", [](Scene* instance, const std::string& e1, const KDL::Frame& o1, const std::string& e2, const KDL::Frame& o2) { return instance->GetKinematicTree().FK(e1, o1, e2, o2); });
1296  scene.def("fk", [](Scene* instance, const std::string& e1, const std::string& e2) { return instance->GetKinematicTree().FK(e1, KDL::Frame(), e2, KDL::Frame()); });
1297  scene.def("fk", [](Scene* instance, const std::string& e1) { return instance->GetKinematicTree().FK(e1, KDL::Frame(), "", KDL::Frame()); });
1298  scene.def("jacobian", [](Scene* instance, const std::string& e1, const KDL::Frame& o1, const std::string& e2, const KDL::Frame& o2) { return instance->GetKinematicTree().Jacobian(e1, o1, e2, o2); });
1299  scene.def("jacobian", [](Scene* instance, const std::string& e1, const std::string& e2) { return instance->GetKinematicTree().Jacobian(e1, KDL::Frame(), e2, KDL::Frame()); });
1300  scene.def("jacobian", [](Scene* instance, const std::string& e1) { return instance->GetKinematicTree().Jacobian(e1, KDL::Frame(), "", KDL::Frame()); });
1301  scene.def("hessian", [](Scene* instance, const std::string& e1, const KDL::Frame& o1, const std::string& e2, const KDL::Frame& o2) { return instance->GetKinematicTree().Hessian(e1, o1, e2, o2); });
1302  scene.def("hessian", [](Scene* instance, const std::string& e1, const std::string& e2) { return instance->GetKinematicTree().Hessian(e1, KDL::Frame(), e2, KDL::Frame()); });
1303  scene.def("hessian", [](Scene* instance, const std::string& e1) { return instance->GetKinematicTree().Hessian(e1, KDL::Frame(), "", KDL::Frame()); });
1304  scene.def("add_trajectory_from_file", &Scene::AddTrajectoryFromFile);
1305  scene.def("add_trajectory", (void (Scene::*)(const std::string&, const std::string&)) & Scene::AddTrajectory);
1306  scene.def("add_trajectory_from_array",
1307  [](Scene* instance, const std::string& link, const Eigen::MatrixXd& data, double radius) {
1308  instance->AddTrajectory(link, std::shared_ptr<Trajectory>(new Trajectory(data, radius)));
1309  },
1310  py::arg("link"), py::arg("data"), py::arg("radius"));
1311  scene.def("get_trajectory", [](Scene* instance, const std::string& link) { return instance->GetTrajectory(link)->ToString(); });
1312  scene.def("remove_trajectory", &Scene::RemoveTrajectory);
1313  scene.def("update_scene_frames", &Scene::UpdateSceneFrames);
1314  scene.def("add_object", [](Scene* instance, const std::string& name, const KDL::Frame& transform, const std::string& parent, const std::string& shape_resource_path, const Eigen::Vector3d scale, const Eigen::Vector4d color, const bool update_collision_scene) { instance->AddObject(name, transform, parent, shape_resource_path, scale, KDL::RigidBodyInertia::Zero(), color, update_collision_scene); },
1315  py::arg("name"),
1316  py::arg("transform") = KDL::Frame(),
1317  py::arg("parent") = "",
1318  py::arg("shape_resource_path"),
1319  py::arg("scale") = Eigen::Vector3d::Ones(),
1320  py::arg("color") = Eigen::Vector4d(0.5, 0.5, 0.5, 1.0),
1321  py::arg("update_collision_scene") = true);
1322  scene.def("add_object", (void (Scene::*)(const std::string&, const KDL::Frame&, const std::string&, shapes::ShapeConstPtr, const KDL::RigidBodyInertia&, const Eigen::Vector4d&, const bool)) & Scene::AddObject,
1323  py::arg("name"),
1324  py::arg("transform") = KDL::Frame(),
1325  py::arg("parent") = std::string(),
1326  py::arg("shape"),
1327  py::arg("inertia") = KDL::RigidBodyInertia::Zero(),
1328  py::arg("color") = Eigen::Vector4d(0.5, 0.5, 0.5, 1.0),
1329  py::arg("update_collision_scene") = true);
1330  scene.def("add_object_to_environment", &Scene::AddObjectToEnvironment,
1331  py::arg("name"),
1332  py::arg("transform") = KDL::Frame(),
1333  py::arg("shape"),
1334  py::arg("color") = Eigen::Vector4d(0.5, 0.5, 0.5, 1.0),
1335  py::arg("update_collision_scene") = true);
1336  scene.def("remove_object", &Scene::RemoveObject);
1337  scene.def_property_readonly("model_link_to_collision_link_map", &Scene::GetModelLinkToCollisionLinkMap);
1338  scene.def_property_readonly("controlled_joint_to_collision_link_map", &Scene::GetControlledJointToCollisionLinkMap);
1339  scene.def_property_readonly("world_links_to_exclude_from_collision_scene", &Scene::get_world_links_to_exclude_from_collision_scene);
1340 
1341  py::class_<CollisionScene, std::shared_ptr<CollisionScene>> collision_scene(module, "CollisionScene");
1342  // TODO: expose IsStateValid, IsCollisionFree, GetCollisionDistance, GetCollisionWorldLinks, GetCollisionRobotLinks, GetTranslation
1343  collision_scene.def_property("always_externally_updated_collision_scene", &CollisionScene::GetAlwaysExternallyUpdatedCollisionScene, &CollisionScene::SetAlwaysExternallyUpdatedCollisionScene);
1344  collision_scene.def_property("replace_primitive_shapes_with_meshes", &CollisionScene::GetReplacePrimitiveShapesWithMeshes, &CollisionScene::SetReplacePrimitiveShapesWithMeshes);
1345  collision_scene.def_property("replace_cylinders_with_capsules", &CollisionScene::get_replace_cylinders_with_capsules, &CollisionScene::set_replace_cylinders_with_capsules);
1346  collision_scene.def_property("robot_link_scale", &CollisionScene::GetRobotLinkScale, &CollisionScene::SetRobotLinkScale);
1347  collision_scene.def_property("world_link_scale", &CollisionScene::GetWorldLinkScale, &CollisionScene::SetWorldLinkScale);
1348  collision_scene.def_property("robot_link_padding", &CollisionScene::GetRobotLinkPadding, &CollisionScene::SetRobotLinkPadding);
1349  collision_scene.def_property("world_link_padding", &CollisionScene::GetWorldLinkPadding, &CollisionScene::SetWorldLinkPadding);
1350  collision_scene.def("update_collision_object_transforms", &CollisionScene::UpdateCollisionObjectTransforms);
1351  collision_scene.def("continuous_collision_check", &CollisionScene::ContinuousCollisionCheck);
1352  collision_scene.def("get_robot_to_robot_collision_distance", &CollisionScene::GetRobotToRobotCollisionDistance);
1353  collision_scene.def("get_robot_to_world_collision_distance", &CollisionScene::GetRobotToWorldCollisionDistance);
1354  collision_scene.def("get_translation", &CollisionScene::GetTranslation);
1355 
1356  py::class_<VisualizationMoveIt> visualization_moveit(module, "VisualizationMoveIt");
1357  visualization_moveit.def(py::init<ScenePtr>());
1358  visualization_moveit.def("display_trajectory", &VisualizationMoveIt::DisplayTrajectory);
1359 #ifdef MSGPACK_FOUND
1360  py::class_<VisualizationMeshcat> visualization_meshcat(module, "VisualizationMeshcat");
1361  visualization_meshcat.def(py::init<ScenePtr, const std::string&, bool, const std::string&>(), py::arg("scene"), py::arg("url"), py::arg("use_mesh_materials") = true, py::arg("file_url") = "");
1362  visualization_meshcat.def("display_scene", &VisualizationMeshcat::DisplayScene, py::arg("use_mesh_materials") = true);
1363  visualization_meshcat.def("display_state", &VisualizationMeshcat::DisplayState, py::arg("state"), py::arg("t") = 0.0);
1364  visualization_meshcat.def("display_trajectory", &VisualizationMeshcat::DisplayTrajectory, py::arg("trajectory"), py::arg("dt") = 1.0);
1365  visualization_meshcat.def("get_web_url", &VisualizationMeshcat::GetWebURL);
1366  visualization_meshcat.def("get_file_url", &VisualizationMeshcat::GetFileURL);
1367  visualization_meshcat.def("delete", &VisualizationMeshcat::Delete, py::arg("path") = "");
1368  visualization_meshcat.def("set_property", py::overload_cast<const std::string&, const std::string&, const double&>(&VisualizationMeshcat::SetProperty), py::arg("path"), py::arg("property"), py::arg("value"));
1369  visualization_meshcat.def("set_property", py::overload_cast<const std::string&, const std::string&, const std::string&>(&VisualizationMeshcat::SetProperty), py::arg("path"), py::arg("property"), py::arg("value"));
1370  visualization_meshcat.def("set_property", py::overload_cast<const std::string&, const std::string&, const bool&>(&VisualizationMeshcat::SetProperty), py::arg("path"), py::arg("property"), py::arg("value"));
1371  visualization_meshcat.def("set_property", py::overload_cast<const std::string&, const std::string&, const Eigen::Vector3d&>(&VisualizationMeshcat::SetProperty), py::arg("path"), py::arg("property"), py::arg("value"));
1372  visualization_meshcat.def("set_property", py::overload_cast<const std::string&, const std::string&, const Eigen::Vector4d&>(&VisualizationMeshcat::SetProperty), py::arg("path"), py::arg("property"), py::arg("value"));
1373 #endif
1374 
1375  py::module kin = module.def_submodule("Kinematics", "Kinematics submodule.");
1376  py::class_<KinematicTree, std::shared_ptr<KinematicTree>> kinematic_tree(kin, "KinematicTree");
1377  kinematic_tree.def_readwrite("debug_mode", &KinematicTree::debug);
1378  kinematic_tree.def("publish_frames", &KinematicTree::PublishFrames, py::arg("tf_prefix") = "exotica");
1379  kinematic_tree.def("get_root_frame_name", &KinematicTree::GetRootFrameName);
1380  kinematic_tree.def("get_root_joint_name", &KinematicTree::GetRootJointName);
1381  kinematic_tree.def("get_kinematic_chain", &KinematicTree::GetKinematicChain);
1382  kinematic_tree.def("get_kinematic_chain_links", &KinematicTree::GetKinematicChainLinks);
1383  kinematic_tree.def("get_model_base_type", &KinematicTree::GetModelBaseType);
1384  kinematic_tree.def("get_controlled_base_type", &KinematicTree::GetControlledBaseType);
1385  kinematic_tree.def("get_controlled_link_mass", &KinematicTree::GetControlledLinkMass);
1386  kinematic_tree.def("get_collision_object_types", &KinematicTree::GetCollisionObjectTypes);
1387  kinematic_tree.def("set_seed", &KinematicTree::SetSeed);
1388  kinematic_tree.def("get_random_controlled_state", &KinematicTree::GetRandomControlledState);
1389  kinematic_tree.def("get_num_model_joints", &KinematicTree::GetNumModelJoints);
1390  kinematic_tree.def("get_num_controlled_joints", &KinematicTree::GetNumControlledJoints);
1391  kinematic_tree.def("find_kinematic_element_by_name", &KinematicTree::FindKinematicElementByName);
1392 
1393  // joints and links that describe the full state of the robot
1394  kinematic_tree.def("get_model_link_names", &KinematicTree::GetModelLinkNames);
1395  kinematic_tree.def("get_model_joint_names", &KinematicTree::GetModelJointNames);
1396 
1397  // subset of model joints and links that can be controlled
1398  kinematic_tree.def("get_controlled_link_names", &KinematicTree::GetControlledLinkNames);
1399  kinematic_tree.def("get_controlled_joint_names", &KinematicTree::GetControlledJointNames);
1400 
1401  // Joint Limits
1402  kinematic_tree.def("get_joint_limits", &KinematicTree::GetJointLimits);
1403  kinematic_tree.def("reset_joint_limits", &KinematicTree::ResetJointLimits);
1404  kinematic_tree.def("set_joint_limits_lower", &KinematicTree::SetJointLimitsLower);
1405  kinematic_tree.def("set_joint_limits_upper", &KinematicTree::SetJointLimitsUpper);
1406  kinematic_tree.def("set_joint_velocity_limits", &KinematicTree::SetJointVelocityLimits);
1407  kinematic_tree.def("set_joint_acceleration_limits", &KinematicTree::SetJointAccelerationLimits);
1408  kinematic_tree.def("get_velocity_limits", &KinematicTree::GetVelocityLimits);
1409  kinematic_tree.def("has_acceleration_limits", &KinematicTree::HasAccelerationLimits);
1410  kinematic_tree.def("get_acceleration_limits", &KinematicTree::GetAccelerationLimits);
1411  kinematic_tree.def("set_floating_base_limits_pos_xyz_euler_zyx", (void (KinematicTree::*)(const std::vector<double>&, const std::vector<double>&)) & KinematicTree::SetFloatingBaseLimitsPosXYZEulerZYX);
1412  kinematic_tree.def("set_floating_base_limits_pos_xyz_euler_zyx", (void (KinematicTree::*)(const std::vector<double>&, const std::vector<double>&, const std::vector<double>&, const std::vector<double>&)) & KinematicTree::SetFloatingBaseLimitsPosXYZEulerZYX);
1413  kinematic_tree.def("set_planar_base_limits_pos_xy_euler_z", (void (KinematicTree::*)(const std::vector<double>&, const std::vector<double>&)) & KinematicTree::SetPlanarBaseLimitsPosXYEulerZ);
1414  kinematic_tree.def("set_planar_base_limits_pos_xy_euler_z", (void (KinematicTree::*)(const std::vector<double>&, const std::vector<double>&, const std::vector<double>&, const std::vector<double>&)) & KinematicTree::SetPlanarBaseLimitsPosXYEulerZ);
1415  kinematic_tree.def("get_used_joint_limits", &KinematicTree::GetUsedJointLimits);
1416 
1417  // Get full tree
1418  kinematic_tree.def("get_model_tree", &KinematicTree::GetModelTree);
1419  kinematic_tree.def("get_tree", [](KinematicTree* kt) {
1420  auto tree_weak_ptr = kt->GetTree();
1421  std::vector<std::shared_ptr<KinematicElement>> tree_shared_ptr;
1422  tree_shared_ptr.reserve(tree_weak_ptr.size());
1423  for (auto e : tree_weak_ptr)
1424  tree_shared_ptr.emplace_back(e.lock());
1425  return tree_shared_ptr;
1426  });
1427 
1428  // KinematicElement
1429  py::class_<KinematicElement, std::shared_ptr<KinematicElement>> kinematic_element(kin, "KinematicElement");
1430  kinematic_element.def("get_pose", &KinematicElement::GetPose);
1431  kinematic_element.def_readonly("id", &KinematicElement::id);
1432  kinematic_element.def("get_segment_name", [](KinematicElement* element) { return element->segment.getName(); });
1433  kinematic_element.def("get_joint_name", [](KinematicElement* element) { return element->segment.getJoint().getName(); });
1434  kinematic_element.def("get_parent_name", [](KinematicElement* element) { auto parent = element->parent.lock(); if (parent) { return parent->segment.getName(); } else { return std::string("no_parent"); } });
1435  kinematic_element.def("get_mass", [](KinematicElement* element) { return element->segment.getInertia().getMass(); });
1436  kinematic_element.def_readonly("control_id", &KinematicElement::control_id);
1437  kinematic_element.def_readonly("is_controlled", &KinematicElement::is_controlled);
1438  kinematic_element.def_readonly("parent_name", &KinematicElement::parent_name);
1439  kinematic_element.def_readonly("joint_limits", &KinematicElement::joint_limits);
1440  kinematic_element.def_readonly("is_robot_link", &KinematicElement::is_robot_link);
1441  kinematic_element.def_readonly("shape", &KinematicElement::shape);
1442 
1443  // TODO: KinematicRequestFlags
1444 
1445  // TODO: KinematicFrame
1446 
1447  // KinematicResponse
1448  py::class_<KinematicResponse, std::shared_ptr<KinematicResponse>> kinematic_response(kin, "KinematicResponse");
1449  kinematic_response.def_property_readonly("Phi", [](KinematicResponse* instance) {
1450  std::vector<KDL::Frame> vec;
1451  for (unsigned int i = 0; i < instance->Phi.cols(); ++i)
1452  vec.push_back(instance->Phi(i));
1453  return vec;
1454  });
1455 
1456  py::enum_<Integrator>(module, "Integrator")
1457  .value("RK1", Integrator::RK1)
1458  .value("SymplecticEuler", Integrator::SymplecticEuler)
1459  .value("RK2", Integrator::RK2)
1460  .value("RK4", Integrator::RK4)
1461  .export_values();
1462 
1463  py::class_<DynamicsSolver, std::shared_ptr<DynamicsSolver>, Object>(module, "DynamicsSolver")
1464  .def("F", &DynamicsSolver::F)
1465  .def("f", &DynamicsSolver::f)
1466  .def("fx", &DynamicsSolver::fx)
1467  .def("fu", &DynamicsSolver::fu)
1468  .def("fx_fd", &DynamicsSolver::fx_fd)
1469  .def("fu_fd", &DynamicsSolver::fu_fd)
1470  .def_property_readonly("nq", &DynamicsSolver::get_num_positions)
1471  .def_property_readonly("nv", &DynamicsSolver::get_num_velocities)
1472  .def_property_readonly("nx", &DynamicsSolver::get_num_state)
1473  .def_property_readonly("ndx", &DynamicsSolver::get_num_state_derivative)
1474  .def_property_readonly("nu", &DynamicsSolver::get_num_controls)
1475  .def_property_readonly("has_second_order_derivatives", &DynamicsSolver::get_has_second_order_derivatives)
1476  .def_property("integrator", &DynamicsSolver::get_integrator, &DynamicsSolver::set_integrator)
1477  .def("get_position", &DynamicsSolver::GetPosition)
1478  .def("simulate", &DynamicsSolver::Simulate)
1479  .def("state_delta", (Eigen::VectorXd(DynamicsSolver::*)(const Eigen::VectorXd&, const Eigen::VectorXd&)) & DynamicsSolver::StateDelta)
1480  .def("state_delta_derivative", &DynamicsSolver::dStateDelta)
1481  .def("state_delta_second_derivative", &DynamicsSolver::ddStateDelta)
1482  .def("compute_derivatives", &DynamicsSolver::ComputeDerivatives)
1483  .def("get_Fx", &DynamicsSolver::get_Fx)
1484  .def("get_Fu", &DynamicsSolver::get_Fu)
1485  .def("get_fx", &DynamicsSolver::get_fx)
1486  .def("get_fu", &DynamicsSolver::get_fu)
1487  .def("integrate", [](DynamicsSolver* instance, Eigen::VectorXdRefConst x, Eigen::VectorXdRefConst u, const double dt) {
1488  Eigen::VectorXd xout(instance->get_num_positions() + instance->get_num_velocities());
1489  instance->Integrate(x, u, dt, xout);
1490  return xout;
1491  })
1492  .def_property_readonly("dt", &DynamicsSolver::get_dt, "dt");
1493 
1496 
1497  // shape base class
1498  py::class_<shapes::Shape, shapes::ShapePtr>(module, "Shape")
1499  .def("scale", &shapes::Shape::scale)
1500  .def("padd", &shapes::Shape::padd)
1501  .def("scaleAndPadd", &shapes::Shape::scaleAndPadd)
1502  .def("isFixed", &shapes::Shape::isFixed)
1503  .def_readonly("type", &shapes::Shape::type);
1504 
1505  py::class_<shapes::Sphere, shapes::Shape, std::shared_ptr<shapes::Sphere>>(module, "Sphere")
1506  .def(py::init())
1507  .def(py::init<double>(), py::arg("radius"))
1508  .def_readonly_static("name", &shapes::Sphere::STRING_NAME)
1509  .def_readwrite("radius", &shapes::Sphere::radius);
1510 
1511  py::class_<shapes::Cylinder, shapes::Shape, std::shared_ptr<shapes::Cylinder>>(module, "Cylinder")
1512  .def(py::init())
1513  .def(py::init<double, double>(), py::arg("radius"), py::arg("length"))
1514  .def_readonly_static("name", &shapes::Cylinder::STRING_NAME)
1515  .def_readwrite("radius", &shapes::Cylinder::radius)
1516  .def_readwrite("length", &shapes::Cylinder::length);
1517 
1518  py::class_<shapes::Cone, shapes::Shape, std::shared_ptr<shapes::Cone>>(module, "Cone")
1519  .def(py::init())
1520  .def(py::init<double, double>(), py::arg("radius"), py::arg("length"))
1521  .def_readonly_static("name", &shapes::Cone::STRING_NAME)
1522  .def_readwrite("radius", &shapes::Cone::radius)
1523  .def_readwrite("length", &shapes::Cone::length);
1524 
1525  py::class_<shapes::Box, shapes::Shape, std::shared_ptr<shapes::Box>>(module, "Box")
1526  .def(py::init())
1527  .def(py::init<double, double, double>(), py::arg("x"), py::arg("y"), py::arg("z"))
1528  .def_readonly_static("name", &shapes::Box::STRING_NAME);
1529 
1530  py::class_<shapes::Plane, shapes::Shape, std::shared_ptr<shapes::Plane>>(module, "Plane")
1531  .def(py::init())
1532  .def(py::init<double, double, double, double>())
1533  .def_readonly_static("name", &shapes::Plane::STRING_NAME)
1534  .def("isFixed", &shapes::Plane::isFixed)
1535  .def_readwrite("a", &shapes::Plane::a)
1536  .def_readwrite("b", &shapes::Plane::b)
1537  .def_readwrite("c", &shapes::Plane::c)
1538  .def_readwrite("d", &shapes::Plane::d);
1539 
1540  py::class_<shapes::Mesh, shapes::Shape, std::shared_ptr<shapes::Mesh>>(module, "Mesh")
1541  .def(py::init())
1542  .def(py::init<unsigned int, unsigned int>())
1543  .def("computeTriangleNormals", &shapes::Mesh::computeTriangleNormals)
1544  .def("computeVertexNormals", &shapes::Mesh::computeVertexNormals)
1545  .def("mergeVertices", &shapes::Mesh::mergeVertices)
1546  .def_readonly("vertex_count", &shapes::Mesh::vertex_count)
1547  .def_readonly("triangle_count", &shapes::Mesh::triangle_count)
1548  .def_property_readonly("vertices", [](shapes::Mesh* instance) { return Eigen::Map<const Eigen::VectorXd>(instance->vertices, instance->vertex_count); })
1549  .def_property_readonly("triangles", [](shapes::Mesh* instance) { return Eigen::Map<const Eigen::Matrix<unsigned int, Eigen::Dynamic, 1>>(instance->triangles, instance->triangle_count); })
1550  .def_property_readonly("triangle_normals", [](shapes::Mesh* instance) { return Eigen::Map<const Eigen::VectorXd>(instance->triangle_normals, instance->triangle_count); })
1551  .def_property_readonly("vertex_normals", [](shapes::Mesh* instance) { return Eigen::Map<const Eigen::VectorXd>(instance->vertex_normals, instance->vertex_count); })
1552  .def_static("createMeshFromResource", [](const std::string& resource) {
1553  return shapes::createMeshFromResource("file://" + ParsePath(resource));
1554  },
1555  py::arg("resource_path"), py::return_value_policy::take_ownership)
1556  .def_static("createMeshFromVertices", [](const EigenSTL::vector_Vector3d& vertices) {
1557  return shapes::createMeshFromVertices(vertices);
1558  },
1559  py::arg("vertices"), py::return_value_policy::take_ownership)
1560  .def_static("createMeshFromVertices", [](const EigenSTL::vector_Vector3d& vertices, const std::vector<unsigned int>& triangles) {
1561  return shapes::createMeshFromVertices(vertices, triangles);
1562  },
1563  py::arg("vertices"), py::arg("triangles"), py::return_value_policy::take_ownership);
1564 
1565  py::class_<shapes::OcTree, shapes::Shape, std::shared_ptr<shapes::OcTree>>(module, "OcTree")
1566  .def(py::init())
1567  .def(py::init<const std::shared_ptr<const octomap::OcTree>&>());
1568 
1569  py::enum_<shapes::ShapeType>(module, "ShapeType")
1570  .value("UNKNOWN_SHAPE", shapes::ShapeType::UNKNOWN_SHAPE)
1571  .value("SPHERE", shapes::ShapeType::SPHERE)
1572  .value("CYLINDER", shapes::ShapeType::CYLINDER)
1573  .value("CONE", shapes::ShapeType::CONE)
1574  .value("BOX", shapes::ShapeType::BOX)
1575  .value("PLANE", shapes::ShapeType::PLANE)
1576  .value("MESH", shapes::ShapeType::MESH)
1577  .value("OCTREE", shapes::ShapeType::OCTREE)
1578  .export_values();
1579 
1580  py::enum_<ArgumentPosition>(module, "ArgumentPosition")
1581  .value("ARG0", ArgumentPosition::ARG0)
1582  .value("ARG1", ArgumentPosition::ARG1)
1583  .value("ARG2", ArgumentPosition::ARG2)
1584  .value("ARG3", ArgumentPosition::ARG3)
1585  .value("ARG4", ArgumentPosition::ARG4)
1586  .export_values();
1587 
1588  module.attr("version") = std::string(exotica::version);
1589  module.attr("branch") = std::string(exotica::branch);
1590 
1591  py::class_<BoxQPSolution>(module, "BoxQPSolution")
1592  .def_readonly("Hff_inv", &BoxQPSolution::Hff_inv)
1593  .def_readonly("x", &BoxQPSolution::x)
1594  .def_readonly("free_idx", &BoxQPSolution::free_idx)
1595  .def_readonly("clamped_idx", &BoxQPSolution::clamped_idx);
1596 
1597  module.def("box_qp",
1598  (BoxQPSolution(*)(const Eigen::MatrixXd& H, const Eigen::VectorXd& q,
1599  const Eigen::VectorXd& b_low, const Eigen::VectorXd& b_high,
1600  const Eigen::VectorXd& x_init, const double gamma,
1601  const int max_iterations, const double epsilon, const double lambda,
1602  bool use_polynomial_linesearch,
1603  bool use_cholesky_factorization)) &
1604  BoxQP,
1605  py::arg("H"), py::arg("q"), py::arg("b_low"), py::arg("b_high"), py::arg("x_init"), py::arg("gamma"), py::arg("max_iterations"), py::arg("epsilon"), py::arg("lambda"), py::arg("use_polynomial_linesearch") = true, py::arg("use_cholesky_factorization") = true);
1606 
1607  module.def("box_qp_old",
1608  (BoxQPSolution(*)(const Eigen::MatrixXd& H, const Eigen::VectorXd& q,
1609  const Eigen::VectorXd& b_low, const Eigen::VectorXd& b_high,
1610  const Eigen::VectorXd& x_init, const double gamma,
1611  const int max_iterations, const double epsilon, const double lambda,
1612  bool use_polynomial_linesearch,
1613  bool use_cholesky_factorization)) &
1614  ExoticaBoxQP,
1615  py::arg("H"), py::arg("q"), py::arg("b_low"), py::arg("b_high"), py::arg("x_init"), py::arg("gamma"), py::arg("max_iterations"), py::arg("epsilon"), py::arg("lambda"), py::arg("use_polynomial_linesearch") = false, py::arg("use_cholesky_factorization") = false);
1616 
1617  AddInitializers(module);
1618 
1619  auto cleanup_exotica = []() {
1620  known_initializers.clear();
1621  Setup::Destroy();
1622  };
1623  module.add_object("_cleanup", py::capsule(cleanup_exotica));
1624 }
exotica::ContinuousCollisionProxy::contact_tf1
KDL::Frame contact_tf1
ros::init_options::AnonymousName
AnonymousName
exotica::DynamicTimeIndexedShootingProblem::Update
void Update(Eigen::VectorXdRefConst u, int t)
exotica::TerminationCriterion::NotStarted
@ NotStarted
exotica::BoundedEndPoseProblem::GetScalarTaskCost
double GetScalarTaskCost(const std::string &task_name) const
exotica::TerminationCriterion::Divergence
@ Divergence
exotica::VisualizationMeshcat::GetFileURL
std::string GetFileURL()
exotica::ContinuousCollisionProxy::e2
std::shared_ptr< KinematicElement > e2
exotica::MotionSolver::SetNumberOfMaxIterations
void SetNumberOfMaxIterations(int max_iter)
exotica::TaskIndexing::id
int id
exotica::BoundedEndPoseProblem::GetScalarJacobian
Eigen::RowVectorXd GetScalarJacobian() const
setup
exotica::TerminationCriterion::GradientTolerance
@ GradientTolerance
exotica::CollisionScene::SetWorldLinkPadding
void SetWorldLinkPadding(const double padding)
exotica::pseudo_huber_jacobian
double pseudo_huber_jacobian(double x, double beta)
exotica::SamplingProblem::GetGoalState
const Eigen::VectorXd & GetGoalState() const
exotica::TimeIndexedTask::ddPhi_ddu
std::vector< Hessian > ddPhi_ddu
shapes::Cone::radius
double radius
exotica::UnconstrainedEndPoseProblem::SetNominalPose
void SetNominalPose(Eigen::VectorXdRefConst qNominal_in)
exotica::Object::type
virtual std::string type() const
exotica::SamplingProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::SamplingProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::TaskMap::length_jacobian
int length_jacobian
exotica::Scene::GetRootJointName
std::string GetRootJointName()
exotica::TaskMap::TaskSpaceJacobianDim
virtual int TaskSpaceJacobianDim()
exotica::UnconstrainedEndPoseProblem
exotica::AbstractDynamicsSolver::get_fu
const ControlDerivative & get_fu() const
exotica::AbstractDynamicsSolver::fx_fd
StateDerivative fx_fd(const StateVector &x, const ControlVector &u)
exotica::Scene::Update
void Update(Eigen::VectorXdRefConst x, double t=0)
exotica::EndPoseTask::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::Initializer::GetName
const std::string & GetName() const
exotica::AbstractTimeIndexedProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)
exotica::Scene::DetachObject
void DetachObject(const std::string &name)
exotica::EndPoseProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double &rho)
exotica::KinematicTree::GetRootFrameName
const std::string & GetRootFrameName() const
exotica::Scene::GetDynamicsSolver
std::shared_ptr< DynamicsSolver > GetDynamicsSolver() const
exotica::TaskMap::start_jacobian
int start_jacobian
exotica::LoadOBJ
void LoadOBJ(const std::string &data, Eigen::VectorXi &tri, Eigen::VectorXd &vert)
exotica::TimeIndexedSamplingProblem::inequality
SamplingTask inequality
exotica::Scene::SetModelState
void SetModelState(const std::map< std::string, double > &x, double t=0, bool update_traj=true)
exotica::SamplingProblem::Phi
TaskSpaceVector Phi
shapes::Cone::length
double length
exotica::PlanningProblem::SetStartTime
void SetStartTime(double t)
exotica::Scene::get_num_positions
int get_num_positions() const
exotica::EndPoseTask::GetRho
double GetRho(const std::string &task_name) const
exotica::Scene::GetTrajectory
std::shared_ptr< Trajectory > GetTrajectory(const std::string &link)
exotica::TimeIndexedSamplingProblem::IsValid
virtual bool IsValid()
ros::package::getPath
ROSLIB_DECL std::string getPath(const std::string &package_name)
exotica::smooth_l1_hessian
double smooth_l1_hessian(double x, double beta)
exotica::TaskMap::id
int id
shapes::Mesh::triangles
unsigned int * triangles
exotica::KinematicResponse::Phi
ArrayFrame Phi
epsilon
double epsilon
exotica::AbstractDynamicsSolver
exotica::Scene::GetModelState
Eigen::VectorXd GetModelState()
exotica::EndPoseProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double &rho)
exotica::TimeIndexedSamplingProblem::GetSpaceDim
int GetSpaceDim()
PyAsStdString
std::string PyAsStdString(PyObject *value_py)
Definition: pyexotica.cpp:68
exotica::EndPoseTask::S
Eigen::MatrixXd S
exotica::Scene::get_num_state_derivative
int get_num_state_derivative() const
exotica::BoundedEndPoseProblem::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name)
Eigen::VectorTransform
Eigen::VectorXd VectorTransform(double px=0.0, double py=0.0, double pz=0.0, double qx=0.0, double qy=0.0, double qz=0.0, double qw=1.0)
exotica::TimeIndexedTask::hessian
std::vector< Hessian > hessian
exotica::UnconstrainedEndPoseProblem::Update
void Update(Eigen::VectorXdRefConst x)
exotica::AbstractTimeIndexedProblem::GetT
int GetT() const
exotica::ContinuousCollisionProxy
exotica::AbstractTimeIndexedProblem::Update
virtual void Update(Eigen::VectorXdRefConst x_in, int t)
exotica::EndPoseTask::hessian
Hessian hessian
exotica::Scene::AttachObject
void AttachObject(const std::string &name, const std::string &parent)
exotica_core.h
exotica::Task::length_jacobian
int length_jacobian
exotica::VisualizationMeshcat::SetProperty
void SetProperty(const std::string &path, const std::string &property, const bool &value)
exotica::TerminationCriterion::Convergence
@ Convergence
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
exotica::DynamicTimeIndexedShootingProblem::set_X
void set_X(Eigen::MatrixXdRefConst X_in)
exotica::AbstractDynamicsSolver::ddStateDelta
virtual Hessian ddStateDelta(const StateVector &x_1, const StateVector &x_2, const ArgumentPosition first_or_second)
exotica::TaskMap
exotica::PlanningProblem::GetTasks
TaskMapVec & GetTasks()
exotica::KinematicTree::SetJointAccelerationLimits
void SetJointAccelerationLimits(Eigen::VectorXdRefConst acceleration_in)
exotica::EndPoseProblem::GetInequality
Eigen::VectorXd GetInequality()
exotica::CollisionScene::GetRobotToRobotCollisionDistance
virtual std::vector< CollisionProxy > GetRobotToRobotCollisionDistance(double)
exotica::SamplingProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name)
exotica::GetFrame
Eigen::MatrixXd GetFrame(const KDL::Frame &val)
exotica::huber_jacobian
double huber_jacobian(double x, double beta)
exotica::PlanningProblem::SetStartState
void SetStartState(Eigen::VectorXdRefConst x)
exotica::Scene
exotica::Scene::UpdatePlanningScene
void UpdatePlanningScene(const moveit_msgs::PlanningScene &scene)
exotica::AbstractDynamicsSolver::get_num_controls
int get_num_controls() const
exotica::Scene::GetModelStateMap
std::map< std::string, double > GetModelStateMap()
exotica::VisualizationMoveIt::DisplayTrajectory
void DisplayTrajectory(Eigen::MatrixXdRefConst trajectory)
exotica::AbstractTimeIndexedProblem::GetScalarTransitionCost
double GetScalarTransitionCost(int t) const
exotica::BoundedEndPoseProblem::Update
void Update(Eigen::VectorXdRefConst x)
exotica::EndPoseProblem::Update
void Update(Eigen::VectorXdRefConst x)
exotica::TimeIndexedTask::Phi
std::vector< TaskSpaceVector > Phi
exotica::AbstractDynamicsSolver::get_has_second_order_derivatives
const bool & get_has_second_order_derivatives() const
exotica::AbstractDynamicsSolver::get_Fx
const StateDerivative & get_Fx() const
exotica::KinematicTree::GetJointLimits
const Eigen::MatrixXd & GetJointLimits() const
exotica::AbstractTimeIndexedProblem::GetDuration
double GetDuration() const
exotica::AbstractTimeIndexedProblem::SetTau
void SetTau(const double tau_in)
exotica::XMLLoader::LoadProblem
static std::shared_ptr< exotica::PlanningProblem > LoadProblem(const std::string &file_name)
exotica::AbstractDynamicsSolver::Integrate
virtual void Integrate(const StateVector &x, const StateVector &dx, const double dt, StateVector &xout)
exotica::EndPoseTask::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name) const
exotica::Property::IsInitializerVectorType
bool IsInitializerVectorType() const
exotica::UnconstrainedTimeIndexedProblem::Update
virtual void Update(Eigen::VectorXdRefConst x_in, int t)
exotica::Scene::get_has_quaternion_floating_base
bool get_has_quaternion_floating_base() const
exotica::DynamicTimeIndexedShootingProblem::get_control_cost_weight
double get_control_cost_weight() const
IsPyString
bool IsPyString(PyObject *value_py)
Definition: pyexotica.cpp:59
exotica::DynamicTimeIndexedShootingProblem::GetStateCostHessian
Eigen::MatrixXd GetStateCostHessian(int t)
exotica::AbstractTimeIndexedProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name, int t=0)
exotica::TimeIndexedSamplingProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double &rho)
exotica::BoundedTimeIndexedProblem
exotica::KinematicElement::is_controlled
bool is_controlled
exotica::ParseDouble
double ParseDouble(const std::string value)
exotica::CollisionScene::SetWorldLinkScale
void SetWorldLinkScale(const double scale)
PyBytes_AsString
#define PyBytes_AsString
getName
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)
exotica::MotionSolver::GetPlanningTime
double GetPlanningTime()
exotica::SamplingProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name)
shapes::Mesh::vertex_normals
double * vertex_normals
exotica::CollisionScene::SetRobotLinkScale
void SetRobotLinkScale(const double scale)
exotica::KinematicTree::FK
KDL::Frame FK(const std::string &element_A, const KDL::Frame &offset_a, const std::string &element_B, const KDL::Frame &offset_b) const
exotica::Scene::GetTreeMap
std::map< std::string, std::weak_ptr< KinematicElement > > GetTreeMap()
exotica::EndPoseProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::GetFrameFromMatrix
KDL::Frame GetFrameFromMatrix(Eigen::MatrixXdRefConst val)
mesh_operations.h
pybind11::detail::type_caster< Hessian >::cast
static handle cast(Hessian src, return_value_policy, handle)
Definition: pyexotica.cpp:664
exotica::ContinuousCollisionProxy::in_collision
bool in_collision
exotica::Scene::UpdateSceneFrames
void UpdateSceneFrames()
CreateInitializer
Initializer CreateInitializer(const Initializer &init)
Definition: pyexotica.cpp:163
exotica::AbstractDynamicsSolver::ComputeDerivatives
virtual void ComputeDerivatives(const StateVector &x, const ControlVector &u)
exotica::EndPoseTask::jacobian
Eigen::MatrixXd jacobian
exotica::UnconstrainedEndPoseProblem::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::SamplingProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double &rho)
exotica::AbstractDynamicsSolver::dStateDelta
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > dStateDelta(const StateVector &x_1, const StateVector &x_2, const ArgumentPosition first_or_second)
exotica::Scene::AddObject
void AddObject(const std::string &name, const KDL::Frame &transform=KDL::Frame(), const std::string &parent="", const std::string &shape_resource_path="", const Eigen::Vector3d &scale=Eigen::Vector3d::Ones(), const KDL::RigidBodyInertia &inertia=KDL::RigidBodyInertia::Zero(), const Eigen::Vector4d &color=Eigen::Vector4d(0.5, 0.5, 0.5, 1.0), const bool update_collision_scene=true)
exotica::EndPoseProblem::GetBounds
Eigen::MatrixXd GetBounds() const
exotica::AbstractTimeIndexedProblem::GetEquality
Eigen::VectorXd GetEquality() const
exotica::TimeIndexedTask::GetS
Eigen::MatrixXd GetS(const std::string &task_name, int t) const
StdStringAsPy
PyObject * StdStringAsPy(std::string value)
Definition: pyexotica.cpp:80
exotica::TimeIndexedSamplingProblem::Update
void Update(Eigen::VectorXdRefConst x, const double &t)
exotica::FeedbackMotionSolver::GetFeedbackControl
virtual Eigen::VectorXd GetFeedbackControl(Eigen::VectorXdRefConst x, int t) const=0
n
n
exotica::AbstractTimeIndexedProblem::jacobian
std::vector< Eigen::MatrixXd > jacobian
exotica::BoundedEndPoseProblem::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::TimeIndexedSamplingProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name)
exotica::Trajectory::ToString
std::string ToString()
exotica::KinematicTree::GetNumControlledJoints
int GetNumControlledJoints() const
exotica::Setup::CreateProblem
static std::shared_ptr< exotica::PlanningProblem > CreateProblem(const Initializer &init)
exotica::PlanningProblem::get_num_controls
int get_num_controls() const
exotica::DynamicTimeIndexedShootingProblem::get_Q
const Eigen::MatrixXd & get_Q(int t) const
exotica::AbstractTimeIndexedProblem::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name, int t=0)
exotica::CollisionScene::UpdateCollisionObjectTransforms
virtual void UpdateCollisionObjectTransforms()=0
exotica::Object::Print
virtual std::string Print(const std::string &prepend) const
shapes::Mesh::triangle_count
unsigned int triangle_count
exotica::CollisionProxy::e2
std::shared_ptr< KinematicElement > e2
exotica::TimeIndexedTask::GetTaskError
Eigen::VectorXd GetTaskError(const std::string &task_name, int t) const
exotica::Property::Get
boost::any Get() const
exotica::Scene::GetModelLinkNames
std::vector< std::string > GetModelLinkNames()
exotica::UnconstrainedEndPoseProblem::GetScalarJacobian
Eigen::RowVectorXd GetScalarJacobian() const
exotica::EndPoseTask::GetS
Eigen::MatrixXd GetS(const std::string &task_name) const
exotica::Scene::GetControlledLinkNames
std::vector< std::string > GetControlledLinkNames()
exotica::TerminationCriterion::BacktrackIterationLimit
@ BacktrackIterationLimit
exotica::KinematicElement::parent
std::weak_ptr< KinematicElement > parent
exotica::DynamicTimeIndexedShootingProblem::set_Q
void set_Q(Eigen::MatrixXdRefConst Q_in, int t)
exotica::AbstractTimeIndexedProblem::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)
exotica::SamplingProblem::num_tasks
int num_tasks
exotica::Setup::Destroy
static void Destroy()
exotica::SamplingProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double &rho)
shapes::Shape::scale
void scale(double scale)
exotica::Scene::GetKinematicTree
exotica::KinematicTree & GetKinematicTree()
exotica::BoxQPSolution::clamped_idx
std::vector< size_t > clamped_idx
transform
template Halfspace< double > transform(const Halfspace< double > &a, const Transform3< double > &tf)
exotica::SamplingTask::SetRho
void SetRho(const std::string &task_name, const double rho)
shapes::Mesh::mergeVertices
void mergeVertices(double threshold)
exotica::PlanningProblem::N
int N
shapes::Mesh
exotica::RotationType::ZYX
@ ZYX
exotica::TimeIndexedTask::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal, int t)
exotica::EndPoseTask::GetTaskJacobian
Eigen::MatrixXd GetTaskJacobian(const std::string &task_name) const
exotica::smooth_l1_cost
double smooth_l1_cost(double x, double beta)
exotica::PlanningProblem::termination_criterion
TerminationCriterion termination_criterion
exotica::DynamicTimeIndexedShootingProblem::set_X_star
void set_X_star(Eigen::MatrixXdRefConst X_star_in)
exotica::EndPoseProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::CollisionScene::GetRobotToWorldCollisionDistance
virtual std::vector< CollisionProxy > GetRobotToWorldCollisionDistance(double)
exotica::AbstractDynamicsSolver::get_fx
const StateDerivative & get_fx() const
exotica::KinematicElement::parent_name
std::string parent_name
exotica::CollisionScene::GetWorldLinkScale
double GetWorldLinkScale() const
exotica
exotica::smooth_l1_jacobian
double smooth_l1_jacobian(double x, double beta)
exotica::EndPoseProblem::use_bounds
bool use_bounds
exotica::TaskIndexing::start_jacobian
int start_jacobian
exotica::KinematicTree::GetKinematicChain
std::vector< std::string > GetKinematicChain(const std::string &begin, const std::string &end) const
Hessian
Eigen::Array< Eigen::MatrixXd, Eigen::Dynamic, 1 > Hessian
shapes::Sphere::STRING_NAME
static const std::string STRING_NAME
shapes::Plane::isFixed
bool isFixed() const override
exotica::KinematicElement::joint_limits
std::vector< double > joint_limits
exotica::Scene::GetCollisionScene
const CollisionScenePtr & GetCollisionScene() const
OcTree.h
exotica::Setup::GetMaps
static std::vector< std::string > GetMaps()
exotica::DynamicTimeIndexedShootingProblem::get_X
const Eigen::MatrixXd & get_X() const
exotica::KinematicTree::GetModelJointNames
const std::vector< std::string > & GetModelJointNames() const
exotica::EndPoseTask::Phi
TaskSpaceVector Phi
exotica::PlanningProblem::GetNumberOfProblemUpdates
unsigned int GetNumberOfProblemUpdates() const
exotica::UnconstrainedEndPoseProblem::num_tasks
int num_tasks
exotica::Object::ns_
std::string ns_
shapes::Mesh::computeVertexNormals
void computeVertexNormals()
known_initializers
std::map< std::string, Initializer > known_initializers
Definition: pyexotica.cpp:92
exotica::AbstractTimeIndexedProblem::GetScalarTaskCost
double GetScalarTaskCost(int t) const
exotica::TimeIndexedTask::SetRho
void SetRho(const std::string &task_name, const double rho_in, int t)
sparse_costs.h
exotica::TimeIndexedSamplingProblem::Phi
TaskSpaceVector Phi
exotica::EndPoseTask::y
TaskSpaceVector y
exotica::Scene::GetControlledState
Eigen::VectorXd GetControlledState()
exotica::EndPoseProblem::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name)
exotica::ContinuousCollisionProxy::contact_tf2
KDL::Frame contact_tf2
shapes::Shape::padd
void padd(double padding)
exotica::AbstractTimeIndexedProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name, int t=0)
exotica::ContinuousCollisionProxy::Print
std::string Print() const
exotica::Scene::get_num_state
int get_num_state() const
exotica::KinematicTree::GetModelLinkNames
const std::vector< std::string > & GetModelLinkNames() const
exotica::EndPoseProblem::W
Eigen::MatrixXd W
exotica::Scene::HasAttachedObject
bool HasAttachedObject(const std::string &name)
exotica::RotationType::ANGLE_AXIS
@ ANGLE_AXIS
pybind11::detail::type_caster< Hessian >::load
bool load(handle src, bool)
Definition: pyexotica.cpp:651
exotica::TimeIndexedProblem
exotica::TimeIndexedTask::ddPhi_dxdu
std::vector< Hessian > ddPhi_dxdu
exotica::AbstractTimeIndexedProblem::GetInitialTrajectory
std::vector< Eigen::VectorXd > GetInitialTrajectory() const
exotica::BoxQPSolution::Hff_inv
Eigen::MatrixXd Hff_inv
exotica::AbstractTimeIndexedProblem::GetJointVelocityLimits
Eigen::VectorXd GetJointVelocityLimits() const
exotica::Scene::RemoveTrajectory
void RemoveTrajectory(const std::string &link)
exotica::GetFrameAsVector
Eigen::VectorXd GetFrameAsVector(const KDL::Frame &val, RotationType type=RotationType::RPY)
shapes::Sphere::radius
double radius
exotica::PlanningProblem::ResetNumberOfProblemUpdates
void ResetNumberOfProblemUpdates()
exotica::Scene::AddObjectToEnvironment
void AddObjectToEnvironment(const std::string &name, const KDL::Frame &transform=KDL::Frame(), shapes::ShapeConstPtr shape=nullptr, const Eigen::Vector4d &color=Eigen::Vector4d(0.5, 0.5, 0.5, 1.0), const bool update_collision_scene=true)
exotica::XMLLoader::LoadSolver
static std::shared_ptr< exotica::MotionSolver > LoadSolver(const std::string &file_name)
exotica::ContinuousCollisionProxy::e1
std::shared_ptr< KinematicElement > e1
exotica::KinematicTree::GetRootJointName
const std::string & GetRootJointName() const
A
exotica::TimeIndexedSamplingProblem::GetGoalTime
double GetGoalTime() const
exotica::KinematicElement
exotica::Setup::CreateDynamicsSolver
static std::shared_ptr< exotica::DynamicsSolver > CreateDynamicsSolver(const Initializer &init)
exotica::TimeIndexedSamplingProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name)
exotica::BoundedEndPoseProblem::cost
EndPoseTask cost
exotica::RotationType::MATRIX
@ MATRIX
exotica::CollisionScene::ContinuousCollisionCheck
virtual ContinuousCollisionProxy ContinuousCollisionCheck(const std::string &, const KDL::Frame &, const KDL::Frame &, const std::string &, const KDL::Frame &, const KDL::Frame &)
exotica::TerminationCriterion::StepTolerance
@ StepTolerance
exotica::branch
const char branch[]
exotica::AbstractDynamicsSolver::get_num_velocities
int get_num_velocities() const
exotica::SamplingProblem::IsStateValid
bool IsStateValid(Eigen::VectorXdRefConst x)
exotica::EndPoseProblem::num_tasks
int num_tasks
exotica::CollisionScene::SetAlwaysExternallyUpdatedCollisionScene
void SetAlwaysExternallyUpdatedCollisionScene(const bool value)
name
std::string name
exotica::LoadFile
std::string LoadFile(const std::string &path)
exotica::TimeIndexedSamplingProblem::SetGoalTime
void SetGoalTime(const double &t)
exotica::AbstractTimeIndexedProblem::SetRhoEQ
void SetRhoEQ(const std::string &task_name, const double rho, int t=0)
exotica::EndPoseProblem::cost
EndPoseTask cost
exotica::AbstractDynamicsSolver::get_Fu
const ControlDerivative & get_Fu() const
exotica::EndPoseProblem::GetEquality
Eigen::VectorXd GetEquality()
exotica::PlanningProblem::Print
std::string Print(const std::string &prepend) const override
exotica::Server::InitRos
static void InitRos(std::shared_ptr< ros::NodeHandle > nh, int numThreads=2)
exotica::AbstractDynamicsSolver::get_num_state
int get_num_state() const
exotica::BoundedEndPoseProblem::Phi
TaskSpaceVector Phi
exotica::AbstractDynamicsSolver::get_num_state_derivative
int get_num_state_derivative() const
exotica::UnconstrainedEndPoseProblem::GetScalarCost
double GetScalarCost() const
exotica::Setup::GetDynamicsSolvers
static std::vector< std::string > GetDynamicsSolvers()
exotica::TimeIndexedSamplingProblem::SetGoalNEQ
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::CollisionScene::GetReplacePrimitiveShapesWithMeshes
bool GetReplacePrimitiveShapesWithMeshes() const
exotica::EndPoseProblem::GetScalarCost
double GetScalarCost()
exotica::AbstractTimeIndexedProblem::SetT
void SetT(const int T_in)
exotica::Initializer::properties_
std::map< std::string, Property > properties_
shapes::Cylinder::STRING_NAME
static const std::string STRING_NAME
exotica::KinematicTree::SetJointLimitsLower
void SetJointLimitsLower(Eigen::VectorXdRefConst lower_in)
exotica::SaveMatrix
void SaveMatrix(std::string file_name, const Eigen::Ref< const Eigen::MatrixXd > mat)
exotica::DynamicTimeIndexedShootingProblem::GetControlCost
double GetControlCost(int t) const
exotica::RotationType::ZYZ
@ ZYZ
exotica::Object
exotica::SamplingProblem::GetSpaceDim
int GetSpaceDim()
exotica::Setup::CreateScene
static exotica::ScenePtr CreateScene(const Initializer &init)
shapes::Mesh::vertex_count
unsigned int vertex_count
exotica::Task::num_tasks
int num_tasks
Eigen::VectorXdRefConst
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
exotica::TimeIndexedSamplingProblem::SetGoalState
void SetGoalState(Eigen::VectorXdRefConst qT)
EigenSTL::vector_Vector3d
std::vector< Eigen::Vector3d, Eigen::aligned_allocator< Eigen::Vector3d > > vector_Vector3d
exotica::AbstractDynamicsSolver::get_dt
T get_dt() const
exotica::DynamicTimeIndexedShootingProblem::Phi
std::vector< TaskSpaceVector > Phi
exotica::UnconstrainedEndPoseProblem::length_jacobian
int length_jacobian
exotica::EndPoseProblem::GetGoalEQ
Eigen::VectorXd GetGoalEQ(const std::string &task_name)
HIGHLIGHT
#define HIGHLIGHT(x)
shapes::Shape::scaleAndPadd
virtual void scaleAndPadd(double scale, double padd)=0
exotica::KinematicTree::debug
bool debug
exotica::TimeIndexedTask::dPhi_dx
std::vector< Eigen::MatrixXd > dPhi_dx
exotica::EndPoseProblem::jacobian
Eigen::MatrixXd jacobian
CreateStringIOObject
PyObject * CreateStringIOObject()
Definition: pyexotica.cpp:94
exotica::UnconstrainedEndPoseProblem::jacobian
Eigen::MatrixXd jacobian
exotica::CollisionProxy::contact2
Eigen::Vector3d contact2
exotica::AbstractTimeIndexedProblem::use_bounds
bool use_bounds
exotica::TimeIndexedSamplingProblem::GetBounds
std::vector< double > GetBounds()
visualization_moveit.h
exotica::Scene::GetScene
std::string GetScene()
exotica::RotationType::RPY
@ RPY
shapes::Plane::a
double a
exotica::TaskSpaceVector
exotica::CollisionScene::GetAlwaysExternallyUpdatedCollisionScene
bool GetAlwaysExternallyUpdatedCollisionScene() const
exotica::VisualizationMeshcat::DisplayTrajectory
void DisplayTrajectory(Eigen::MatrixXdRefConst trajectory, double dt=1.0)
exotica::MotionSolver::GetNumberOfMaxIterations
int GetNumberOfMaxIterations()
exotica::TerminationCriterion::IterationLimit
@ IterationLimit
exotica::AbstractTimeIndexedProblem::GetInequalityJacobian
Eigen::SparseMatrix< double > GetInequalityJacobian() const
exotica::Scene::CleanScene
void CleanScene()
exotica::TimeIndexedTask::dPhi_du
std::vector< Eigen::MatrixXd > dPhi_du
exotica::AbstractTimeIndexedProblem::SetJointVelocityLimits
void SetJointVelocityLimits(const Eigen::VectorXd &qdot_max_in)
ROS_MESSAGE_WRAPPER
#define ROS_MESSAGE_WRAPPER(MessageType)
Definition: pyexotica.cpp:114
exotica::AbstractTimeIndexedProblem::SetRho
void SetRho(const std::string &task_name, const double rho, int t=0)
shapes::Shape::type
ShapeType type
exotica::SamplingProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name)
shapes::Mesh::computeTriangleNormals
void computeTriangleNormals()
exotica::SamplingTask::y
TaskSpaceVector y
exotica::EndPoseTask::GetTaskError
Eigen::VectorXd GetTaskError(const std::string &task_name) const
exotica::Scene::AddTrajectory
void AddTrajectory(const std::string &link, const std::string &traj)
exotica::AbstractTimeIndexedProblem::num_tasks
int num_tasks
exotica::Setup::GetInitializers
static std::vector< Initializer > GetInitializers()
exotica::KinematicTree::GetRandomControlledState
Eigen::VectorXd GetRandomControlledState()
Eigen::MatrixXdRefConst
const typedef Eigen::Ref< const Eigen::MatrixXd > & MatrixXdRefConst
array_hessian
Hessian array_hessian(pybind11::array_t< T > inArray)
Definition: pyexotica.cpp:566
exotica::SamplingTask::ydiff
Eigen::VectorXd ydiff
exotica::Initializer::AddProperty
void AddProperty(const Property &prop)
shapes::createMeshFromResource
Mesh * createMeshFromResource(const std::string &resource)
exotica::Scene::UpdateCollisionObjects
void UpdateCollisionObjects()
exotica::DynamicTimeIndexedShootingProblem::set_U
void set_U(Eigen::MatrixXdRefConst U_in)
shapes::Plane::d
double d
exotica::Object::debug_
bool debug_
exotica::PlanningProblem::get_num_positions
int get_num_positions() const
exotica::UnconstrainedEndPoseProblem::Phi
TaskSpaceVector Phi
exotica::ParseIntList
std::vector< int > ParseIntList(const std::string value)
exotica::Initializer
shapes::Box::STRING_NAME
static const std::string STRING_NAME
exotica::BoundedEndPoseProblem::length_Phi
int length_Phi
exotica::PlanningProblem::GetStartState
Eigen::VectorXd GetStartState() const
exotica::Trajectory
exotica::KinematicTree::GetAccelerationLimits
const Eigen::VectorXd & GetAccelerationLimits() const
exotica::CollisionScene::get_replace_cylinders_with_capsules
bool get_replace_cylinders_with_capsules() const
exotica::KinematicTree::GetControlledLinkNames
const std::vector< std::string > & GetControlledLinkNames() const
exotica::CollisionScene::GetRobotLinkScale
double GetRobotLinkScale() const
exotica::Setup::CreateSolver
static std::shared_ptr< exotica::MotionSolver > CreateSolver(const Initializer &init)
shapes::Mesh::vertices
double * vertices
exotica::Scene::GetControlledJointNames
std::vector< std::string > GetControlledJointNames()
exotica::AbstractTimeIndexedProblem::equality
TimeIndexedTask equality
exotica::Scene::PublishScene
void PublishScene()
exotica::ParsePath
std::string ParsePath(const std::string &path)
pybind11::detail::type_caster< Initializer >::PyToInit
bool PyToInit(PyObject *source, Initializer &ret)
Definition: pyexotica.cpp:399
exotica::RotationType::QUATERNION
@ QUATERNION
exotica::SamplingProblem::GetBounds
std::vector< double > GetBounds()
exotica::Scene::GetRootFrameName
std::string GetRootFrameName()
exotica::AbstractTimeIndexedProblem::length_jacobian
int length_jacobian
exotica::SamplingTask::GetRho
double GetRho(const std::string &task_name) const
package.h
exotica::Task::length_Phi
int length_Phi
exotica::BoundedEndPoseProblem::jacobian
Eigen::MatrixXd jacobian
exotica::AbstractTimeIndexedProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name, int t=0)
pybind11::detail::type_caster< Initializer >::addPropertyToDict
static void addPropertyToDict(PyObject *dict, const std::string &name, const Property &prop)
Definition: pyexotica.cpp:487
exotica::EndPoseProblem::GetScalarTaskCost
double GetScalarTaskCost(const std::string &task_name) const
exotica::BoundedTimeIndexedProblem::Update
void Update(Eigen::VectorXdRefConst x, int t) override
exotica::TimeIndexedTask::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name, int t) const
exotica::DynamicTimeIndexedShootingProblem::cost
TimeIndexedTask cost
exotica::ContinuousCollisionProxy::time_of_contact
double time_of_contact
exotica::Scene::get_num_velocities
int get_num_velocities() const
exotica::AbstractTimeIndexedProblem::cost
TimeIndexedTask cost
exotica::AbstractDynamicsSolver::fu
virtual ControlDerivative fu(const StateVector &x, const ControlVector &u)
exotica::UnconstrainedEndPoseProblem::GetNominalPose
Eigen::VectorXd GetNominalPose() const
exotica::Task::indexing
std::vector< TaskIndexing > indexing
exotica::AbstractTimeIndexedProblem::Phi
std::vector< TaskSpaceVector > Phi
exotica::DynamicTimeIndexedShootingProblem::set_loss_type
void set_loss_type(const ControlCostLossTermType &loss_type_in)
exotica::EndPoseProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name)
exotica::KinematicTree
exotica::KinematicTree::Hessian
exotica::Hessian Hessian(const std::string &element_A, const KDL::Frame &offset_a, const std::string &element_B, const KDL::Frame &offset_b) const
exotica::Setup::Instance
static std::shared_ptr< Setup > Instance()
exotica::DynamicTimeIndexedShootingProblem::GetControlCostJacobian
Eigen::VectorXd GetControlCostJacobian(int t)
exotica::Scene::get_num_controls
int get_num_controls() const
exotica::AbstractTimeIndexedProblem::GetCost
double GetCost() const
exotica::TimeIndexedSamplingProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name)
exotica::TimeIndexedSamplingProblem
exotica::CollisionScene::GetTranslation
virtual Eigen::Vector3d GetTranslation(const std::string &name)=0
exotica::DynamicTimeIndexedShootingProblem
exotica::BoxQP
BoxQPSolution BoxQP(const Eigen::MatrixXd &H, const Eigen::VectorXd &q, const Eigen::VectorXd &b_low, const Eigen::VectorXd &b_high, const Eigen::VectorXd &x_init)
shapes::Mesh::triangle_normals
double * triangle_normals
exotica::ParseInt
int ParseInt(const std::string value)
exotica::BoundedEndPoseProblem::length_jacobian
int length_jacobian
Eigen::IdentityTransform
Eigen::VectorXd IdentityTransform()
exotica::DynamicTimeIndexedShootingProblem::GetStateCostJacobian
Eigen::VectorXd GetStateCostJacobian(int t)
exotica::KinematicTree::FindKinematicElementByName
std::shared_ptr< KinematicElement > FindKinematicElementByName(const std::string &frame_name)
exotica::TerminationCriterion::FunctionTolerance
@ FunctionTolerance
exotica::EndPoseProblem::GetEqualityJacobian
Eigen::MatrixXd GetEqualityJacobian()
exotica::KinematicTree::GetModelBaseType
BaseType GetModelBaseType() const
exotica::Scene::AttachObjectLocal
void AttachObjectLocal(const std::string &name, const std::string &parent, const Eigen::VectorXd &pose)
exotica::AbstractDynamicsSolver::fx
virtual StateDerivative fx(const StateVector &x, const ControlVector &u)
exotica::TimeIndexedTask::GetRho
double GetRho(const std::string &task_name, int t) const
exotica::KinematicElement::segment
KDL::Segment segment
exotica::KinematicTree::GetControlledJointNames
const std::vector< std::string > & GetControlledJointNames() const
exotica::KinematicTree::GetModelTree
const std::vector< std::shared_ptr< KinematicElement > > & GetModelTree() const
exotica::KinematicTree::GetVelocityLimits
const Eigen::VectorXd & GetVelocityLimits() const
exotica::CollisionScene::GetRobotLinkPadding
double GetRobotLinkPadding() const
exotica::DynamicTimeIndexedShootingProblem::dPhi_dx
std::vector< Eigen::MatrixXd > dPhi_dx
exotica::KinematicTree::SetJointVelocityLimits
void SetJointVelocityLimits(Eigen::VectorXdRefConst velocity_in)
exotica::VisualizationMeshcat::DisplayScene
void DisplayScene(bool use_mesh_materials=true)
exotica::Task::task_maps
TaskMapMap task_maps
exotica::UnconstrainedEndPoseProblem::cost
EndPoseTask cost
exotica::Scene::LoadSceneFile
void LoadSceneFile(const std::string &file_name, const Eigen::Isometry3d &offset=Eigen::Isometry3d::Identity(), bool update_collision_scene=true)
exotica::EndPoseProblem::Phi
TaskSpaceVector Phi
exotica::SamplingTask::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::TimeIndexedTask::rho
std::vector< Eigen::VectorXd > rho
exotica::MotionSolver
exotica::Scene::GetModelJointNames
std::vector< std::string > GetModelJointNames()
exotica::TimeIndexedTask::jacobian
std::vector< Eigen::MatrixXd > jacobian
exotica::DynamicTimeIndexedShootingProblem::UpdateTerminalState
void UpdateTerminalState(Eigen::VectorXdRefConst x)
exotica::EndPoseProblem::equality
EndPoseTask equality
shapes::createMeshFromVertices
Mesh * createMeshFromVertices(const EigenSTL::vector_Vector3d &source)
exotica::AbstractTimeIndexedProblem::GetScalarTaskJacobian
Eigen::RowVectorXd GetScalarTaskJacobian(int t) const
exotica::BoundedEndPoseProblem::W
Eigen::MatrixXd W
exotica::DynamicTimeIndexedShootingProblem::get_U
const Eigen::MatrixXd & get_U() const
exotica::Scene::PublishProxies
void PublishProxies(const std::vector< CollisionProxy > &proxies)
exotica::ExoticaBoxQP
BoxQPSolution ExoticaBoxQP(const Eigen::MatrixXd &H, const Eigen::VectorXd &q, const Eigen::VectorXd &b_low, const Eigen::VectorXd &b_high, const Eigen::VectorXd &x_init)
exotica::SamplingTask::Phi
TaskSpaceVector Phi
exotica::UnconstrainedEndPoseProblem::length_Phi
int length_Phi
exotica::KinematicElement::control_id
int control_id
exotica::CollisionProxy::normal1
Eigen::Vector3d normal1
box_qp.h
exotica::TaskIndexing::length_jacobian
int length_jacobian
exotica::CollisionScene::set_replace_cylinders_with_capsules
void set_replace_cylinders_with_capsules(const bool value)
exotica::TaskMap::length
int length
exotica::SamplingTask::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name) const
exotica::GetRotationAsVector
Eigen::VectorXd GetRotationAsVector(const KDL::Frame &val, RotationType type)
exotica::TimeIndexedTask::S
std::vector< Eigen::MatrixXd > S
exotica::Scene::LoadScene
void LoadScene(const std::string &scene, const Eigen::Isometry3d &offset=Eigen::Isometry3d::Identity(), bool update_collision_scene=true)
exotica::AbstractTimeIndexedProblem::GetRho
double GetRho(const std::string &task_name, int t=0)
exotica::UnconstrainedTimeIndexedProblem
exotica::KinematicTree::HasAccelerationLimits
const bool & HasAccelerationLimits() const
exotica::Setup::GetCollisionScenes
static std::vector< std::string > GetCollisionScenes()
exotica::DynamicTimeIndexedShootingProblem::get_loss_type
const ControlCostLossTermType & get_loss_type() const
exotica::AbstractTimeIndexedProblem::SetInitialTrajectory
void SetInitialTrajectory(const std::vector< Eigen::VectorXd > &q_init_in)
exotica::KinematicTree::GetControlledBaseType
BaseType GetControlledBaseType() const
exotica::KinematicTree::SetFloatingBaseLimitsPosXYZEulerZYX
void SetFloatingBaseLimitsPosXYZEulerZYX(const std::vector< double > &lower, const std::vector< double > &upper)
exotica::Scene::AddTrajectoryFromFile
void AddTrajectoryFromFile(const std::string &link, const std::string &traj)
exotica::TimeIndexedTask::ydiff
std::vector< Eigen::VectorXd > ydiff
exotica::AbstractTimeIndexedProblem::GetBounds
Eigen::MatrixXd GetBounds() const
box_qp_old.h
exotica::BoxQPSolution
struct exotica::BoxQPSolution BoxQPSolution
exotica::AbstractTimeIndexedProblem::GetEqualityJacobian
Eigen::SparseMatrix< double > GetEqualityJacobian() const
exotica::PlanningProblem::GetTaskMaps
TaskMapMap & GetTaskMaps()
visualization_meshcat.h
exotica::UnconstrainedEndPoseProblem::W
Eigen::MatrixXd W
exotica::BoundedEndPoseProblem::num_tasks
int num_tasks
ThrowPretty
#define ThrowPretty(m)
exotica::DynamicTimeIndexedShootingProblem::get_X_star
const Eigen::MatrixXd & get_X_star() const
exotica::PlanningProblem::GetStartTime
double GetStartTime() const
exotica::ToString
std::string ToString(const Eigen::Isometry3d &s)
exotica::PlanningProblem::GetNumberOfIterations
int GetNumberOfIterations() const
exotica::Scene::get_world_links_to_exclude_from_collision_scene
const std::set< std::string > & get_world_links_to_exclude_from_collision_scene() const
exotica::TimeIndexedTask::ddPhi_ddx
std::vector< Hessian > ddPhi_ddx
exotica::SamplingProblem::Update
void Update(Eigen::VectorXdRefConst x)
exotica::KinematicElement::shape
shapes::ShapeConstPtr shape
exotica::Scene::RemoveObject
void RemoveObject(const std::string &name)
exotica::CollisionProxy::distance
double distance
exotica::PlanningProblem
shapes::Shape::isFixed
virtual bool isFixed() const
exotica::KinematicResponse
shapes::Plane::STRING_NAME
static const std::string STRING_NAME
exotica::AbstractDynamicsSolver::get_num_positions
int get_num_positions() const
exotica::XMLLoader::Load
static Initializer Load(std::string file_name, bool parsePathAsXML=false)
WARNING_NAMED
#define WARNING_NAMED(name, x)
exotica::Scene::GetControlledJointToCollisionLinkMap
const std::map< std::string, std::vector< std::string > > & GetControlledJointToCollisionLinkMap() const
exotica::BoundedEndPoseProblem::GetBounds
Eigen::MatrixXd GetBounds() const
exotica::KinematicElement::is_robot_link
bool is_robot_link
exotica::TaskIndexing::length
int length
exotica::LoadOctreeAsShape
std::shared_ptr< shapes::Shape > LoadOctreeAsShape(const std::string &file_path)
exotica::EndPoseProblem::SetGoal
void SetGoal(const std::string &task_name, Eigen::VectorXdRefConst goal)
exotica::UnconstrainedEndPoseProblem::GetGoal
Eigen::VectorXd GetGoal(const std::string &task_name) const
exotica::AbstractTimeIndexedProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double rho, int t=0)
exotica::CollisionScene::GetWorldLinkPadding
double GetWorldLinkPadding() const
shapes::Plane::c
double c
exotica::XMLLoader::LoadSolverStandalone
static std::shared_ptr< exotica::MotionSolver > LoadSolverStandalone(const std::string &file_name)
exotica::TimeIndexedSamplingProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
WARNING
#define WARNING(x)
exotica::SamplingProblem::SetGoalState
void SetGoalState(Eigen::VectorXdRefConst qT)
exotica::AbstractTimeIndexedProblem::GetCostJacobian
Eigen::RowVectorXd GetCostJacobian() const
exotica::KinematicTree::GetKinematicChainLinks
std::vector< std::string > GetKinematicChainLinks(const std::string &begin, const std::string &end) const
exotica::KinematicElement::id
int id
exotica::Scene::GetModelLinkToCollisionLinkMap
const std::map< std::string, std::vector< std::string > > & GetModelLinkToCollisionLinkMap() const
exotica::AbstractDynamicsSolver::f
virtual StateVector f(const StateVector &x, const ControlVector &u)=0
exotica::EndPoseProblem::length_jacobian
int length_jacobian
exotica::CollisionProxy
exotica::DynamicTimeIndexedShootingProblem::GetControlCostHessian
Eigen::MatrixXd GetControlCostHessian(int t)
exotica::BoundedEndPoseProblem::GetRho
double GetRho(const std::string &task_name)
exotica::KinematicTree::GetTree
const std::vector< std::weak_ptr< KinematicElement > > & GetTree() const
exotica::PlanningProblem::ApplyStartState
virtual Eigen::VectorXd ApplyStartState(bool update_traj=true)
exotica::TimeIndexedSamplingProblem::GetRhoEQ
double GetRhoEQ(const std::string &task_name)
exotica::Property
shapes::Cylinder::radius
double radius
exotica::EndPoseTask::SetRho
void SetRho(const std::string &task_name, const double rho_in)
exotica::TimeIndexedSamplingProblem::SetRhoNEQ
void SetRhoNEQ(const std::string &task_name, const double &rho)
exotica::BoundedEndPoseProblem::SetRho
void SetRho(const std::string &task_name, const double &rho)
exotica::EndPoseProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name)
exotica::Task::tasks
TaskMapVec tasks
exotica::Setup::PrintSupportedClasses
static void PrintSupportedClasses()
init
void init(const M_string &remappings)
pybind11
exotica::AbstractTimeIndexedProblem::SetGoalEQ
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0)
exotica::AbstractTimeIndexedProblem::inequality
TimeIndexedTask inequality
exotica::BoxQPSolution::x
Eigen::VectorXd x
shapes::ShapeConstPtr
std::shared_ptr< const Shape > ShapeConstPtr
exotica::TaskSpaceVector::data
Eigen::VectorXd data
pybind11::detail::type_caster< Initializer >::cast
static handle cast(Initializer src, return_value_policy, handle)
Definition: pyexotica.cpp:557
exotica::EndPoseProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name)
exotica::TerminationCriterion::UserDefined
@ UserDefined
exotica::KinematicTree::SetSeed
void SetSeed(const uint_fast32_t seed)
exotica::AbstractDynamicsSolver::get_integrator
Integrator get_integrator() const
exotica::KinematicTree::Jacobian
Eigen::MatrixXd Jacobian(const std::string &element_A, const KDL::Frame &offset_a, const std::string &element_B, const KDL::Frame &offset_b) const
x
double x
pybind11::detail::type_caster< Initializer >::InitializerToTuple
static PyObject * InitializerToTuple(const Initializer &src)
Definition: pyexotica.cpp:473
exotica::KinematicTree::SetPlanarBaseLimitsPosXYEulerZ
void SetPlanarBaseLimitsPosXYEulerZ(const std::vector< double > &lower, const std::vector< double > &upper)
exotica::UnconstrainedEndPoseProblem::GetHessian
Eigen::MatrixXd GetHessian() const
exotica::SamplingProblem::equality
SamplingTask equality
exotica::EndPoseProblem::SetRho
void SetRho(const std::string &task_name, const double &rho)
exotica::KinematicTree::ResetJointLimits
void ResetJointLimits()
shapes::Cylinder::length
double length
exotica::AbstractDynamicsSolver::fu_fd
ControlDerivative fu_fd(const StateVector &x, const ControlVector &u)
exotica::UnconstrainedEndPoseProblem::GetRho
double GetRho(const std::string &task_name) const
exotica::CollisionProxy::contact1
Eigen::Vector3d contact1
exotica::Timer::Reset
void Reset()
exotica::EndPoseProblem::PreUpdate
void PreUpdate() override
exotica::KinematicTree::GetCollisionObjectTypes
std::map< std::string, shapes::ShapeType > GetCollisionObjectTypes() const
exotica::LoadOctree
std::shared_ptr< octomap::OcTree > LoadOctree(const std::string &file_path)
exotica::CollisionProxy::normal2
Eigen::Vector3d normal2
exotica::PlanningProblem::get_num_velocities
int get_num_velocities() const
exotica::TimeIndexedTask::y
std::vector< TaskSpaceVector > y
exotica::PathExists
bool PathExists(const std::string &path)
exotica::BoxQPSolution::free_idx
std::vector< size_t > free_idx
exotica::AbstractTimeIndexedProblem::GetTau
double GetTau() const
exotica::PlanningProblem::PreUpdate
virtual void PreUpdate()
exotica::EndPoseProblem::inequality
EndPoseTask inequality
exotica::AbstractDynamicsSolver::Simulate
StateVector Simulate(const StateVector &x, const ControlVector &u, T t)
exotica::PlanningProblem::GetCostEvolution
std::pair< std::vector< double >, std::vector< double > > GetCostEvolution() const
exotica::AbstractTimeIndexedProblem::length_Phi
int length_Phi
exotica::VisualizationMeshcat::GetWebURL
std::string GetWebURL()
exotica::huber_cost
double huber_cost(double x, double beta)
exotica::Scene::UpdatePlanningSceneWorld
void UpdatePlanningSceneWorld(const moveit_msgs::PlanningSceneWorldConstPtr &world)
exotica::Property::Set
void Set(const C val)
exotica::BoundedEndPoseProblem::GetScalarCost
double GetScalarCost() const
exotica::AbstractDynamicsSolver::GetPosition
virtual Eigen::Matrix< T, Eigen::Dynamic, 1 > GetPosition(Eigen::VectorXdRefConst x_in)
shapes::Cone::STRING_NAME
static const std::string STRING_NAME
exotica::CollisionProxy::Print
std::string Print() const
exotica::GetTypeName
std::string GetTypeName(const std::type_info &type)
shapes::Plane::b
double b
exotica::AbstractDynamicsSolver::StateDelta
virtual StateVector StateDelta(const StateVector &x_1, const StateVector &x_2)
exotica::PlanningProblem::IsValid
virtual bool IsValid()
exotica::SamplingProblem::GetGoalNEQ
Eigen::VectorXd GetGoalNEQ(const std::string &task_name)
exotica::pseudo_huber_hessian
double pseudo_huber_hessian(double x, double beta)
exotica::TaskMap::start
int start
exotica::Property::GetType
std::string GetType() const
exotica::TimeIndexedSamplingProblem::equality
SamplingTask equality
exotica::DynamicTimeIndexedShootingProblem::GetStateControlCostHessian
Eigen::MatrixXd GetStateControlCostHessian()
exotica::DynamicTimeIndexedShootingProblem::set_T
void set_T(const int &T_in)
exotica::MotionSolver::SpecifyProblem
virtual void SpecifyProblem(PlanningProblemPtr pointer)
exotica::AbstractTimeIndexedProblem::GetScalarTransitionJacobian
Eigen::RowVectorXd GetScalarTransitionJacobian(int t) const
exotica::KinematicElement::GetPose
KDL::Frame GetPose(const double &x=0.0)
exotica::DynamicTimeIndexedShootingProblem::get_T
const int & get_T() const
exotica::EndPoseProblem::GetScalarJacobian
Eigen::RowVectorXd GetScalarJacobian()
exotica::KinematicTree::GetNumModelJoints
int GetNumModelJoints() const
hessian_array
py::handle hessian_array(Hessian &inp)
Definition: pyexotica.cpp:597
exotica::CollisionScene::SetRobotLinkPadding
void SetRobotLinkPadding(const double padding)
exotica::pseudo_huber_cost
double pseudo_huber_cost(double x, double beta)
pybind11::detail::type_caster< Initializer >::AddPropertyFromDict
bool AddPropertyFromDict(Property &target, PyObject *value_py)
Definition: pyexotica.cpp:202
exotica::AbstractTimeIndexedProblem::W
Eigen::MatrixXd W
exotica::KinematicTree::PublishFrames
void PublishFrames(const std::string &tf_prefix="exotica")
exotica::AbstractDynamicsSolver::F
virtual StateVector F(const StateVector &x, const ControlVector &u)
exotica::Setup::GetProblems
static std::vector< std::string > GetProblems()
exotica::PlanningProblem::GetScene
ScenePtr GetScene() const
exotica::DynamicTimeIndexedShootingProblem::get_tau
const double & get_tau() const
exotica::AbstractTimeIndexedProblem::GetRhoNEQ
double GetRhoNEQ(const std::string &task_name, int t=0)
exotica::AbstractTimeIndexedProblem::GetInequality
Eigen::VectorXd GetInequality() const
exotica::VisualizationMeshcat::DisplayState
void DisplayState(Eigen::VectorXdRefConst state, double t=0.0)
exotica::TaskIndexing::start
int start
exotica::CollisionScene::SetReplacePrimitiveShapesWithMeshes
void SetReplacePrimitiveShapesWithMeshes(const bool value)
exotica::Object::GetObjectName
std::string GetObjectName()
t
geometry_msgs::TransformStamped t
pybind11::detail::type_caster< Initializer >::load
bool load(handle src, bool)
Definition: pyexotica.cpp:468
exotica::KinematicTree::SetJointLimitsUpper
void SetJointLimitsUpper(Eigen::VectorXdRefConst upper_in)
exotica::EndPoseProblem::length_Phi
int length_Phi
exotica::huber_hessian
double huber_hessian(double x, double beta)
exotica::KinematicTree::GetControlledLinkMass
Eigen::VectorXd GetControlledLinkMass() const
exotica::TimeIndexedTask::T
int T
exotica::EndPoseProblem::GetInequalityJacobian
Eigen::MatrixXd GetInequalityJacobian()
exotica::Timer::GetDuration
double GetDuration() const
exotica::ParseBool
bool ParseBool(const std::string value)
exotica::CollisionProxy::e1
std::shared_ptr< KinematicElement > e1
exotica::TimeIndexedSamplingProblem::num_tasks
int num_tasks
exotica::VisualizationMeshcat::Delete
void Delete(const std::string &path="")
PYBIND11_MODULE
PYBIND11_MODULE(_pyexotica, module)
Definition: pyexotica.cpp:672
exotica::UnconstrainedEndPoseProblem::GetScalarTaskCost
double GetScalarTaskCost(const std::string &task_name) const
AddInitializers
void AddInitializers(py::module &module)
Definition: pyexotica.cpp:175
exotica::DynamicTimeIndexedShootingProblem::GetStateCost
double GetStateCost(int t) const
exotica::AbstractDynamicsSolver::set_integrator
void set_integrator(Integrator integrator_in)
exotica::TaskMap::TaskSpaceDim
virtual int TaskSpaceDim()=0
exotica::Setup::GetSolvers
static std::vector< std::string > GetSolvers()
exotica::version
const char version[]
exotica::DynamicTimeIndexedShootingProblem::set_control_cost_weight
void set_control_cost_weight(const double control_cost_weight_in)
exotica::EndPoseTask::ydiff
Eigen::VectorXd ydiff
exotica::MotionSolver::GetProblem
PlanningProblemPtr GetProblem() const
exotica::KinematicTree::GetUsedJointLimits
std::map< std::string, std::vector< double > > GetUsedJointLimits() const
exotica::TimeIndexedSamplingProblem::GetGoalState
Eigen::VectorXd GetGoalState() const
exotica::EndPoseProblem::GetRho
double GetRho(const std::string &task_name)
exotica::TaskSpaceVector::SetZero
void SetZero(const int n)
exotica::UnconstrainedEndPoseProblem::SetRho
void SetRho(const std::string &task_name, const double &rho)
exotica::SamplingProblem::inequality
SamplingTask inequality
exotica::SamplingTask::S
Eigen::MatrixXd S
exotica::ParseList
std::vector< std::string > ParseList(const std::string &value, char token=',')
LoadFromXML
std::pair< Initializer, Initializer > LoadFromXML(std::string file_name, const std::string &solver_name="", const std::string &problem_name="", bool parsePathAsXML=false)
Definition: pyexotica.cpp:168


exotica_python
Author(s):
autogenerated on Fri Aug 2 2024 08:44:00