KDL in ROS - error in kdl/jntspaceinertiamatrix.hpp?

Hi,

I've encountered a small error in compiling the KDL library from ROS
repository in a Debian stable PC.

I've found that in "kdl/jntspaceinertiamatrix.hpp" the function
Multiply(const KDL::JntArray&, const double&, KDL::JntArray&) is indicated
as friend in the declaration of the JntSpaceInertiaMatrix class, but it is
not declared externally to the class - even though it is correctly defined
in the jntspaceinertiamatrix.cpp.

Below you find the test that has arisen the problem:

1. I've compiled also the "models", that is, in the cmake
configuration I have imposed -DBUILD_MODELS=ON -DBUILD_MODELS_DEMO=ON

2. I've made a slight modification to the kukaLWRtestHCG.cpp: I've
commented the using namespace KDL ( I've commented line 11 as below )

3. Then, I've added manually the KDL namespace everywhere needed.

4. In compiling I've got the following error:

../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp: In
function 'int main(int, char**)':

./orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:55:37:
error: invalid initialization of reference of type 'const KDL::JntArray&'
from expression of type 'KDL::JntSpaceInertiaMatrix'

In file included from
./orocos_kinematics_dynamics/orocos_kdl/src/frames_io.hpp:81:0,

from
../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:3:

./orocos_kinematics_dynamics/orocos_kdl/src/jntarray.hpp:182:10: error: in
passing argument 1 of 'void KDL::Multiply(const KDL::JntArray&, const
double&, KDL::JntArray&)'

5. The problem has been solved by adding the declaration of
Multiply(const KDL::JntArray&, const double&, KDL::JntArray&) outside the
class JntSpaceInertiaMatrix.

I am not a skilled programmer, is it correct what I have done?

Nicola

Ruben Smits's picture

KDL in ROS - error in kdl/jntspaceinertiamatrix.hpp?

Hi Nicola,

On Thu, Sep 18, 2014 at 9:44 AM, Nicola Pedrocchi <
nicola [dot] pedrocchi [..] ...> wrote:

> Hi,
>
> I’ve encountered a small error in compiling the KDL library from ROS
> repository in a Debian stable PC.
>
> I’ve found that in “kdl/jntspaceinertiamatrix.hpp” the function *Multiply(const
> KDL::JntArray&, const double&, KDL::JntArray&)* is indicated as friend in
> the declaration of the JntSpaceInertiaMatrix class, but it is not declared
> externally to the class – even though it is correctly defined in the
> jntspaceinertiamatrix.cpp.
>
>
>
> Below you find the test that has arisen the problem:
>
>
>
> 1. I’ve compiled also the “models”, that is, in the cmake
> configuration I have imposed –DBUILD_MODELS=ON -DBUILD_MODELS_DEMO=ON
>
> 2. I’ve made a slight modification to the kukaLWRtestHCG.cpp: I’ve
> commented the using namespace KDL ( I’ve commented line 11 as below )
>
> 3. Then, I’ve added manually the KDL namespace everywhere needed.
>
> 4. In compiling I’ve got the following error:
>
>
>
> *../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp: In
> function ‘int main(int, char**)’:*
>
> *…/orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:55:37:
> error: invalid initialization of reference of type ‘const KDL::JntArray&’
> from expression of type ‘KDL::JntSpaceInertiaMatrix’*
>
> *In file included from
> …/orocos_kinematics_dynamics/orocos_kdl/src/frames_io.hpp:81:0,*
>
> * from
> ../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:3:*
>
> *…/orocos_kinematics_dynamics/orocos_kdl/src/jntarray.hpp:182:10: error:
> in passing argument 1 of ‘void KDL::Multiply(const KDL::JntArray&, const
> double&, KDL::JntArray&)’*
>
>
>
>
Could tell us which compiler you are using in what kind of OS?

Ruben

> 5. The problem has been solved by adding the declaration of *Multiply(const
> KDL::JntArray&, const double&, KDL::JntArray&) *outside the class
> JntSpaceInertiaMatrix.
>
>
>
> I am not a skilled programmer, is it correct what I have done?
>
>
>
> Nicola
>
>
>
>
>
> --
>
> Eng. Nicola Pedrocchi, PhD, Researcher
>
> Institute of Industrial Technology and Automation
>
> National Council of Research
>
> Via Bassini, 15, 20133, Milan, Italy
>
>
>
> office : +390223699625
>
> lab. : +390223699944
>
> mobile : +393665797833
>
> skypeid: nicola.pedrocchi
>
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>

