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/buildTeX Embedding failed!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

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.

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:
<http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.4.x/doc-xml/orocos-toolkit-plugin.html>
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<double>, so I've declared the argument as
std::vector<double> 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:
> <http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/rtt/v1.4.x/doc-xml/orocos-toolkit-plugin.html
> >
> 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<double>, so I've declared the argument as
> std::vector<double> 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<double>, so I've declared the argument as
>> std::vector<double> 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.)