-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first fully-working set_pose from python
Former-commit-id: fc8bf97f39c727755baabff803525dd275ab8741 [formerly afed3c5] Former-commit-id: 23c9d78e6fe9f6619c8cdaa5aa1b3772c2140bd7
- Loading branch information
Showing
12 changed files
with
191 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
mvsim | ||
mvsim std |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pymvsim_comms.cpp | ||
std/exception.cpp | ||
std/stdexcept.cpp | ||
mvsim/Comms/common.cpp | ||
mvsim/Comms/Client.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <exception> | ||
#include <sstream> // __str__ | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <functional> | ||
#include <string> | ||
#include <pybind11/stl.h> | ||
|
||
|
||
#ifndef BINDER_PYBIND11_TYPE_CASTER | ||
#define BINDER_PYBIND11_TYPE_CASTER | ||
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>); | ||
PYBIND11_DECLARE_HOLDER_TYPE(T, T*); | ||
PYBIND11_MAKE_OPAQUE(std::shared_ptr<void>); | ||
#endif | ||
|
||
// std::exception file:bits/exception.h line:60 | ||
struct PyCallBack_std_exception : public std::exception { | ||
using std::exception::exception; | ||
|
||
const char * what() const noexcept override { | ||
pybind11::gil_scoped_acquire gil; | ||
pybind11::function overload = pybind11::get_overload(static_cast<const std::exception *>(this), "what"); | ||
if (overload) { | ||
auto o = overload.operator()<pybind11::return_value_policy::reference>(); | ||
if (pybind11::detail::cast_is_temporary_value_reference<const char *>::value) { | ||
static pybind11::detail::overload_caster_t<const char *> caster; | ||
return pybind11::detail::cast_ref<const char *>(std::move(o), caster); | ||
} | ||
else return pybind11::detail::cast_safe<const char *>(std::move(o)); | ||
} | ||
return exception::what(); | ||
} | ||
}; | ||
|
||
void bind_std_exception(std::function< pybind11::module &(std::string const &namespace_) > &M) | ||
{ | ||
{ // std::exception file:bits/exception.h line:60 | ||
pybind11::class_<std::exception, std::shared_ptr<std::exception>, PyCallBack_std_exception> cl(M("std"), "exception", ""); | ||
cl.def( pybind11::init( [](){ return new std::exception(); }, [](){ return new PyCallBack_std_exception(); } ) ); | ||
cl.def( pybind11::init( [](PyCallBack_std_exception const &o){ return new PyCallBack_std_exception(o); } ) ); | ||
cl.def( pybind11::init( [](std::exception const &o){ return new std::exception(o); } ) ); | ||
cl.def("assign", (class std::exception & (std::exception::*)(const class std::exception &)) &std::exception::operator=, "C++: std::exception::operator=(const class std::exception &) --> class std::exception &", pybind11::return_value_policy::automatic, pybind11::arg("")); | ||
cl.def("what", (const char * (std::exception::*)() const) &std::exception::what, "C++: std::exception::what() const --> const char *", pybind11::return_value_policy::automatic); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <iterator> | ||
#include <memory> | ||
#include <sstream> // __str__ | ||
#include <stdexcept> | ||
#include <string> | ||
|
||
#include <pybind11/pybind11.h> | ||
#include <functional> | ||
#include <string> | ||
#include <pybind11/stl.h> | ||
|
||
|
||
#ifndef BINDER_PYBIND11_TYPE_CASTER | ||
#define BINDER_PYBIND11_TYPE_CASTER | ||
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>); | ||
PYBIND11_DECLARE_HOLDER_TYPE(T, T*); | ||
PYBIND11_MAKE_OPAQUE(std::shared_ptr<void>); | ||
#endif | ||
|
||
// std::runtime_error file:stdexcept line:219 | ||
struct PyCallBack_std_runtime_error : public std::runtime_error { | ||
using std::runtime_error::runtime_error; | ||
|
||
const char * what() const noexcept override { | ||
pybind11::gil_scoped_acquire gil; | ||
pybind11::function overload = pybind11::get_overload(static_cast<const std::runtime_error *>(this), "what"); | ||
if (overload) { | ||
auto o = overload.operator()<pybind11::return_value_policy::reference>(); | ||
if (pybind11::detail::cast_is_temporary_value_reference<const char *>::value) { | ||
static pybind11::detail::overload_caster_t<const char *> caster; | ||
return pybind11::detail::cast_ref<const char *>(std::move(o), caster); | ||
} | ||
else return pybind11::detail::cast_safe<const char *>(std::move(o)); | ||
} | ||
return runtime_error::what(); | ||
} | ||
}; | ||
|
||
void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M) | ||
{ | ||
{ // std::runtime_error file:stdexcept line:219 | ||
pybind11::class_<std::runtime_error, std::shared_ptr<std::runtime_error>, PyCallBack_std_runtime_error, std::exception> cl(M("std"), "runtime_error", ""); | ||
cl.def( pybind11::init<const std::string &>(), pybind11::arg("__arg") ); | ||
|
||
cl.def( pybind11::init<const char *>(), pybind11::arg("") ); | ||
|
||
cl.def( pybind11::init( [](PyCallBack_std_runtime_error const &o){ return new PyCallBack_std_runtime_error(o); } ) ); | ||
cl.def( pybind11::init( [](std::runtime_error const &o){ return new std::runtime_error(o); } ) ); | ||
cl.def("assign", (class std::runtime_error & (std::runtime_error::*)(const class std::runtime_error &)) &std::runtime_error::operator=, "C++: std::runtime_error::operator=(const class std::runtime_error &) --> class std::runtime_error &", pybind11::return_value_policy::automatic, pybind11::arg("")); | ||
cl.def("what", (const char * (std::runtime_error::*)() const) &std::runtime_error::what, "C++: std::runtime_error::what() const --> const char *", pybind11::return_value_policy::automatic); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
+namespace mvsim | ||
-namespace mrpt | ||
-namespace std | ||
+include <pybind11/stl.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters