11 typedef bp::return_value_policy<bp::reference_existing_object>
15 bp::import(
"dynamic_graph");
18 bp::class_<PeriodicCall, boost::noncopyable>(
"PeriodicCall", bp::no_init)
20 static_cast<void (PeriodicCall::*)(
const std::string &,
23 "Add the signal to the refresh list", (bp::arg(
"name"),
"signal"))
25 static_cast<void (PeriodicCall::*)(
const std::string &)
>(
27 "Add the signal to the refresh list", (bp::arg(
"signal_name")))
29 .def(
"addDownsampledSignal",
30 static_cast<void (PeriodicCall::*)(
33 "Add the signal to the refresh list\n"
34 "The downsampling factor: 1 means every time, "
35 "2 means every other time, etc...",
36 (bp::arg(
"name"),
"signal",
"factor"))
37 .def(
"addDownsampledSignal",
38 static_cast<void (PeriodicCall::*)(
const std::string &,
39 const std::size_t &)
>(
41 "Add the signal to the refresh list\n"
42 "The downsampling factor: 1 means every time, "
43 "2 means every other time, etc...",
44 (bp::arg(
"signal_name"),
"factor"))
47 "Remove the signal to the refresh list", bp::arg(
"name"))
49 "Clear all signals and commands from the refresh list.")
51 "__str__", +[](
const PeriodicCall &e) {
52 std::ostringstream os;
57 dynamicgraph::python::exposeEntity<dgs::Device>().def(
59 "Get number of joints controlled by the device.");
62 bp::class_<Flags>(
"Flags", bp::init<>())
63 .def(bp::init<const char *>())
64 .def(
"__init__", bp::make_constructor(+[](bp::list bools) {
65 std::vector<bool> flags(bp::len(bools));
66 for (std::size_t
i = 0;
i < flags.size(); ++
i)
67 flags[
i] = bp::extract<bool>(bools[
i]);
68 return new Flags(flags);
70 .def(
"__init__", bp::make_constructor(+[](bp::tuple bools) {
71 std::vector<bool> flags(bp::len(bools));
72 for (std::size_t
i = 0;
i < flags.size(); ++
i)
73 flags[
i] = bp::extract<bool>(bools[
i]);
74 return new Flags(flags);
80 .def(bp::self & bp::self)
81 .def(bp::self | bp::self)
82 .def(bp::self &= bp::self)
83 .def(bp::self |= bp::self)
85 .def(
"__call__", &Flags::operator())
86 .
def(
"__bool__", &Flags::operator
bool)
87 .def(
"reversed", &Flags::operator!)
91 +[](Flags &
f,
const std::string &
s) {
92 std::istringstream is(
s);
96 "__str__", +[](
const Flags &
f) {
97 std::ostringstream os;
102 dg::python::exposeSignalsOfType<Flags, dg::sigtime_t>(
"Flags");
103 dg::python::exposeEntity<dgs::Integrator, bp::bases<dg::Entity>,
104 dg::python::AddCommands>()
105 .add_property(
"after",
108 .add_property(
"before",
111 .add_property(
"model",
118 typedef dgs::internal::Signal S_t;
119 bp::class_<S_t, bp::bases<dg::Signal<dg::Vector, dg::sigtime_t> >,
121 obj(
"SignalIntegratorVector", bp::init<std::string>());
124 bp::make_function(&S_t::accessCopy,
125 bp::return_value_policy<bp::copy_const_reference>()),
127 "the signal value.\n"
128 "warning: for Eigen objects, sig.value[0] = 1. may not work).");