Skip to content

Commit b8fe09c

Browse files
committed
Fix some compilation warnings
1 parent bcc721b commit b8fe09c

File tree

6 files changed

+28
-34
lines changed

6 files changed

+28
-34
lines changed

include/sot/core/memory-task-sot.hh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ namespace dynamicgraph {
5555
public:
5656
/* mJ is the number of actuated joints, nJ the number of feature in the task,
5757
* and ffsize the number of unactuated DOF. */
58-
MemoryTaskSOT( const std::string & name,const unsigned int nJ=0,
59-
const unsigned int mJ=0,const unsigned int ffsize =0 );
58+
MemoryTaskSOT( const std::string & name,const Matrix::Index nJ=0,
59+
const Matrix::Index mJ=0,const Matrix::Index ffsize =0 );
6060

61-
virtual void initMemory( const unsigned int nJ,
62-
const unsigned int mJ,
63-
const unsigned int ffsize,
61+
virtual void initMemory( const Matrix::Index nJ,
62+
const Matrix::Index mJ,
63+
const Matrix::Index ffsize,
6464
bool atConstruction = false);
6565

6666
public: /* --- ENTITY INHERITANCE --- */

include/sot/core/sot.hh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ namespace dynamicgraph {
131131

132132
static dg::Matrix & computeJacobianConstrained( const dg::Matrix& Jac,
133133
const dg::Matrix& K,
134-
dg::Matrix& JK,
135-
dg::Matrix& Jff,
136-
dg::Matrix& Jact );
134+
dg::Matrix& JK);
137135
static dg::Matrix & computeJacobianConstrained( const TaskAbstract& task,
138136
const dg::Matrix& K );
139137
static void

src/sot/memory-task-sot.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const std::string MemoryTaskSOT::CLASS_NAME = "MemoryTaskSOT";
3030

3131
MemoryTaskSOT::
3232
MemoryTaskSOT( const std::string & name
33-
,const unsigned int nJ
34-
,const unsigned int mJ
35-
,const unsigned int ffsize )
33+
,const Matrix::Index nJ
34+
,const Matrix::Index mJ
35+
,const Matrix::Index ffsize )
3636
:
3737
Entity( name )
3838
,jacobianInvSINOUT( "sotTaskAbstract("+name+")::inout(matrix)::Jinv" )
@@ -49,7 +49,7 @@ MemoryTaskSOT( const std::string & name
4949

5050

5151
void MemoryTaskSOT::
52-
initMemory( const unsigned int nJ,const unsigned int mJ,const unsigned int ffsize,
52+
initMemory( const Matrix::Index nJ,const Matrix::Index mJ,const Matrix::Index ffsize,
5353
bool atConstruction )
5454
{
5555
sotDEBUG(15) << "Task-mermory " << getName() << ": resize "

src/sot/sot.cpp

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,11 @@ defineNbDof( const unsigned int& nbDof )
334334
dynamicgraph::Matrix & Sot::
335335
computeJacobianConstrained( const dynamicgraph::Matrix& Jac,
336336
const dynamicgraph::Matrix& K,
337-
dynamicgraph::Matrix& JK,
338-
dynamicgraph::Matrix& Jff,
339-
dynamicgraph::Matrix& Jact )
337+
dynamicgraph::Matrix& JK)
340338
{
341-
const int nJ = Jac.rows();
342-
const int mJ = K.cols();
343-
const int nbConstraints = Jac.cols() - mJ;
339+
const Matrix::Index nJ = Jac.rows();
340+
const Matrix::Index mJ = K.cols();
341+
const Matrix::Index nbConstraints = Jac.cols() - mJ;
344342

345343
if (nbConstraints == 0) {
346344
JK = Jac;
@@ -361,10 +359,8 @@ computeJacobianConstrained( const TaskAbstract& task,
361359
const dynamicgraph::Matrix &Jac = task.jacobianSOUT.accessCopy ();
362360
MemoryTaskSOT * mem = dynamic_cast<MemoryTaskSOT *>( task.memoryInternal );
363361
if( NULL==mem ) throw; // TODO
364-
dynamicgraph::Matrix &Jff = mem->Jff;
365-
dynamicgraph::Matrix &Jact = mem->Jact;
366362
dynamicgraph::Matrix &JK = mem->JK;
367-
return computeJacobianConstrained(Jac,K,JK,Jff,Jact);
363+
return computeJacobianConstrained(Jac,K,JK);
368364
}
369365

370366
static void computeJacobianActivated( Task* taskSpec,
@@ -423,15 +419,15 @@ static void computeJacobianActivated( Task* taskSpec,
423419
# define sotSTART_CHRONO1 gettimeofday(&t0,NULL)
424420
# define sotCHRONO1 \
425421
gettimeofday(&t1,NULL);\
426-
dt = ( (t1.tv_sec-t0.tv_sec) * 1000.* 1000.\
427-
+ (t1.tv_usec-t0.tv_usec+0.) );\
422+
dt = ( (double)(t1.tv_sec-t0.tv_sec) * 1000.* 1000.\
423+
+ (double)(t1.tv_usec-t0.tv_usec) );\
428424
sotDEBUG(1) << "dt: "<< dt / 1000. << std::endl
429425
# define sotINITPARTCOUNTERS struct timeval tpart0
430426
# define sotSTARTPARTCOUNTERS gettimeofday(&tpart0,NULL)
431427
# define sotCOUNTER(nbc1,nbc2) \
432428
gettimeofday(&tpart##nbc2,NULL); \
433-
dt##nbc2 += ( (tpart##nbc2.tv_sec-tpart##nbc1.tv_sec) * 1000.* 1000. \
434-
+ (tpart##nbc2.tv_usec-tpart##nbc1.tv_usec+0.) )
429+
dt##nbc2 += ( (double)(tpart##nbc2.tv_sec-tpart##nbc1.tv_sec) * 1000.* 1000. \
430+
+ (double)(tpart##nbc2.tv_usec-tpart##nbc1.tv_usec) )
435431
# define sotINITCOUNTER(nbc1) \
436432
struct timeval tpart##nbc1; double dt##nbc1=0;
437433
# define sotPRINTCOUNTER(nbc1) sotDEBUG(1) << "dt" << nbc1 << " = " << dt##nbc1 << std::endl
@@ -471,8 +467,8 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
471467
sotSTARTPARTCOUNTERS;
472468

473469
const double &th = inversionThresholdSIN(iterTime);
474-
const dynamicgraph::Matrix &K = constraintSOUT(iterTime);
475-
const int mJ = K.cols(); // number dofs - number constraints
470+
const Matrix &K = constraintSOUT(iterTime);
471+
const Matrix::Index mJ = K.cols(); // number dofs - number constraints
476472

477473
try {
478474
control = q0SIN( iterTime );
@@ -497,7 +493,7 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
497493
sotCOUNTER(0,1); // Direct Dynamic
498494

499495
unsigned int rankJ;
500-
const int nJ = Jac.rows(); // number dofs
496+
const Matrix::Index nJ = Jac.rows(); // number dofs
501497

502498
/* Init memory. */
503499
MemoryTaskSOT * mem = dynamic_cast<MemoryTaskSOT *>( task.memoryInternal );
@@ -653,7 +649,7 @@ computeControlLaw( dynamicgraph::Vector& control,const int& iterTime )
653649
{
654650
const dynamicgraph::Matrix & Jac = taskGradient->jacobianSOUT.access(iterTime);
655651

656-
const unsigned int nJ = Jac.rows();
652+
const Matrix::Index nJ = Jac.rows();
657653

658654
MemoryTaskSOT * mem
659655
= dynamic_cast<MemoryTaskSOT *>( taskGradient->memoryInternal );
@@ -739,7 +735,7 @@ computeConstraintProjector( dynamicgraph::Matrix& ProjK, const int& time )
739735
const dynamicgraph::Matrix &J = *Jptr;
740736
sotDEBUG(12) << "J = "<< J;
741737

742-
const unsigned int nJc = J.cols();
738+
const Matrix::Index nJc = J.cols();
743739
dynamicgraph::Matrix Jff( J.rows(),ffJointIdLast-ffJointIdFirst );
744740
dynamicgraph::Matrix Jc( J.rows(),nJc-ffJointIdLast+ffJointIdFirst );
745741

unitTesting/tools/test_boost.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ using namespace std;
4545
sotDEBUG(25) << "t0 "<<#name<<": "<< t0##_##name.tv_sec << " - " << t0##_##name.tv_usec << std::endl
4646
#define STOP_CHRONO(name,commentaire) \
4747
gettimeofday(&t1##_##name,NULL); \
48-
dt##_##name = ( (t1##_##name.tv_sec-t0##_##name.tv_sec) * 1000. \
49-
+ (t1##_##name.tv_usec-t0##_##name.tv_usec+0.) / 1000. );\
48+
dt##_##name = ( (double)(t1##_##name.tv_sec-t0##_##name.tv_sec) * 1000. \
49+
+ (double)(t1##_##name.tv_usec-t0##_##name.tv_usec) / 1000. );\
5050
sotDEBUG(25) << "t1 "<<#name<<": "<< t1##_##name.tv_sec << " - " << t1##_##name.tv_usec << std::endl; \
5151
sotDEBUG(1) << "Time spent "<<#name " " commentaire<<" = " << dt##_##name << std::endl
5252

unitTesting/tools/test_matrix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ int main( int ,char** )
6868
//prod(J.matrix,P.matrix,JK.matrix);
6969
JK = J*P;
7070
gettimeofday(&t1,NULL);
71-
dt += ( (t1.tv_sec-t0.tv_sec)
72-
+ (t1.tv_usec-t0.tv_usec+0.) / 1000. / 1000. );
71+
dt += ( (double)(t1.tv_sec-t0.tv_sec)
72+
+ (double)(t1.tv_usec-t0.tv_usec) / 1000. / 1000. );
7373

7474
}
7575
//sotCHRONO1 <<endl;

0 commit comments

Comments
 (0)