Method argument number limit?

Hi guys,

I've been having a really weird problem with a method I'm trying to
implement.

I'd like this method to have 6 arguments, and I don't want to give
them as a structure, array or something similar, because I intend to
use this method using TaskBrowser and I think this the neatest way.
The problem is that I cannot compile if the method has more than 4
arguments.

I tried leaving everything as is, just changing the number of
arguments where is needed, and it works fine for 4 or less arguments,
but when I try adding the fifth one, the compiller gives me some weird
errors (I've pasted the whole compiler output below).

Hast the orocos method implementation any limit of arguments that can
be passed?

Thanks.

Miguel.

prada@quasar:~/mrcuoxar/soft/prototipe/build$ make
/usr/bin/cmake -H/home/prada/mrcuoxar/soft/prototipe -B/home/prada/
mrcuoxar/soft/prototipe/build --check-build-system CMakeFiles/
Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/prada/mrcuoxar/soft/
prototipe/build/CMakeFiles 8
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/prada/mrcuoxar/soft/prototipe/build'
make -f src/CMakeFiles/prototype.dir/build.make src/CMakeFiles/
prototype.dir/depend
make[2]: Entering directory `/home/prada/mrcuoxar/soft/prototipe/build'
Scanning dependencies of target prototype
cd /home/prada/mrcuoxar/soft/prototipe/build && /usr/bin/cmake -E
cmake_depends "Unix Makefiles" /home/prada/mrcuoxar/soft/prototipe /
home/prada/mrcuoxar/soft/prototipe/src /home/prada/mrcuoxar/soft/
prototipe/build /home/prada/mrcuoxar/soft/prototipe/build/src /home/
prada/mrcuoxar/soft/prototipe/build/src/CMakeFiles/prototype.dir/
DependInfo.cmake
make[2]: Leaving directory `/home/prada/mrcuoxar/soft/prototipe/build'
make -f src/CMakeFiles/prototype.dir/build.make src/CMakeFiles/
prototype.dir/build
make[2]: Entering directory `/home/prada/mrcuoxar/soft/prototipe/build'
/usr/bin/cmake -E cmake_progress_report /home/prada/mrcuoxar/soft/
prototipe/build/CMakeFiles 5
[ 12%] Building CXX object src/CMakeFiles/prototype.dir/lliclient.o
/usr/bin/c++ -O2 -DNDEBUG -I/home/prada/mrcuoxar/soft/prototipe -I/
home/prada/mrcuoxar/soft/prototipe/src -DOROCOS_TARGET=gnulinux -
DOROCOS_TARGET=gnulinux -DOROCOS_TARGET=gnulinux -
DOROCOS_TARGET=gnulinux -DOROCOS_TARGET=gnulinux -
DOROCOS_TARGET=gnulinux -o src/CMakeFiles/prototype.dir/lliclient.o -
c /home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp
/usr/include/rtt/Method.hpp: In instantiation of ‘RTT::Method (double, double, double, double, double)>’:
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.hpp:47:
instantiated from here
/usr/include/rtt/Method.hpp:75: error: invalid use of undefined type
‘struct RTT::detail::InvokerSignature<5, bool ()(double, double,
double, double, double),
boost::shared_ptr double, double, double)> > >’
/usr/include/rtt/Invoker.hpp:215: error: declaration of ‘struct
RTT::detail::InvokerSignature<5, bool ()(double, double, double,
double, double), boost::shared_ptr (double, double, double, double, double)> > >’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp: In constructor
‘LLIClient::LLIClient(std::string, std::string)’:
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:38: error: no
matching function for call to
‘RTT::MethodRepository::addMethod(RTT::Method double, double, double)>*, const char [45], const char [4], const char
[17], const char [4], const char [17], const char [4], const char
[17], const char [4], const char [17], const char [4], const char [5])’
/usr/include/rtt/Method.hpp: In constructor
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’:
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/rtt/Method.hpp:175: error: type
‘RTT::detail::InvokerSignature<5, bool ()(double, double, double,
double, double), boost::shared_ptr (double, double, double, double, double)> > >’ is not a direct base of
‘RTT::Method
/usr/include/rtt/Invoker.hpp: At global scope:
/usr/include/rtt/Invoker.hpp: In instantiation of
‘RTT::detail::Invoker RTT::detail::LocalMethodImpl double)> >’:
/usr/include/rtt/LocalMethod.hpp:127: instantiated from
‘RTT::detail::LocalMethod double)>’
/usr/include/rtt/Method.hpp:175: instantiated from
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/rtt/Invoker.hpp:205: error: invalid use of undefined type
‘struct RTT::detail::InvokerImpl<5, bool ()(double, double, double,
double, double), RTT::detail::LocalMethodImpl double, double, double)> >’
/usr/include/rtt/Invoker.hpp:109: error: declaration of ‘struct
RTT::detail::InvokerImpl<5, bool ()(double, double, double, double,
double), RTT::detail::LocalMethodImpl double, double)> >’
/usr/include/rtt/BindStorage.hpp: In instantiation of
‘RTT::detail::MethodBinder double)>’:
/usr/include/rtt/LocalMethod.hpp:151: instantiated from
‘RTT::detail::LocalMethod::LocalMethod(M, ObjectType) [with
M = bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/usr/include/rtt/Method.hpp:175: instantiated from
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/rtt/BindStorage.hpp:620: error: invalid use of undefined
type ‘struct RTT::detail::MethodBinderImpl<5, bool ()(double, double,
double, double, double)>’
/usr/include/rtt/BindStorage.hpp:570: error: declaration of ‘struct
RTT::detail::MethodBinderImpl<5, bool ()(double, double, double,
double, double)>’
/usr/include/rtt/LocalMethod.hpp: In constructor
‘RTT::detail::LocalMethod::LocalMethod(M, ObjectType) [with
M = bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’:
/usr/include/rtt/Method.hpp:175: instantiated from
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/rtt/LocalMethod.hpp:151: error: no match for call to
‘(RTT::detail::MethodBinder double)>) (bool (LLIClient::*&)(double, double, double, double,
double), LLIClient*&)’
/usr/include/rtt/LocalMethod.hpp:151: error: ‘struct
RTT::detail::LocalMethod double)>’ has no member named ‘mmeth’
/usr/include/rtt/Invoker.hpp: At global scope:
/usr/include/rtt/Invoker.hpp: In instantiation of
‘RTT::detail::InvokerBase double)>’:
/usr/include/rtt/MethodBase.hpp:57: instantiated from
‘RTT::detail::MethodBase double)>’
/usr/include/boost/shared_ptr.hpp:124: instantiated from
‘boost::shared_ptr::shared_ptr(Y*) [with Y =
RTT::detail::LocalMethod double)>, T = RTT::detail::MethodBase double, double)>]’
/usr/include/rtt/Method.hpp:175: instantiated from
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/rtt/Invoker.hpp:106: error: invalid use of undefined type
‘struct RTT::detail::InvokerBaseImpl<5, bool ()(double, double,
double, double, double), bool>’
/usr/include/rtt/Invoker.hpp:56: error: declaration of ‘struct
RTT::detail::InvokerBaseImpl<5, bool ()(double, double, double,
double, double), bool>’
/usr/include/boost/shared_ptr.hpp: In constructor
‘boost::shared_ptr::shared_ptr(Y*) [with Y =
RTT::detail::LocalMethod double)>, T = RTT::detail::MethodBase double, double)>]’:
/usr/include/rtt/Method.hpp:175: instantiated from
‘RTT::Method::Method(std::string, M, ObjectType) [with M =
bool (LLIClient::*)(double, double, double, double, double),
ObjectType = LLIClient*, FunctionT = bool ()(double, double, double,
double, double)]’
/home/prada/mrcuoxar/soft/prototipe/src/lliclient.cpp:24:
instantiated from here
/usr/include/boost/shared_ptr.hpp:124: error: cannot convert
‘RTT::detail::LocalMethod double)>*’ to ‘RTT::detail::MethodBase double, double)>*’ in initialization
make[2]: *** [src/CMakeFiles/prototype.dir/lliclient.o] Error 1
make[2]: Leaving directory `/home/prada/mrcuoxar/soft/prototipe/build'
make[1]: *** [src/CMakeFiles/prototype.dir/all] Error 2
make[1]: Leaving directory `/home/prada/mrcuoxar/soft/prototipe/build'
make: *** [all] Error 2
prada@quasar:~/mrcuoxar/soft/prototipe/build$

Method argument number limit?

On Wednesday 09 July 2008 17:01:11 Miguel Prada Sarasola wrote:
> Hi guys,
>
> I've been having a really weird problem with a method I'm trying to
> implement.
>
> I'd like this method to have 6 arguments, and I don't want to give
> them as a structure, array or something similar, because I intend to
> use this method using TaskBrowser and I think this the neatest way.

The KDL library solves this problem in two ways: first by defining custom
types with 'constructor' syntax:

// KDL passes 6 arguments using structs like vectors
my_comp.my_method( vector( 1., 2., 3.), vector(4.,5.,6.) )

or using the 'array' type of the RTT:

// passes any number of arguments to array constructor :
my_comp.my_method2( array(1., 2.,3.,4.,5.,6.,7.) )

> The problem is that I cannot compile if the method has more than 4
> arguments.

If most arguments are doubles, you can solve your problem right now using the
above method, See this document for adding your own structs without adapting
the RTT:

else...

>
> I tried leaving everything as is, just changing the number of
> arguments where is needed, and it works fine for 4 or less arguments,
> but when I try adding the fifth one, the compiller gives me some weird
> errors (I've pasted the whole compiler output below).
>
> Hast the orocos method implementation any limit of arguments that can
> be passed?

...the only limit is that for each argument number, some helper classes need
to be implemented in the RTT. It's basically copy/paste work, extending the
case of 4 to 5 or 6 and making sure you did not make typos. The files
involved are: Invoker.hpp, LocalMethod.hpp, MethodRepository.hpp,
OperationFactory.hpp and FunctorFactory.hpp . Some of these files are already
fit for 6 arguments.

Peter

Method argument number limit?

El 10/07/2008, a las 9:20, Peter Soetens escribió:

> On Wednesday 09 July 2008 17:01:11 Miguel Prada Sarasola wrote:
>> Hi guys,
>>
>> I've been having a really weird problem with a method I'm trying to
>> implement.
>>
>> I'd like this method to have 6 arguments, and I don't want to give
>> them as a structure, array or something similar, because I intend to
>> use this method using TaskBrowser and I think this the neatest way.
>
> The KDL library solves this problem in two ways: first by defining
> custom
> types with 'constructor' syntax:
>
> // KDL passes 6 arguments using structs like vectors
> my_comp.my_method( vector( 1., 2., 3.), vector(4.,5.,6.) )
>
> or using the 'array' type of the RTT:
>
> // passes any number of arguments to array constructor :
> my_comp.my_method2( array(1., 2.,3.,4.,5.,6.,7.) )

I've been trying to do it this way. As far as I've understood, array
is in fact a std::vector, so I've declared the argument as
std::vector and then I call it from taskbrowser as
MyTask.MyMethod(array(1.,2.,3.,4.,5.,6.).

It looks like this is the way to go, but the thing is that the I've
actually changed the method into a command because I think it fits
better this way, and when I invoke the command from the taskbrowser it
says:

Command not accepted by MyTask's Processor !

Could you tell me what's going on in here?

>> The problem is that I cannot compile if the method has more than 4
>> arguments.
>
> If most arguments are doubles, you can solve your problem right now
> using the
> above method, See this document for adding your own structs without
> adapting
> the RTT:
> > >
> else...
>
>>
>> I tried leaving everything as is, just changing the number of
>> arguments where is needed, and it works fine for 4 or less arguments,
>> but when I try adding the fifth one, the compiller gives me some
>> weird
>> errors (I've pasted the whole compiler output below).
>>
>> Hast the orocos method implementation any limit of arguments that can
>> be passed?
>
> ...the only limit is that for each argument number, some helper
> classes need
> to be implemented in the RTT. It's basically copy/paste work,
> extending the
> case of 4 to 5 or 6 and making sure you did not make typos. The files
> involved are: Invoker.hpp, LocalMethod.hpp, MethodRepository.hpp,
> OperationFactory.hpp and FunctorFactory.hpp . Some of these files
> are already
> fit for 6 arguments.

Thanks a lot for all your help.

Method argument number limit?

On Thursday 10 July 2008 16:40:31 Miguel Prada Sarasola wrote:
> El 10/07/2008, a las 9:20, Peter Soetens escribió:
> > // passes any number of arguments to array constructor :
> > my_comp.my_method2( array(1., 2.,3.,4.,5.,6.,7.) )
>
> I've been trying to do it this way. As far as I've understood, array
> is in fact a std::vector, so I've declared the argument as
> std::vector and then I call it from taskbrowser as
> MyTask.MyMethod(array(1.,2.,3.,4.,5.,6.).
>
> It looks like this is the way to go, but the thing is that the I've
> actually changed the method into a command because I think it fits
> better this way, and when I invoke the command from the taskbrowser it

For a command to execute, you need an activity attached to your task, and the
task must be running. if you type 'ls' in the TaskBrowser it should say
MyTask [R].

> says:
>
> Command not accepted by MyTask's Processor !

We should change that line to 'Command not accepted: MyTask is not running !'

>
> Could you tell me what's going on in here?

Try:
MyTask.start()

If that returns false, you need to assign an activity ((Non)PeriodicActivity),
do this in C++ or in XML using the DeploymentComponent (deployer-gnulinux
app.)

Peter

Method argument number limit?

El 10/07/2008, a las 17:03, Peter Soetens escribió:

> On Thursday 10 July 2008 16:40:31 Miguel Prada Sarasola wrote:
>> El 10/07/2008, a las 9:20, Peter Soetens escribió:
>>> // passes any number of arguments to array constructor :
>>> my_comp.my_method2( array(1., 2.,3.,4.,5.,6.,7.) )
>>
>> I've been trying to do it this way. As far as I've understood, array
>> is in fact a std::vector, so I've declared the argument as
>> std::vector and then I call it from taskbrowser as
>> MyTask.MyMethod(array(1.,2.,3.,4.,5.,6.).
>>
>> It looks like this is the way to go, but the thing is that the I've
>> actually changed the method into a command because I think it fits
>> better this way, and when I invoke the command from the taskbrowser
>> it
>
> For a command to execute, you need an activity attached to your
> task, and the
> task must be running. if you type 'ls' in the TaskBrowser it should
> say
> MyTask [R].

I'm kind of stupid sometimes, I thought the task was running when I
tested, but I'd done it wrong. Now it works, thanks.

>> says:
>>
>> Command not accepted by MyTask's Processor !
>
> We should change that line to 'Command not accepted: MyTask is not
> running !'
>
>>
>> Could you tell me what's going on in here?
>
> Try:
> MyTask.start()
>
> If that returns false, you need to assign an activity
> ((Non)PeriodicActivity),
> do this in C++ or in XML using the DeploymentComponent (deployer-
> gnulinux
> app.)

Method argument number limit?

Le mercredi 09 juillet 2008 à 17:01 +0200, Miguel Prada Sarasola a
écrit :
>
> Hast the orocos method implementation any limit of arguments that
> can
> be passed?

Yes, there is a hard limit of 4 parameters. It's documented in the
chapter 3.12.2 of the Orocos Component Builder's Manual:
http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.4.x/doc-xml/orocos-components-manual.html#id2623485

Bruno.