diff --git a/.travis/build b/.travis/build deleted file mode 100755 index 0c3cf8b..0000000 --- a/.travis/build +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -set -ev - -# Directories. -root_dir=`pwd` -build_dir="$root_dir/_travis/build" -install_dir="$root_dir/_travis/install" - -# Shortcuts. -git_clone="git clone --quiet --recursive" - -# Create layout. -rm -rf "$build_dir" "$install_dir" -mkdir -p "$build_dir" -mkdir -p "$install_dir" - -# Setup environment variables. -export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" -export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" -export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" - -install_dependency() -{ - echo "--> Compiling $1" - mkdir -p "$build_dir/$1" - cd "$build_dir" - $git_clone "git://github.com/$1" "$1" - cd "$build_dir/$1" - cmake . -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" - make install -} - -# Retrieve jrl-mathtools -install_dependency jrl-umi3218/jrl-mathtools -install_dependency jrl-umi3218/jrl-mal -install_dependency proyan/dynamic-graph -install_dependency proyan/dynamic-graph-python -install_dependency proyan/sot-core - -# Compile and run tests -cd "$build_dir" -cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ - -DCMAKE_CXX_FLAGS="--coverage" \ - -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ - -DCMAKE_MODULE_LINKER_FLAGS="--coverage" \ - -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" -make -make test -make install diff --git a/include/sot/tools/cubic-interpolation-se3.hh b/include/sot/tools/cubic-interpolation-se3.hh index 3cbb68a..4811034 100644 --- a/include/sot/tools/cubic-interpolation-se3.hh +++ b/include/sot/tools/cubic-interpolation-se3.hh @@ -33,14 +33,15 @@ class CubicInterpolationSE3 : public Entity { protected: virtual void doStart(const double& duration); - dynamicgraph::Signal soutSOUT_; - dynamicgraph::Signal soutdotSOUT_; - dynamicgraph::SignalPtr initSIN_; - dynamicgraph::SignalPtr goalSIN_; + dynamicgraph::Signal soutSOUT_; + dynamicgraph::Signal soutdotSOUT_; + dynamicgraph::SignalPtr initSIN_; + dynamicgraph::SignalPtr goalSIN_; - MatrixHomogeneous& computeSout(MatrixHomogeneous& sout, const int& inTime); + MatrixHomogeneous& computeSout(MatrixHomogeneous& sout, + const sigtime_t& inTime); - int startTime_; + sigtime_t startTime_; double samplingPeriod_; double duration_; // 0: motion not started, 1: motion in progress, 2: motion finished diff --git a/include/sot/tools/cubic-interpolation.hh b/include/sot/tools/cubic-interpolation.hh index 493d88c..2be73b6 100644 --- a/include/sot/tools/cubic-interpolation.hh +++ b/include/sot/tools/cubic-interpolation.hh @@ -32,15 +32,15 @@ class CubicInterpolation : public Entity { protected: virtual void doStart(const double& duration); - dynamicgraph::Signal soutSOUT_; - dynamicgraph::Signal soutdotSOUT_; - dynamicgraph::SignalPtr initSIN_; - dynamicgraph::SignalPtr goalSIN_; + dynamicgraph::Signal soutSOUT_; + dynamicgraph::Signal soutdotSOUT_; + dynamicgraph::SignalPtr initSIN_; + dynamicgraph::SignalPtr goalSIN_; - Vector& computeSout(Vector& sout, const int& inTime); - Vector& computeSoutdot(Vector& sout, const int& inTime); + Vector& computeSout(Vector& sout, const sigtime_t& inTime); + Vector& computeSoutdot(Vector& sout, const sigtime_t& inTime); - int startTime_; + sigtime_t startTime_; double samplingPeriod_; double duration_; // 0: motion not started, 1: motion in progress, 2: motion finished diff --git a/include/sot/tools/kinematic-planner.hh b/include/sot/tools/kinematic-planner.hh index 749fc38..171f589 100644 --- a/include/sot/tools/kinematic-planner.hh +++ b/include/sot/tools/kinematic-planner.hh @@ -95,7 +95,7 @@ class KinematicPlanner : public Entity { int nSources1; // 5 int nSources2; // 4 /*! @} */ - std::list*> genericSignalRefs; + std::list*> genericSignalRefs; // Load Motion Capture outputs template diff --git a/include/sot/tools/oscillator.hh b/include/sot/tools/oscillator.hh index fadd84d..89ef705 100644 --- a/include/sot/tools/oscillator.hh +++ b/include/sot/tools/oscillator.hh @@ -29,18 +29,18 @@ class Oscillator : public Entity { Oscillator(const std::string name); protected: - double& computeSignal(double& sout, const int& t); + double& computeSignal(double& sout, const sigtime_t& t); dynamicgraph::Vector& computeVectorSignal(dynamicgraph::Vector& vsout, - const int& t); + const sigtime_t& t); double value(double dt, double time, double omega, double phase, double amplitude, double bias); - SignalPtr angularFrequencySIN_; - SignalPtr magnitudeSIN_; - SignalPtr phaseSIN_; - SignalPtr biasSIN_; - SignalTimeDependent soutSOUT_; - SignalTimeDependent vectorSoutSOUT_; + SignalPtr angularFrequencySIN_; + SignalPtr magnitudeSIN_; + SignalPtr phaseSIN_; + SignalPtr biasSIN_; + SignalTimeDependent soutSOUT_; + SignalTimeDependent vectorSoutSOUT_; double epsilon_; bool started_; diff --git a/include/sot/tools/seqplay.hh b/include/sot/tools/seqplay.hh index e5a3501..8710eb0 100644 --- a/include/sot/tools/seqplay.hh +++ b/include/sot/tools/seqplay.hh @@ -26,18 +26,18 @@ using dynamicgraph::Vector; using dynamicgraph::sot::MatrixHomogeneous; class Seqplay : public Entity { - Signal postureSOUT_; - Signal leftAnkleSOUT_; - Signal rightAnkleSOUT_; - Signal leftAnkleVelSOUT_; - Signal rightAnkleVelSOUT_; - Signal comSOUT_; - Signal comdotSOUT_; - Signal comddotSOUT_; - Signal forceLeftFootSOUT_; - Signal forceRightFootSOUT_; - - Signal zmpSOUT_; + Signal postureSOUT_; + Signal leftAnkleSOUT_; + Signal rightAnkleSOUT_; + Signal leftAnkleVelSOUT_; + Signal rightAnkleVelSOUT_; + Signal comSOUT_; + Signal comdotSOUT_; + Signal comddotSOUT_; + Signal forceLeftFootSOUT_; + Signal forceRightFootSOUT_; + + Signal zmpSOUT_; DYNAMIC_GRAPH_ENTITY_DECL(); Seqplay(const std::string& name); @@ -47,21 +47,24 @@ class Seqplay : public Entity { virtual std::string getDocString() const; private: - Vector& computePosture(Vector& pos, const int& t); - MatrixHomogeneous& computeLeftAnkle(MatrixHomogeneous& la, const int& t); - MatrixHomogeneous& computeRightAnkle(MatrixHomogeneous& ra, const int& t); + Vector& computePosture(Vector& pos, const sigtime_t& t); + MatrixHomogeneous& computeLeftAnkle(MatrixHomogeneous& la, + const sigtime_t& t); + MatrixHomogeneous& computeRightAnkle(MatrixHomogeneous& ra, + const sigtime_t& t); Vector& computeAnkleVelocity( Vector& velocity, const std::vector& ankleVector, - const int& t); - Vector& computeLeftAnkleVel(Vector& velocity, const int& t); - Vector& computeRightAnkleVel(Vector& velocity, const int& t); - Vector& computeCom(Vector& com, const int& t); - Vector& computeComdot(Vector& comdot, const int& t); - Vector& computeComddot(Vector& comdot, const int& t); - Vector& computeZMP(Vector& comdot, const int& t); - Vector& computeForceFoot(Vector&, const std::vector&, const int&); - Vector& computeForceLeftFoot(Vector& force, const int& t); - Vector& computeForceRightFoot(Vector& force, const int& t); + const sigtime_t& t); + Vector& computeLeftAnkleVel(Vector& velocity, const sigtime_t& t); + Vector& computeRightAnkleVel(Vector& velocity, const sigtime_t& t); + Vector& computeCom(Vector& com, const sigtime_t& t); + Vector& computeComdot(Vector& comdot, const sigtime_t& t); + Vector& computeComddot(Vector& comdot, const sigtime_t& t); + Vector& computeZMP(Vector& comdot, const sigtime_t& t); + Vector& computeForceFoot(Vector&, const std::vector&, + const sigtime_t&); + Vector& computeForceLeftFoot(Vector& force, const sigtime_t& t); + Vector& computeForceRightFoot(Vector& force, const sigtime_t& t); void readAnkleFile(std::ifstream&, std::vector&, const std::string&); @@ -69,7 +72,7 @@ class Seqplay : public Entity { // 0: motion not started, 1: motion in progress, 2: motion finished unsigned int state_; unsigned int configId_; - int startTime_; + sigtime_t startTime_; std::vector posture_; std::vector leftAnkle_; diff --git a/include/sot/tools/simpleseqplay.hh b/include/sot/tools/simpleseqplay.hh index 3e41a96..4d76714 100644 --- a/include/sot/tools/simpleseqplay.hh +++ b/include/sot/tools/simpleseqplay.hh @@ -28,10 +28,10 @@ namespace dg = dynamicgraph; class SimpleSeqPlay : public dg::Entity { public: typedef int Dummy; - dg::SignalTimeDependent firstSINTERN; - dg::SignalTimeDependent postureSOUT_; + dg::SignalTimeDependent firstSINTERN; + dg::SignalTimeDependent postureSOUT_; - dg::SignalPtr currentPostureSIN_; + dg::SignalPtr currentPostureSIN_; DYNAMIC_GRAPH_ENTITY_DECL(); SimpleSeqPlay(const std::string& name); @@ -51,7 +51,7 @@ class SimpleSeqPlay : public dg::Entity { // 1: going to the current position to the first position. // 2: motion in progress, 3: motion finished unsigned int state_; - int startTime_; + sigtime_t startTime_; std::vector posture_; dg::Vector currentPosture_; diff --git a/src/cubic-interpolation-se3.cc b/src/cubic-interpolation-se3.cc index ccc4efa..191112b 100644 --- a/src/cubic-interpolation-se3.cc +++ b/src/cubic-interpolation-se3.cc @@ -93,7 +93,7 @@ std::string CubicInterpolationSE3::getDocString() const { void CubicInterpolationSE3::reset() { state_ = 0; } sot::MatrixHomogeneous& CubicInterpolationSE3::computeSout( - sot::MatrixHomogeneous& sout, const int& inTime) { + sot::MatrixHomogeneous& sout, const sigtime_t& inTime) { double t; switch (state_) { case 0: diff --git a/src/cubic-interpolation.cc b/src/cubic-interpolation.cc index 405dac0..959f720 100644 --- a/src/cubic-interpolation.cc +++ b/src/cubic-interpolation.cc @@ -83,14 +83,14 @@ std::string CubicInterpolation::getDocString() const { void CubicInterpolation::reset() { state_ = 0; } -Vector& CubicInterpolation::computeSout(Vector& sout, const int& inTime) { +Vector& CubicInterpolation::computeSout(Vector& sout, const sigtime_t& inTime) { double t; switch (state_) { case 0: sout = initSIN_.accessCopy(); break; case 1: - t = (inTime - startTime_) * samplingPeriod_; + t = (double)(inTime - startTime_) * samplingPeriod_; sout = p0_ + (p1_ + (p2_ + p3_ * t) * t) * t; if (t >= duration_) { state_ = 2; @@ -104,7 +104,8 @@ Vector& CubicInterpolation::computeSout(Vector& sout, const int& inTime) { return sout; } -Vector& CubicInterpolation::computeSoutdot(Vector& soutdot, const int& inTime) { +Vector& CubicInterpolation::computeSoutdot(Vector& soutdot, + const sigtime_t& inTime) { soutdot.resize(initSIN_.accessCopy().size()); double t; switch (state_) { @@ -112,7 +113,7 @@ Vector& CubicInterpolation::computeSoutdot(Vector& soutdot, const int& inTime) { soutdot.setZero(); break; case 1: - t = (inTime - startTime_) * samplingPeriod_; + t = (double)(inTime - startTime_) * samplingPeriod_; soutdot = p1_ + (p2_ * 2 + p3_ * (3 * t)) * t; if (t >= duration_) { state_ = 2; diff --git a/src/oscillator.cc b/src/oscillator.cc index f393dfe..525b952 100644 --- a/src/oscillator.cc +++ b/src/oscillator.cc @@ -49,7 +49,7 @@ Oscillator::Oscillator(const std::string name) vectorSoutSOUT_.setFunction( boost::bind(&Oscillator::computeVectorSignal, this, _1, _2)); soutSOUT_.setNeedUpdateFromAllChildren(true); - soutSOUT_.setDependencyType(TimeDependency::ALWAYS_READY); + soutSOUT_.setDependencyType(TimeDependency::ALWAYS_READY); addCommand( "setTimePeriod", @@ -104,13 +104,13 @@ double Oscillator::value(double dt, double t, double omega, double phase, } dynamicgraph::Vector& Oscillator::computeVectorSignal( - dynamicgraph::Vector& vsout, const int& t) { + dynamicgraph::Vector& vsout, const sigtime_t& t) { vsout.resize(1); vsout(0) = soutSOUT_.access(t); return vsout; } -double& Oscillator::computeSignal(double& sout, const int& t) { +double& Oscillator::computeSignal(double& sout, const sigtime_t& t) { double eps; if (continuous_) diff --git a/src/seqplay.cc b/src/seqplay.cc index a918781..4ced650 100644 --- a/src/seqplay.cc +++ b/src/seqplay.cc @@ -444,7 +444,7 @@ void Seqplay::start() { } } -Vector& Seqplay::computePosture(Vector& pos, const int& t) { +Vector& Seqplay::computePosture(Vector& pos, const sigtime_t& t) { if (posture_.size() == 0) { throw std::runtime_error( "Seqplay posture: Signals not initialized. read files first."); @@ -465,7 +465,7 @@ Vector& Seqplay::computePosture(Vector& pos, const int& t) { } MatrixHomogeneous& Seqplay::computeLeftAnkle(MatrixHomogeneous& la, - const int& t) { + const sigtime_t& t) { if (leftAnkle_.size() == 0) { throw std::runtime_error( "Seqplay leftAnkle: Signals not initialized. read files first."); @@ -486,7 +486,7 @@ MatrixHomogeneous& Seqplay::computeLeftAnkle(MatrixHomogeneous& la, } MatrixHomogeneous& Seqplay::computeRightAnkle(MatrixHomogeneous& ra, - const int& t) { + const sigtime_t& t) { if (rightAnkle_.size() == 0) { throw std::runtime_error( "Seqplay rightAnkle: Signals not initialized. read files first."); @@ -508,7 +508,7 @@ MatrixHomogeneous& Seqplay::computeRightAnkle(MatrixHomogeneous& ra, Vector& Seqplay::computeAnkleVelocity( Vector& velocity, const std::vector& ankleVector, - const int& t) { + const sigtime_t& t) { velocity.resize(6); velocity.setZero(); std::size_t configId; @@ -542,7 +542,7 @@ Vector& Seqplay::computeAnkleVelocity( return velocity; } -Vector& Seqplay::computeLeftAnkleVel(Vector& velocity, const int& t) { +Vector& Seqplay::computeLeftAnkleVel(Vector& velocity, const sigtime_t& t) { // if there is no file, the velocity is computed using finite differences if (!facultativeFound_[5]) { return computeAnkleVelocity(velocity, leftAnkle_, t); @@ -563,7 +563,7 @@ Vector& Seqplay::computeLeftAnkleVel(Vector& velocity, const int& t) { } } -Vector& Seqplay::computeRightAnkleVel(Vector& velocity, const int& t) { +Vector& Seqplay::computeRightAnkleVel(Vector& velocity, const sigtime_t& t) { if (!facultativeFound_[6]) { return computeAnkleVelocity(velocity, rightAnkle_, t); } else { @@ -583,7 +583,7 @@ Vector& Seqplay::computeRightAnkleVel(Vector& velocity, const int& t) { } } -Vector& Seqplay::computeCom(Vector& com, const int& t) { +Vector& Seqplay::computeCom(Vector& com, const sigtime_t& t) { if (com_.size() == 0) { throw std::runtime_error( "Seqplay com: Signals not initialized. read files first."); @@ -603,7 +603,7 @@ Vector& Seqplay::computeCom(Vector& com, const int& t) { return com; } -Vector& Seqplay::computeZMP(Vector& zmp, const int& t) { +Vector& Seqplay::computeZMP(Vector& zmp, const sigtime_t& t) { if (zmp_.size() == 0) { throw std::runtime_error("Seqplay zmp: Signals not initialized."); } @@ -622,7 +622,7 @@ Vector& Seqplay::computeZMP(Vector& zmp, const int& t) { return zmp; } -Vector& Seqplay::computeComdot(Vector& comdot, const int& t) { +Vector& Seqplay::computeComdot(Vector& comdot, const sigtime_t& t) { if (facultativeFound_[2]) { std::size_t configId; if (state_ == 0) { @@ -667,7 +667,7 @@ Vector& Seqplay::computeComdot(Vector& comdot, const int& t) { } } -Vector& Seqplay::computeComddot(Vector& comddot, const int& t) { +Vector& Seqplay::computeComddot(Vector& comddot, const sigtime_t& t) { if (facultativeFound_[3]) { std::size_t configId; if (state_ == 0) { @@ -730,7 +730,7 @@ Vector& Seqplay::computeComddot(Vector& comddot, const int& t) { Vector& Seqplay::computeForceFoot(Vector& force, const std::vector& forceVector, - const int& t) { + const sigtime_t& t) { if (forceVector.size() == 0) { throw std::runtime_error( "Seqplay foot force: Force signals not initialized."); @@ -750,11 +750,11 @@ Vector& Seqplay::computeForceFoot(Vector& force, return force; } -Vector& Seqplay::computeForceLeftFoot(Vector& force, const int& t) { +Vector& Seqplay::computeForceLeftFoot(Vector& force, const sigtime_t& t) { return computeForceFoot(force, forceLeftFoot_, t); } -Vector& Seqplay::computeForceRightFoot(Vector& force, const int& t) { +Vector& Seqplay::computeForceRightFoot(Vector& force, const sigtime_t& t) { return computeForceFoot(force, forceRightFoot_, t); }