personalrobotics / chimera Goto Github PK
View Code? Open in Web Editor NEW:snake: A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
License: BSD 3-Clause "New" or "Revised" License
:snake: A CLI tool for generating Boost.Python/pybind11 bindings from C/C++
License: BSD 3-Clause "New" or "Revised" License
This would have to be a straight string substitution. It's up to the user to make sure that the substitution is valid and has no side effects.
chimera: /usr/lib/llvm-3.7/include/clang/AST/DeclCXX.h:592: struct DefinitionData &clang::CXXRecordDecl::data() const: Assertion `DD && "queried property of class with no definition"' failed.
In _ZN4dart5utils10c3d_head_tE.cpp
we get the error:
/usr/include/boost/python/data_members.hpp:64:22: error: array type 'short [244]' is not assignable
c.*m_which = d;
~~~~~~~~~~ ^
The main .cpp
file must register the class_
declarations in an order that matches the inheritance hierarchy; i.e. all parent classes must be emitted before a child class.
In _ZN4dart6common6SignalIFT_DpT0_ET1_EE.cpp
we generated:
::boost::python::class_<dart::common::Signal<type-parameter-0-0 (type-parameter-0-1...), Combiner>, ::boost::noncopyable >("Signal", boost::python::no_init)
E.g. dynamics::HierarchicalIK::Constraint
I need this to add additional functions to Chimera classes.
/home/mkoval/storage/dart-ws/devel/include/dart/dynamics/detail/BodyNodePtr.h:52:14: note: copy constructor of 'MutexedWeakSkeletonPtr' is implicitly deleted because field 'mMutex' has a deleted copy constructor
std::mutex mMutex;
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/mutex:128:5: note: 'mutex' has been explicitly marked deleted here
mutex(const mutex&) = delete;
^
These are currently suppressed.
I copied this type out of the Chimera output, but I get this error message if I try to use it in the YAML configuration file:
chimera.util.resolveDeclaration:1:184: error: expected ')'
dart::dynamics::AddonWithProtectedPropertiesInSkeleton<dart::dynamics::detail::EulerJointAddon, dart::dynamics::detail::EulerJointUniqueProperties, dart::dynamics::EulerJoint, &(void dart::dynamics::detail::JointPropertyUpdate<dart::dynamics::detail::EulerJointAddon>(dart::dynamics::detail::EulerJointAddon*)), false>;
^
I'll break that up a bit:
dart::dynamics::AddonWithProtectedPropertiesInSkeleton<
dart::dynamics::detail::EulerJointAddon,
dart::dynamics::detail::EulerJointUniqueProperties,
dart::dynamics::EulerJoint,
&(void dart::dynamics::detail::JointPropertyUpdate< // ERROR
dart::dynamics::detail::EulerJointAddon>( // ERROR
dart::dynamics::detail::EulerJointAddon*)), // ERROR
false>;
I don't even think the syntax on those three lines is valid. Any idea what is going on here?
The constructors we generate look like this:
.def(::boost::python::init<double, double, double, double, double, bool>()
We should be passing an args()
structure to name them, just like we do for methods.
Chimera just generated this code:
.def(::boost::python::init<const MultiDofJoint<3>::Properties &, const PlanarJoint::UniqueProperties &>())
These constructor arguments should be fully qualified, e.g. dart::dynamics::MultiDofJoint<3>::Properties
.
For example:
dart::dynamics::MultiDofJoint::Properties
E.g.:
.def_readwrite("stuff", &dart::utils::c3d_head_t::stuff)
It would be useful to be able to pass a namespace from the command line instead of having to create a configuration YAML file.
/homes/mkoval/dartpy-ws/devel/include/dart/common/AddonManager.h:170:29: error: ‘template<class T> struct dart::common::AddonManager::type’ is protected
template <class T> struct type { };
This is a special case of #60.
typename Derived::PlainObject AdTJacFixed(const Eigen::Isometry3d& _T,
const Eigen::MatrixBase<Derived>& _J)
produces this code:
boost::python::def("AdTJacFixed", static_cast<typename type-parameter-0-0::PlainObject (*)(const Eigen::Transform<double, 3, 1, 0> &, const MatrixBase<type-parameter-0-0> &)>(&dart::math::AdTJacFixed), (::boost::python::arg("_T"), ::boost::python::arg("_J")))
This applies to types that are forward declared in the header file, but the full definition is not available. For example:
/usr/include/boost/python/type_id.hpp:85:9: error: 'typeid' of incomplete type 'Ipopt::IpoptData'
typeid(T)
in _ZN4dart9optimizer8DartTNLPE.cpp
.
.add_static_property("UpdateProperties", ::boost::python::make_getter(dart::dynamics::AddonWithProtectedPropertiesInSkeleton<dart::dynamics::detail::PlanarJointAddon, dart::dynamics::detail::PlanarJointUniqueProperties, dart::dynamics::PlanarJoint, &dart::dynamics::detail::JointPropertyUpdate, false>::UpdateProperties))
In _ZN4dart3gui6JitterE.cpp
we generated:
.add_static_property("j2", []() { return dart::gui::Jitter::j2; }, [](jitter_point [2] value) { dart::gui::Jitter::j2 = value; })
It should output something like std::numeric_limits<double>::infinity()
. This will also likely break on special values like NaN.
This was generated with no entry in the YAML file:
::boost::python::class_<dart::common::Signal<void (std::shared_ptr<const dart::dynamics::MetaSkeleton>, const std::basic_string<char> &, const std::basic_string<char> &), signal::detail::DefaultCombiner>, ::boost::noncopyable >("Signal", boost::python::no_init)
Note that the class is named Signal
, even though there are likely multiple instantiations of this class. This will cause a name conflict in Python.
This is necessary to register some custom converters, e.g. Boost.NumPy_Eigen.
/home/mkoval/storage/dartpy-ws/src/dartpy/src_generated/_ZN4dart8dynamics46AddonWithProtectedStateAndPropertiesInSkeleton8OptionalE.cpp:11:61: error:
'AddonWithProtectedStateAndPropertiesInSkeleton' is not a class, namespace, or enumeration
::boost::python::scope().attr("Optional") = dart::dynamics::AddonWithProtectedStateAndPropertiesInSkeleton::Optional;
/home/mkoval/storage/dart-ws/devel/include/dart/common/Signal.h:240:27: note: copy assignment operator of 'SlotRegister<dart::common::Signal<void (const dart::dynamics::BodyNode *), signal::detail::DefaultCombiner> >' is implicitly deleted because field 'mSignal' is of reference type 'typename Signal<void (const BodyNode *), signal::detail::DefaultCombiner>::SignalType &' (aka 'Signal<void (const dart::dynamics::BodyNode *)> &')
typename T::SignalType& mSignal;
ImportError: ./dartpy.so: undefined symbol: _ZN4dart8dynamics38AddonWithProtectedPropertiesInSkeletonINS0_6detail15ScrewJointAddonENS2_26ScrewJointUniquePropertiesENS0_10ScrewJointEXadL_ZNS2_19JointPropertyUpdateIS3_EEvPT_EELb0EE8OptionalE
This expands to:
dart::dynamics::AddonWithProtectedPropertiesInSkeleton<dart::dynamics::detail::ScrewJointAddon, dart::dynamics::detail::ScrewJointUniqueProperties, dart::dynamics::ScrewJoint, &(void dart::dynamics::detail::JointPropertyUpdate<dart::dynamics::detail::ScrewJointAddon>(dart::dynamics::detail::ScrewJointAddon*)), false>::Optional
This requires integration with the YAML configuration file.
E.g.:
$ python -c 'import dartpy'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: ./dartpy.so: undefined symbol: _ZTIN4dart9optimizer8DartTNLPE
_ZTIN4dart9optimizer8DartTNLPE
demangles to typeinfo for dart::optimizer::DartTNLP
.
For example:
/tmp/chimera_output/_ZN4dart3gui12jitter_pointE.cpp:11:33: error: unexpected parenthesis after '::'
.def_readwrite("x", &dart::gui::(anonymous struct)::x)
E.g.:
/tmp/dartpy/_ZN4dart9optimizer21GradientDescentSolverE.cpp:35:168: error: no viable overloaded '='
.add_static_property("Type", []() { return dart::optimizer::GradientDescentSolver::Type; }, [](const std::string value) { dart::optimizer::GradientDescentSolver::Type = value; })
This requires replacing the using Foo;
generated code with a typedef Foo Foo_t
(preferable) or using Foo_t = Foo
statement.
In _ZN4dart9optimizer6Solver10PropertiesE.cpp
we generate:
/tmp/dartpy/_ZN4dart9optimizer6Solver10PropertiesE.cpp:11:368: error: use of undeclared identifier 'cout'; did you mean 'std::cout'?
...= 500, ::boost::python::arg("_iterationsPerPrint") = 0, ::boost::python::arg("_ostream") = &cout, ::boost::python::arg("_printFinalRes...
^~~~
std::cout
::boost::python::class_<dart::common::Signal<void (std::shared_ptr<const dart::dynamics::MetaSkeleton>, const std::basic_string<char> &, const std::basic_string<char> &), signal::detail::DefaultCombiner>, ::boost::noncopyable >("Signal", boost::python::no_init)
Note that signal::detail::DefaultCombiner
should be dart::common::signal::detail::DefaultCombiner
.
terminate called after throwing an instance of 'YAML::BadSubscript'
what(): yaml-cpp: error at line 0, column 0: operator[] call on a scalar
Aborted (core dumped)
For example:
.def_readwrite("onNameChanged", &dart::simulation::World::onNameChanged)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.