R: KDL in ROS - error in kdl/jntspaceinertiamatrix.hpp?

Hi Ruben:

OS: Linux 3.2.0-4-486

Distro: Debian stable ( Debian 3.2.57-3+deb7u1 i686 GNU/Linux)

Compiler: gcc-4.7 ( debian package : gcc-4.7-base:i386 version 4.7.2-5 )

There was an error in my post due to an erroneous copy&paste, sorry.

The function not declared outside the JntSpaceInertiaMatrix class is:

void Multiply(const JntSpaceInertiaMatrix& src,const double& factor,JntSpaceInertiaMatrix& dest);

and not the

void Multiply(const KDL::JntArray&, const double&, KDL::JntArray&)

as I indicated in the previous post. I am sorry for the inaccuracy in the error reporting.

Thanks

Nicola

Da: Ruben Smits [mailto:ruben [dot] smits [..] ...]
Inviato: giovedì 18 settembre 2014 11:39
A: Nicola Pedrocchi
Cc: orocos-dev [..] ...
Oggetto: Re: [Orocos-Dev] KDL in ROS - error in kdl/jntspaceinertiamatrix.hpp?

Hi Nicola,

On Thu, Sep 18, 2014 at 9:44 AM, Nicola Pedrocchi <nicola [dot] pedrocchi [..] ... nicola [dot] pedrocchi [..] ...> > wrote:

Hi,

I’ve encountered a small error in compiling the KDL library from ROS repository in a Debian stable PC.

I’ve found that in “kdl/jntspaceinertiamatrix.hpp” the function Multiply(const KDL::JntArray&, const double&, KDL::JntArray&) is indicated as friend in the declaration of the JntSpaceInertiaMatrix class, but it is not declared externally to the class – even though it is correctly defined in the jntspaceinertiamatrix.cpp.

Below you find the test that has arisen the problem:

1. I’ve compiled also the “models”, that is, in the cmake configuration I have imposed –DBUILD_MODELS=ON -DBUILD_MODELS_DEMO=ON

2. I’ve made a slight modification to the kukaLWRtestHCG.cpp: I’ve commented the using namespace KDL ( I’ve commented line 11 as below )

3. Then, I’ve added manually the KDL namespace everywhere needed.

4. In compiling I’ve got the following error:

../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp: In function ‘int main(int, char**)’:

…/orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:55:37: error: invalid initialization of reference of type ‘const KDL::JntArray&’ from expression of type ‘KDL::JntSpaceInertiaMatrix’

In file included from …/orocos_kinematics_dynamics/orocos_kdl/src/frames_io.hpp:81:0,

from ../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:3:

…/orocos_kinematics_dynamics/orocos_kdl/src/jntarray.hpp:182:10: error: in passing argument 1 of ‘void KDL::Multiply(const KDL::JntArray&, const double&, KDL::JntArray&)’

Could tell us which compiler you are using in what kind of OS?

Ruben

5. The problem has been solved by adding the declaration of Multiply(const KDL::JntArray&, const double&, KDL::JntArray&) outside the class JntSpaceInertiaMatrix.

I am not a skilled programmer, is it correct what I have done?

Nicola

Ruben Smits's picture

KDL in ROS - error in kdl/jntspaceinertiamatrix.hpp?

On Thu, Sep 18, 2014 at 12:55 PM, Nicola Pedrocchi <
nicola [dot] pedrocchi [..] ...> wrote:

> Hi Ruben:
>
>
>
> OS: Linux 3.2.0-4-486
>
> Distro: Debian stable ( Debian 3.2.57-3+deb7u1 i686 GNU/Linux)
>
> Compiler: gcc-4.7 ( debian package : gcc-4.7-base:i386 version
> 4.7.2-5 )
>
>
>
> There was an error in my post due to an erroneous copy&paste, sorry.
>
> The function not declared outside the JntSpaceInertiaMatrix class is:
>
>
>
> *void Multiply(const JntSpaceInertiaMatrix& src,const double&
> factor,JntSpaceInertiaMatrix& dest);*
>
>
>
> and not the
>
>
>
> *void Multiply(const KDL::JntArray&, const double&, KDL::JntArray&)*
>
>
>
> as I indicated in the previous post. I am sorry for the inaccuracy in the
> error reporting.
>
>
>

I guess you mean
void Multiply(const JntSpaceInertiaMatrix& src, const JntArray& vec,
JntArray& dest);

