Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Nov 25, 2020
1 parent 6bf136e commit 3ef00a2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 30 deletions.
8 changes: 4 additions & 4 deletions include/sot/tools/simpleseqplay.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ class SimpleSeqPlay : public dg::Entity {
void start();
virtual std::string getDocString() const;

bool waiting () const;
bool initializing () const;
bool executing () const;
bool finished () const;
bool waiting() const;
bool initializing() const;
bool executing() const;
bool finished() const;

private:
dg::Vector& computePosture(dg::Vector& pos, int t);
Expand Down
32 changes: 12 additions & 20 deletions src/python-module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,24 @@

namespace dgst = dynamicgraph::sot::tools;

typedef boost::mpl::vector<
dgst::CubicInterpolation
, dgst::CubicInterpolationSE3
, dgst::Oscillator
, dgst::Seqplay
> entities_t;
typedef boost::mpl::vector<dgst::CubicInterpolation, dgst::CubicInterpolationSE3, dgst::Oscillator, dgst::Seqplay>
entities_t;

struct register_entity
{
template<typename T> inline void operator()(boost::type<T>) const
{
dynamicgraph::python::exposeEntity<T>();
}
struct register_entity {
template <typename T>
inline void operator()(boost::type<T>) const {
dynamicgraph::python::exposeEntity<T>();
}
};

BOOST_PYTHON_MODULE(wrap)
{
BOOST_PYTHON_MODULE(wrap) {
bp::import("dynamic_graph");
boost::mpl::for_each<entities_t, boost::type<boost::mpl::_> >(register_entity());

using dgst::SimpleSeqPlay;
dynamicgraph::python::exposeEntity<SimpleSeqPlay>()
.def("waiting", &SimpleSeqPlay::waiting)
.def("initializing", &SimpleSeqPlay::initializing)
.def("executing", &SimpleSeqPlay::executing)
.def("finished", &SimpleSeqPlay::finished)
;
.def("waiting", &SimpleSeqPlay::waiting)
.def("initializing", &SimpleSeqPlay::initializing)
.def("executing", &SimpleSeqPlay::executing)
.def("finished", &SimpleSeqPlay::finished);
}

8 changes: 4 additions & 4 deletions src/simpleseqplay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ dg::Vector& SimpleSeqPlay::computePosture(dg::Vector& pos, int t) {
return pos;
}

bool SimpleSeqPlay::waiting () const { return state_ == 0; }
bool SimpleSeqPlay::initializing () const { return state_ == 1; }
bool SimpleSeqPlay::executing () const { return state_ == 2; }
bool SimpleSeqPlay::finished () const { return state_ == 3; }
bool SimpleSeqPlay::waiting() const { return state_ == 0; }
bool SimpleSeqPlay::initializing() const { return state_ == 1; }
bool SimpleSeqPlay::executing() const { return state_ == 2; }
bool SimpleSeqPlay::finished() const { return state_ == 3; }

std::string SimpleSeqPlay::getDocString() const {
return "Provide joint references for a whole-body motion\n"
Expand Down
6 changes: 4 additions & 2 deletions tests/test_simpleseqplay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
BOOST_AUTO_TEST_CASE(test_simpleseqplay) {
dg::sot::tools::SimpleSeqPlay aSimpleSeqPlay("simpleseqplay");

dg::Vector initial (32);
initial << 0.0, 0.0, -0.411354, 0.859395, -0.448041, -0.001708, 0.0, 0.0, -0.411354, 0.859395, -0.448041, -0.001708, 0.0, 0.006761, 0.25847, 0.173046, -0.0002, -0.525366, 0.0, -0.0, 0.1, -0.005, -0.25847, -0.173046, 0.0002, -0.525366, 0.0, 0.0, 0.1, -0.005, 0.0, 0.0;
dg::Vector initial(32);
initial << 0.0, 0.0, -0.411354, 0.859395, -0.448041, -0.001708, 0.0, 0.0, -0.411354, 0.859395, -0.448041, -0.001708,
0.0, 0.006761, 0.25847, 0.173046, -0.0002, -0.525366, 0.0, -0.0, 0.1, -0.005, -0.25847, -0.173046, 0.0002,
-0.525366, 0.0, 0.0, 0.1, -0.005, 0.0, 0.0;
aSimpleSeqPlay.currentPostureSIN_.setConstant(initial);

BOOST_CHECK(aSimpleSeqPlay.waiting());
Expand Down

0 comments on commit 3ef00a2

Please sign in to comment.