Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed Nov 13, 2020
1 parent 96916ab commit 5921e17
Show file tree
Hide file tree
Showing 22 changed files with 329 additions and 303 deletions.
4 changes: 2 additions & 2 deletions include/sot/core/device.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public:
void setTorqueBounds(const Vector &lower, const Vector &upper);
/// \}

PeriodicCall& periodicCallBefore() { return periodicCallBefore_; }
PeriodicCall& periodicCallAfter() { return periodicCallAfter_; }
PeriodicCall &periodicCallBefore() { return periodicCallBefore_; }
PeriodicCall &periodicCallAfter() { return periodicCallAfter_; }

public: /* --- DISPLAY --- */
virtual void display(std::ostream &os) const;
Expand Down
2 changes: 1 addition & 1 deletion include/sot/core/flags.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <vector>

/* SOT */
#include <dynamic-graph/signal-caster.h>
#include "sot/core/api.hh"
#include <dynamic-graph/signal-caster.h>

/* --------------------------------------------------------------------- */
/* --- CLASS ----------------------------------------------------------- */
Expand Down
14 changes: 6 additions & 8 deletions include/sot/core/integrator-abstract.hh
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,19 @@ public:
void popNumCoef() { numerator.pop_back(); }
void popDenomCoef() { denominator.pop_back(); }

const std::vector<coefT>& numCoeffs() const { return numerator; }
void numCoeffs(const std::vector<coefT>& coeffs) { numerator = coeffs; }
const std::vector<coefT> &numCoeffs() const { return numerator; }
void numCoeffs(const std::vector<coefT> &coeffs) { numerator = coeffs; }

const std::vector<coefT>& denomCoeffs() const { return denominator; }
void denomCoeffs(const std::vector<coefT>& coeffs) { denominator = coeffs; }
const std::vector<coefT> &denomCoeffs() const { return denominator; }
void denomCoeffs(const std::vector<coefT> &coeffs) { denominator = coeffs; }

public:
dynamicgraph::SignalPtr<sigT, int> SIN;

dynamicgraph::SignalTimeDependent<sigT, int> SOUT;

virtual void display(std::ostream &os) const
{
os << this->getClassName() << ": " << getName() << '\n'
<< " ";
virtual void display(std::ostream &os) const {
os << this->getClassName() << ": " << getName() << '\n' << " ";
if (numerator.empty() || denominator.empty()) {
os << "ill-formed.";
return;
Expand Down
10 changes: 5 additions & 5 deletions include/sot/core/mailbox.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ namespace sot {

namespace dg = dynamicgraph;

template <class Object> struct MailboxTimestampedObject
{
template <class Object> struct MailboxTimestampedObject {
Object obj;
struct timeval timestamp;
};
Expand Down Expand Up @@ -73,10 +72,11 @@ public: /* --- SIGNALS --- */

} /* namespace sot */

template <class Object> struct signal_io<sot::MailboxTimestampedObject<Object> >
: signal_io_unimplemented<sot::MailboxTimestampedObject<Object> > {};
template <class Object>
struct signal_io<sot::MailboxTimestampedObject<Object> >
: signal_io_unimplemented<sot::MailboxTimestampedObject<Object> > {};

template <> struct signal_io<timeval> : signal_io_unimplemented<timeval > {};
template <> struct signal_io<timeval> : signal_io_unimplemented<timeval> {};
} /* namespace dynamicgraph */

#endif // #ifndef __SOT_MAILBOX_HH
5 changes: 3 additions & 2 deletions include/sot/core/multi-bound.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include <vector>

/* SOT */
#include <dynamic-graph/signal-caster.h>
#include "sot/core/api.hh"
#include <dynamic-graph/signal-caster.h>
#include <sot/core/exception-task.hh>

/* --------------------------------------------------------------------- */
Expand Down Expand Up @@ -73,7 +73,8 @@ SOT_CORE_EXPORT std::istream &operator>>(std::istream &os, VectorMultiBound &v);

} /* namespace sot */

template <> struct signal_io<sot::MultiBound> : signal_io_unimplemented<sot::MultiBound> {};
template <>
struct signal_io<sot::MultiBound> : signal_io_unimplemented<sot::MultiBound> {};
} /* namespace dynamicgraph */

#endif // #ifndef __SOT_MultiBound_H__
3 changes: 2 additions & 1 deletion include/sot/core/trajectory.hh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ public:
};
} // namespace sot

template <> struct signal_io<sot::Trajectory> : signal_io_unimplemented<sot::Trajectory> {};
template <>
struct signal_io<sot::Trajectory> : signal_io_unimplemented<sot::Trajectory> {};

} // namespace dynamicgraph

Expand Down
3 changes: 1 addition & 2 deletions include/sot/core/variadic-op.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public: /* --- SIGNAL --- */

int getSignalNumber() const { return (int)signalsIN.size(); }

