RTT exercises 4, 5, 6

Hi again,

I'm currently going through the RTT exercises. Exercises 1, 2 and 3 are fine but and exercises 4, 5 and 6 have strange behaviors when compiling. Here's a summary:

--Exercise 4 compiles and works fine, but looking at HelloWorld.cpp in eclipse (after doing "make eclipse-project"), I get two errors at line 71:
1- Invalid arguments for "addOperation"
2- Method 'doc' could not be resolved
--Exercise 5 seems to compile o.k. i.e. no errors but the library (/lib/orocos/libHelloWorld-gnulinux.so)is not generated. I also get the same errors as above at lines 95 and 96 (Method 'arg' could not be resolved as well)
--Exercise 6 does not compile, I get the following output:

jml@jml-Linux:~/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-exercises/hello-6-scripting$ make
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake ..

RTT exercises 4, 5, 6

Hi Michel,

On Tue, Feb 5, 2013 at 9:56 PM, Lambert, Michel
<JasonMichel [dot] Lambert [..] ...> wrote:
> Hi again,
>
>
>
> I’m currently going through the RTT exercises. Exercises 1, 2 and 3 are fine
> but and exercises 4, 5 and 6 have strange behaviors when compiling. Here’s a
> summary:
>
>
>
> --Exercise 4 compiles and works fine, but looking at HelloWorld.cpp in
> eclipse (after doing “make eclipse-project”), I get two errors at line 71:
>
> 1- Invalid arguments for “addOperation”
>
> 2- Method ‘doc’ could not be resolved

This is due to the 'indexer' of eclipse not being able to interprete
all of our template code. Sometimes it gets it sometimes it doesn't.
It also differs between Eclipse versions, and not always going in the
positive direction.

>
> --Exercise 5 seems to compile o.k. i.e. no errors but the library
> (/lib/orocos/libHelloWorld-gnulinux.so)is not generated. I also get the same
> errors as above at lines 95 and 96 (Method ‘arg’ could not be resolved as
> well)

The library is not generated because all is compiled into a single executable.
You can check this by looking at the CMakeLists.txt which says:
orocos_executable(HelloWorld HelloWorld.cpp)

This exercise is a bit of an outlier.It needs more work to be updated
to work similarly to the other examples.

>
> --Exercise 6 does not compile, I get the following output:

...

> /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function
> `_start':
>
> (.text+0x18): undefined reference to `main'
>
> collect2: ld returned 1 exit status
>
> make[3]: *** [../HelloWorld-gnulinux] Error 1
>
> make[3]: Leaving directory
> `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-exercises/hello-6-scripting/build'
>
> make[2]: *** [CMakeFiles/HelloWorld.dir/all] Error 2
>
> make[2]: Leaving directory
> `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-exercises/hello-6-scripting/build'
>
> make[1]: *** [all] Error 2
>
> make[1]: Leaving directory
> `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-exercises/hello-6-scripting/build'
>
> make: *** [all] Error 2

Thanks for reporting. The CMake file generated an executable instead
of a component. I pushed the fix.

>
>
>
>
>
> Exercise 7 compiles and loads fine in eclipse. Has anyone had similar
> experiences? I’m running Ubuntu 10.04 and ROS Fuerte.

Where did you download the exercises from (I'm guessing github) ? I
just noticed that the ones on gitorious were lagging with a year while
the github ones were up-to-date.

I synced both now again. So to be sure you got the latest version, do a

git clone https://github.com/psoetens/orocos-rtt-examples.git

in your ROS_PACKAGE_PATH

Thanks for the feedback !

Peter

RTT exercises 4, 5, 6

Hello Peter and thanks for replying!

> -----Original Message-----
> From: Peter Soetens [mailto:peter [..] ...]
> Sent: February-07-13 5:19 PM
> To: Lambert, Michel
> Cc: orocos-users [..] ...
> Subject: Re: [Orocos-users] RTT exercises 4, 5, 6
>
> Hi Michel,
>
> On Tue, Feb 5, 2013 at 9:56 PM, Lambert, Michel
> <JasonMichel [dot] Lambert [..] ...> wrote:
> > Hi again,
> >
> >
> >
> > I’m currently going through the RTT exercises. Exercises 1, 2 and 3
> > are fine but and exercises 4, 5 and 6 have strange behaviors when
> > compiling. Here’s a
> > summary:
> >
> >
> >
> > --Exercise 4 compiles and works fine, but looking at HelloWorld.cpp in
> > eclipse (after doing “make eclipse-project”), I get two errors at line 71:
> >
> > 1- Invalid arguments for “addOperation”
> >
> > 2- Method ‘doc’ could not be resolved
>
> This is due to the 'indexer' of eclipse not being able to interprete all of our
> template code. Sometimes it gets it sometimes it doesn't.
> It also differs between Eclipse versions, and not always going in the positive
> direction.

Good to know, thanks, no big deal right now.
>
> >
> > --Exercise 5 seems to compile o.k. i.e. no errors but the library
> > (/lib/orocos/libHelloWorld-gnulinux.so)is not generated. I also get
> > the same errors as above at lines 95 and 96 (Method ‘arg’ could not be
> > resolved as
> > well)
>
> The library is not generated because all is compiled into a single executable.
> You can check this by looking at the CMakeLists.txt which says:
> orocos_executable(HelloWorld HelloWorld.cpp)
>
> This exercise is a bit of an outlier.It needs more work to be updated to work
> similarly to the other examples.

O.k, as long as it's not me ;-).

>
> >
> > --Exercise 6 does not compile, I get the following output:
>
> ...
>
> > /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In
> > function
> > `_start':
> >
> > (.text+0x18): undefined reference to `main'
> >
> > collect2: ld returned 1 exit status
> >
> > make[3]: *** [../HelloWorld-gnulinux] Error 1
> >
> > make[3]: Leaving directory
> > `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-
> exercises/hello-6-scripting/build'
> >
> > make[2]: *** [CMakeFiles/HelloWorld.dir/all] Error 2
> >
> > make[2]: Leaving directory
> > `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-
> exercises/hello-6-scripting/build'
> >
> > make[1]: *** [all] Error 2
> >
> > make[1]: Leaving directory
> > `/home/jml/fuerte_wksp/sandbox/RTT-training/orocos-rtt-examples/rtt-
> exercises/hello-6-scripting/build'
> >
> > make: *** [all] Error 2
>
> Thanks for reporting. The CMake file generated an executable instead of a
> component. I pushed the fix.

No problem.
>
> >
> >
> >
> >
> >
> > Exercise 7 compiles and loads fine in eclipse. Has anyone had similar
> > experiences? I’m running Ubuntu 10.04 and ROS Fuerte.
>
> Where did you download the exercises from (I'm guessing github) ? I just
> noticed that the ones on gitorious were lagging with a year while the github
> ones were up-to-date.

I followed the instructions from "Setting up the RTT 2.4 exercises on Ubuntu" in the tutorials section: http://www.orocos.org/wiki/main-page/toolchain/getting-started/toolchain.... It seemed the most appropriate for someone who wants to do the exercises within the ROS framework. Yes, the exercises com from github.

>
> I synced both now again. So to be sure you got the latest version, do a
>
> git clone https://github.com/psoetens/orocos-rtt-examples.git
>
> in your ROS_PACKAGE_PATH
>
> Thanks for the feedback !

Pleasure to be of help!
>
> Peter