Skip to content

Commit ee617c7

Browse files
Merge pull request #39 from florent-lamiraux/int64_t
Use int64_t as type for signal time.
2 parents 5375dd6 + a959b66 commit ee617c7

11 files changed

+78
-123
lines changed

.travis/build

Lines changed: 0 additions & 50 deletions
This file was deleted.

include/sot/tools/cubic-interpolation-se3.hh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ class CubicInterpolationSE3 : public Entity {
3333

3434
protected:
3535
virtual void doStart(const double& duration);
36-
dynamicgraph::Signal<MatrixHomogeneous, int> soutSOUT_;
37-
dynamicgraph::Signal<Vector, int> soutdotSOUT_;
38-
dynamicgraph::SignalPtr<MatrixHomogeneous, int> initSIN_;
39-
dynamicgraph::SignalPtr<MatrixHomogeneous, int> goalSIN_;
36+
dynamicgraph::Signal<MatrixHomogeneous, sigtime_t> soutSOUT_;
37+
dynamicgraph::Signal<Vector, sigtime_t> soutdotSOUT_;
38+
dynamicgraph::SignalPtr<MatrixHomogeneous, sigtime_t> initSIN_;
39+
dynamicgraph::SignalPtr<MatrixHomogeneous, sigtime_t> goalSIN_;
4040

41-
MatrixHomogeneous& computeSout(MatrixHomogeneous& sout, const int& inTime);
41+
MatrixHomogeneous& computeSout(MatrixHomogeneous& sout,
42+
const sigtime_t& inTime);
4243

43-
int startTime_;
44+
sigtime_t startTime_;
4445
double samplingPeriod_;
4546
double duration_;
4647
// 0: motion not started, 1: motion in progress, 2: motion finished

include/sot/tools/cubic-interpolation.hh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class CubicInterpolation : public Entity {
3232

3333
protected:
3434
virtual void doStart(const double& duration);
35-
dynamicgraph::Signal<Vector, int> soutSOUT_;
36-
dynamicgraph::Signal<Vector, int> soutdotSOUT_;
37-
dynamicgraph::SignalPtr<Vector, int> initSIN_;
38-
dynamicgraph::SignalPtr<Vector, int> goalSIN_;
35+
dynamicgraph::Signal<Vector, sigtime_t> soutSOUT_;
36+
dynamicgraph::Signal<Vector, sigtime_t> soutdotSOUT_;
37+
dynamicgraph::SignalPtr<Vector, sigtime_t> initSIN_;
38+
dynamicgraph::SignalPtr<Vector, sigtime_t> goalSIN_;
3939

40-
Vector& computeSout(Vector& sout, const int& inTime);
41-
Vector& computeSoutdot(Vector& sout, const int& inTime);
40+
Vector& computeSout(Vector& sout, const sigtime_t& inTime);
41+
Vector& computeSoutdot(Vector& sout, const sigtime_t& inTime);
4242

43-
int startTime_;
43+
sigtime_t startTime_;
4444
double samplingPeriod_;
4545
double duration_;
4646
// 0: motion not started, 1: motion in progress, 2: motion finished

include/sot/tools/kinematic-planner.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class KinematicPlanner : public Entity {
9595
int nSources1; // 5
9696
int nSources2; // 4
9797
/*! @} */
98-
std::list<dynamicgraph::SignalBase<int>*> genericSignalRefs;
98+
std::list<dynamicgraph::SignalBase<sigtime_t>*> genericSignalRefs;
9999

100100
// Load Motion Capture outputs
101101
template <typename Derived>

include/sot/tools/oscillator.hh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ class Oscillator : public Entity {
2929
Oscillator(const std::string name);
3030

3131
protected:
32-
double& computeSignal(double& sout, const int& t);
32+
double& computeSignal(double& sout, const sigtime_t& t);
3333
dynamicgraph::Vector& computeVectorSignal(dynamicgraph::Vector& vsout,
34-
const int& t);
34+
const sigtime_t& t);
3535
double value(double dt, double time, double omega, double phase,
3636
double amplitude, double bias);
3737

38-
SignalPtr<double, int> angularFrequencySIN_;
39-
SignalPtr<double, int> magnitudeSIN_;
40-
SignalPtr<double, int> phaseSIN_;
41-
SignalPtr<double, int> biasSIN_;
42-
SignalTimeDependent<double, int> soutSOUT_;
43-
SignalTimeDependent<dynamicgraph::Vector, int> vectorSoutSOUT_;
38+
SignalPtr<double, sigtime_t> angularFrequencySIN_;
39+
SignalPtr<double, sigtime_t> magnitudeSIN_;
40+
SignalPtr<double, sigtime_t> phaseSIN_;
41+
SignalPtr<double, sigtime_t> biasSIN_;
42+
SignalTimeDependent<double, sigtime_t> soutSOUT_;
43+
SignalTimeDependent<dynamicgraph::Vector, sigtime_t> vectorSoutSOUT_;
4444

4545
double epsilon_;
4646
bool started_;

include/sot/tools/seqplay.hh

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@ using dynamicgraph::Vector;
2626
using dynamicgraph::sot::MatrixHomogeneous;
2727

2828
class Seqplay : public Entity {
29-
Signal<Vector, int> postureSOUT_;
30-
Signal<MatrixHomogeneous, int> leftAnkleSOUT_;
31-
Signal<MatrixHomogeneous, int> rightAnkleSOUT_;
32-
Signal<Vector, int> leftAnkleVelSOUT_;
33-
Signal<Vector, int> rightAnkleVelSOUT_;
34-
Signal<Vector, int> comSOUT_;
35-
Signal<Vector, int> comdotSOUT_;
36-
Signal<Vector, int> comddotSOUT_;
37-
Signal<Vector, int> forceLeftFootSOUT_;
38-
Signal<Vector, int> forceRightFootSOUT_;
39-
40-
Signal<Vector, int> zmpSOUT_;
29+
Signal<Vector, sigtime_t> postureSOUT_;
30+
Signal<MatrixHomogeneous, sigtime_t> leftAnkleSOUT_;
31+
Signal<MatrixHomogeneous, sigtime_t> rightAnkleSOUT_;
32+
Signal<Vector, sigtime_t> leftAnkleVelSOUT_;
33+
Signal<Vector, sigtime_t> rightAnkleVelSOUT_;
34+
Signal<Vector, sigtime_t> comSOUT_;
35+
Signal<Vector, sigtime_t> comdotSOUT_;
36+
Signal<Vector, sigtime_t> comddotSOUT_;
37+
Signal<Vector, sigtime_t> forceLeftFootSOUT_;
38+
Signal<Vector, sigtime_t> forceRightFootSOUT_;
39+
40+
Signal<Vector, sigtime_t> zmpSOUT_;
4141

4242
DYNAMIC_GRAPH_ENTITY_DECL();
4343
Seqplay(const std::string& name);
@@ -47,29 +47,32 @@ class Seqplay : public Entity {
4747
virtual std::string getDocString() const;
4848

4949
private:
50-
Vector& computePosture(Vector& pos, const int& t);
51-
MatrixHomogeneous& computeLeftAnkle(MatrixHomogeneous& la, const int& t);
52-
MatrixHomogeneous& computeRightAnkle(MatrixHomogeneous& ra, const int& t);
50+
Vector& computePosture(Vector& pos, const sigtime_t& t);
51+
MatrixHomogeneous& computeLeftAnkle(MatrixHomogeneous& la,
52+
const sigtime_t& t);
53+
MatrixHomogeneous& computeRightAnkle(MatrixHomogeneous& ra,
54+
const sigtime_t& t);
5355
Vector& computeAnkleVelocity(
5456
Vector& velocity, const std::vector<MatrixHomogeneous>& ankleVector,
55-
const int& t);
56-
Vector& computeLeftAnkleVel(Vector& velocity, const int& t);
57-
Vector& computeRightAnkleVel(Vector& velocity, const int& t);
58-
Vector& computeCom(Vector& com, const int& t);
59-
Vector& computeComdot(Vector& comdot, const int& t);
60-
Vector& computeComddot(Vector& comdot, const int& t);
61-
Vector& computeZMP(Vector& comdot, const int& t);
62-
Vector& computeForceFoot(Vector&, const std::vector<Vector>&, const int&);
63-
Vector& computeForceLeftFoot(Vector& force, const int& t);
64-
Vector& computeForceRightFoot(Vector& force, const int& t);
57+
const sigtime_t& t);
58+
Vector& computeLeftAnkleVel(Vector& velocity, const sigtime_t& t);
59+
Vector& computeRightAnkleVel(Vector& velocity, const sigtime_t& t);
60+
Vector& computeCom(Vector& com, const sigtime_t& t);
61+
Vector& computeComdot(Vector& comdot, const sigtime_t& t);
62+
Vector& computeComddot(Vector& comdot, const sigtime_t& t);
63+
Vector& computeZMP(Vector& comdot, const sigtime_t& t);
64+
Vector& computeForceFoot(Vector&, const std::vector<Vector>&,
65+
const sigtime_t&);
66+
Vector& computeForceLeftFoot(Vector& force, const sigtime_t& t);
67+
Vector& computeForceRightFoot(Vector& force, const sigtime_t& t);
6568

6669
void readAnkleFile(std::ifstream&, std::vector<MatrixHomogeneous>&,
6770
const std::string&);
6871
void readForceFile(std::ifstream&, std::vector<Vector>&, const std::string&);
6972
// 0: motion not started, 1: motion in progress, 2: motion finished
7073
unsigned int state_;
7174
unsigned int configId_;
72-
int startTime_;
75+
sigtime_t startTime_;
7376

7477
std::vector<Vector> posture_;
7578
std::vector<MatrixHomogeneous> leftAnkle_;

include/sot/tools/simpleseqplay.hh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ namespace dg = dynamicgraph;
2828
class SimpleSeqPlay : public dg::Entity {
2929
public:
3030
typedef int Dummy;
31-
dg::SignalTimeDependent<Dummy, int> firstSINTERN;
32-
dg::SignalTimeDependent<dg::Vector, int> postureSOUT_;
31+
dg::SignalTimeDependent<Dummy, sigtime_t> firstSINTERN;
32+
dg::SignalTimeDependent<dg::Vector, sigtime_t> postureSOUT_;
3333

34-
dg::SignalPtr<dg::Vector, int> currentPostureSIN_;
34+
dg::SignalPtr<dg::Vector, sigtime_t> currentPostureSIN_;
3535

3636
DYNAMIC_GRAPH_ENTITY_DECL();
3737
SimpleSeqPlay(const std::string& name);
@@ -51,7 +51,7 @@ class SimpleSeqPlay : public dg::Entity {
5151
// 1: going to the current position to the first position.
5252
// 2: motion in progress, 3: motion finished
5353
unsigned int state_;
54-
int startTime_;
54+
sigtime_t startTime_;
5555

5656
std::vector<dg::Vector> posture_;
5757
dg::Vector currentPosture_;

src/cubic-interpolation-se3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ std::string CubicInterpolationSE3::getDocString() const {
9393
void CubicInterpolationSE3::reset() { state_ = 0; }
9494

9595
sot::MatrixHomogeneous& CubicInterpolationSE3::computeSout(
96-
sot::MatrixHomogeneous& sout, const int& inTime) {
96+
sot::MatrixHomogeneous& sout, const sigtime_t& inTime) {
9797
double t;
9898
switch (state_) {
9999
case 0:

src/cubic-interpolation.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ std::string CubicInterpolation::getDocString() const {
8383

8484
void CubicInterpolation::reset() { state_ = 0; }
8585

86-
Vector& CubicInterpolation::computeSout(Vector& sout, const int& inTime) {
86+
Vector& CubicInterpolation::computeSout(Vector& sout, const sigtime_t& inTime) {
8787
double t;
8888
switch (state_) {
8989
case 0:
9090
sout = initSIN_.accessCopy();
9191
break;
9292
case 1:
93-
t = (inTime - startTime_) * samplingPeriod_;
93+
t = (double)(inTime - startTime_) * samplingPeriod_;
9494
sout = p0_ + (p1_ + (p2_ + p3_ * t) * t) * t;
9595
if (t >= duration_) {
9696
state_ = 2;
@@ -104,15 +104,16 @@ Vector& CubicInterpolation::computeSout(Vector& sout, const int& inTime) {
104104
return sout;
105105
}
106106

107-
Vector& CubicInterpolation::computeSoutdot(Vector& soutdot, const int& inTime) {
107+
Vector& CubicInterpolation::computeSoutdot(Vector& soutdot,
108+
const sigtime_t& inTime) {
108109
soutdot.resize(initSIN_.accessCopy().size());
109110
double t;
110111
switch (state_) {
111112
case 0:
112113
soutdot.setZero();
113114
break;
114115
case 1:
115-
t = (inTime - startTime_) * samplingPeriod_;
116+
t = (double)(inTime - startTime_) * samplingPeriod_;
116117
soutdot = p1_ + (p2_ * 2 + p3_ * (3 * t)) * t;
117118
if (t >= duration_) {
118119
state_ = 2;

src/oscillator.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Oscillator::Oscillator(const std::string name)
4949
vectorSoutSOUT_.setFunction(
5050
boost::bind(&Oscillator::computeVectorSignal, this, _1, _2));
5151
soutSOUT_.setNeedUpdateFromAllChildren(true);
52-
soutSOUT_.setDependencyType(TimeDependency<int>::ALWAYS_READY);
52+
soutSOUT_.setDependencyType(TimeDependency<sigtime_t>::ALWAYS_READY);
5353

5454
addCommand(
5555
"setTimePeriod",
@@ -104,13 +104,13 @@ double Oscillator::value(double dt, double t, double omega, double phase,
104104
}
105105

106106
dynamicgraph::Vector& Oscillator::computeVectorSignal(
107-
dynamicgraph::Vector& vsout, const int& t) {
107+
dynamicgraph::Vector& vsout, const sigtime_t& t) {
108108
vsout.resize(1);
109109
vsout(0) = soutSOUT_.access(t);
110110
return vsout;
111111
}
112112

113-
double& Oscillator::computeSignal(double& sout, const int& t) {
113+
double& Oscillator::computeSignal(double& sout, const sigtime_t& t) {
114114
double eps;
115115

116116
if (continuous_)

0 commit comments

Comments
 (0)