signal_t* getSignalIn(int i)
{
signal_t *getSignalIn(int i) {
if (i < 0 || i >= (int)signalsIN.size())
throw std::out_of_range("Wrong signal index");
return signalsIN[i];
Expand Down
3 changes: 2 additions & 1 deletion include/sot/core/vector-to-rotation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
namespace dynamicgraph {
namespace sot {

class SOTVECTORTOROTATION_EXPORT VectorToRotation : public dynamicgraph::Entity {
class SOTVECTORTOROTATION_EXPORT VectorToRotation
: public dynamicgraph::Entity {
enum sotAxis { AXIS_X, AXIS_Y, AXIS_Z };

unsigned int size;
Expand Down
3 changes: 2 additions & 1 deletion src/control/admittance-control-op-point-python.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <sot/core/admittance-control-op-point.hh>

typedef boost::mpl::vector<dynamicgraph::sot::core::AdmittanceControlOpPoint> entities_t;
typedef boost::mpl::vector<dynamicgraph::sot::core::AdmittanceControlOpPoint>
entities_t;
3 changes: 2 additions & 1 deletion src/feature/feature-point6d-relative-python.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <sot/core/feature-point6d-relative.hh>

typedef boost::mpl::vector<dynamicgraph::sot::FeaturePoint6dRelative> entities_t;
typedef boost::mpl::vector<dynamicgraph::sot::FeaturePoint6dRelative>
entities_t;
7 changes: 3 additions & 4 deletions src/feature/feature-pose-python.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace dgs = dynamicgraph::sot;

typedef boost::mpl::vector<
dgs::FeaturePose<dgs::SE3Representation>
, dgs::FeaturePose<dgs::R3xSO3Representation>
> entities_t;
typedef boost::mpl::vector<dgs::FeaturePose<dgs::SE3Representation>,
dgs::FeaturePose<dgs::R3xSO3Representation> >
entities_t;
11 changes: 5 additions & 6 deletions src/matrix/derivator-python.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include <sot/core/derivator.hh>

namespace dg = ::dynamicgraph;
typedef boost::mpl::vector<
dg::sot::Derivator<double>
, dg::sot::Derivator<dg::Vector>
, dg::sot::Derivator<dg::Matrix>
, dg::sot::Derivator<dg::sot::VectorQuaternion>
> entities_t;
typedef boost::mpl::vector<dg::sot::Derivator<double>,
dg::sot::Derivator<dg::Vector>,
dg::sot::Derivator<dg::Matrix>,
dg::sot::Derivator<dg::sot::VectorQuaternion> >
entities_t;
9 changes: 4 additions & 5 deletions src/matrix/fir-filter-python.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <sot/core/fir-filter.hh>

namespace dg = ::dynamicgraph;
typedef boost::mpl::vector<
dg::sot::FIRFilter<double, double>
, dg::sot::FIRFilter<dg::Vector, double>
, dg::sot::FIRFilter<dg::Vector, dg::Matrix>
> entities_t;
typedef boost::mpl::vector<dg::sot::FIRFilter<double, double>,
dg::sot::FIRFilter<dg::Vector, double>,
dg::sot::FIRFilter<dg::Vector, dg::Matrix> >
entities_t;
34 changes: 20 additions & 14 deletions src/matrix/integrator-euler-python-module-py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,34 @@
namespace dg = dynamicgraph;
namespace dgc = dynamicgraph::command;
namespace dgs = dynamicgraph::sot;
using dg::Vector;
using dg::Matrix;
using dg::Vector;

template<typename S, typename C> void exposeIntegratorEuler()
{
template <typename S, typename C> void exposeIntegratorEuler() {
typedef dgs::IntegratorEuler<S, C> IE_t;

const std::string cName =
dgc::Value::typeName(dgc::ValueHelper<C>::TypeID);
const std::string cName = dgc::Value::typeName(dgc::ValueHelper<C>::TypeID);

dg::python::exposeEntity<IE_t>()
.add_property("numerators",
+[](const IE_t& e) { return dg::python::to_py_list(e.numCoeffs().begin(), e.numCoeffs().end()); },
+[](IE_t& e, bp::object iterable) { e.numCoeffs(dg::python::to_std_vector<C>(iterable)); })
.add_property("denominators",
+[](const IE_t& e) { return dg::python::to_py_list(e.denomCoeffs().begin(), e.denomCoeffs().end()); },
+[](IE_t& e, bp::object iterable) { e.denomCoeffs(dg::python::to_std_vector<C>(iterable)); })
;
.add_property("numerators",
+[](const IE_t &e) {
return dg::python::to_py_list(e.numCoeffs().begin(),
e.numCoeffs().end());
},
+[](IE_t &e, bp::object iterable) {
e.numCoeffs(dg::python::to_std_vector<C>(iterable));
})
.add_property("denominators",
+[](const IE_t &e) {
return dg::python::to_py_list(e.denomCoeffs().begin(),
e.denomCoeffs().end());
},
+[](IE_t &e, bp::object iterable) {
e.denomCoeffs(dg::python::to_std_vector<C>(iterable));
});
}

BOOST_PYTHON_MODULE(wrap)
{
BOOST_PYTHON_MODULE(wrap) {
bp::import("dynamic_graph");

exposeIntegratorEuler<double, double>();
Expand Down
Loading

0 comments on commit 5921e17

Please sign in to comment.