which is the function used on line 55 of kukaLWRtestHCG.cpp

For some reason the compiler wants to use the Multiply(const
KDL::JntArray&, const double&, KDL::JntArray&) instead and fails in
converting the JntSpaceInertiaMatrix into a JntArray.

We probably miss the explicit keyword for some of our copy-constructors as
explained here
http://stackoverflow.com/questions/3112602/c-implicit-conversions-and-am...

I was able to reproduce your problem, I'm currently working on a solution.

R.

> Thanks
>
> Nicola
>
>
>
>
>
>
>
> *Da:* Ruben Smits [mailto:ruben [dot] smits [..] ...]
> *Inviato:* giovedì 18 settembre 2014 11:39
> *A:* Nicola Pedrocchi
> *Cc:* orocos-dev [..] ...
> *Oggetto:* Re: [Orocos-Dev] KDL in ROS - error in
> kdl/jntspaceinertiamatrix.hpp?
>
>
>
> Hi Nicola,
>
>
>
> On Thu, Sep 18, 2014 at 9:44 AM, Nicola Pedrocchi <
> nicola [dot] pedrocchi [..] ...> wrote:
>
> Hi,
>
> I’ve encountered a small error in compiling the KDL library from ROS
> repository in a Debian stable PC.
>
> I’ve found that in “kdl/jntspaceinertiamatrix.hpp” the function *Multiply(const
> KDL::JntArray&, const double&, KDL::JntArray&)* is indicated as friend in
> the declaration of the JntSpaceInertiaMatrix class, but it is not declared
> externally to the class – even though it is correctly defined in the
> jntspaceinertiamatrix.cpp.
>
>
>
> Below you find the test that has arisen the problem:
>
>
>
> 1. I’ve compiled also the “models”, that is, in the cmake
> configuration I have imposed –DBUILD_MODELS=ON -DBUILD_MODELS_DEMO=ON
>
> 2. I’ve made a slight modification to the kukaLWRtestHCG.cpp: I’ve
> commented the using namespace KDL ( I’ve commented line 11 as below )
>
> 3. Then, I’ve added manually the KDL namespace everywhere needed.
>
> 4. In compiling I’ve got the following error:
>
>
>
> *../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp: In
> function ‘int main(int, char**)’:*
>
> *…/orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:55:37:
> error: invalid initialization of reference of type ‘const KDL::JntArray&’
> from expression of type ‘KDL::JntSpaceInertiaMatrix’*
>
> *In file included from
> …/orocos_kinematics_dynamics/orocos_kdl/src/frames_io.hpp:81:0,*
>
> * from
> ../orocos_kinematics_dynamics/orocos_kdl/models/kukaLWRtestHCG.cpp:3:*
>
> *…/orocos_kinematics_dynamics/orocos_kdl/src/jntarray.hpp:182:10: error:
> in passing argument 1 of ‘void KDL::Multiply(const KDL::JntArray&, const
> double&, KDL::JntArray&)’*
>
>
>
>
>
> Could tell us which compiler you are using in what kind of OS?
>
>
>
> Ruben
>
>
>
> 5. The problem has been solved by adding the declaration of *Multiply(const
> KDL::JntArray&, const double&, KDL::JntArray&) *outside the class
> JntSpaceInertiaMatrix.
>
>
>
> I am not a skilled programmer, is it correct what I have done?
>
>
>
> Nicola
>
>
>
>
>
> --
>
> Eng. Nicola Pedrocchi, PhD, Researcher
>
> Institute of Industrial Technology and Automation
>
> National Council of Research
>
> Via Bassini, 15, 20133, Milan, Italy
>
>
>
> office : +390223699625
>
> lab. : +390223699944
>
> mobile : +393665797833
>
> skypeid: nicola.pedrocchi
>
>
>
>
> --
> Orocos-Dev mailing list
> Orocos-Dev [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
>
>
>
>
> --
> Ruben Smits, CTO
> +32 479 511 786
> Intermodalics - Kapeldreef 60, 3001 Heverlee - BELGIUM
> www.intermodalics.eu
>
>
> ---------------------------------------------------------------------------------------------------------------------------------------
> This email and any attached files are confidential and may be legally
> privileged. Any copy, print or forward of this email, without the agreement
> of sender or addressee, is strictly prohibited. Misuse is a violation of
> the law on personal data protection (D. Lgs. 196/2003) and on secrecy of
> correspondence (art. 616 cp). If you have received this transmission in
> error please notify the sender immediately and then delete this email and
> any attached files.
>