max number of commands called on a component

Using Orocos 1.10

Hello, I try to call many many commands on a component. I would like to know if there is a limitation of the number of command which could be called before the receiver component executed it (I think 16 :-P).

I don't care of the activity of ComponentA. ComponentB has nonPeriodicActivity, is scheduled RT (on linux, for the test :-P)

To explain, an example of code

ComponentA::mthDoPostCommandToB(nbPosts)
{
    TaskContext* ComponentB = getPeer("ComponentB");
    Command<bool()> cmdDisplayOfB;
 
    boost::array <Command<bool()>, 500> listCmd;
 
    cmdDisplayOfB = ComponentB->commands()->getCommand<bool()>("cmdDisplay");
    if( cmdDisplayOfB.ready() == false)
    {
        log(Error) << "cmdDisplayOfB is not ready" << endlog();
    }
    else
    {
       for (int32_t i = 0 ; i < nbPosts; ++i)
    {
        list[i] = cmdDisplayOfB; //making a copy
    }
    for (int32_t i = 0 ; i < nbAppel; ++i)
    {
        list[i]();
        cout << "cmdDisplayOfB: " << &list[i] << endl;
    }
    sleep(1000); //to not loose the commands of the list
}
 
bool
ComponentB::cmdDoDisplay()
{
    cout << "Step " << m_i << endl;
    ++m_i; 
    static int i = 0;
    if (i == 0)
    {
        sleep(1);
        ++i;
    }
    return true;
}
bool
ComponentB::cmdDisplayDone()
{
    return true;
}
So on the TaskBrowser:
ComponentA.mthDoPostCommandToB(50)
 
The display is
 
Post 0 (the first execution is begun because all the posts, but is long (because sleep(1))
 
Post 1
Post 2
...
Post 16

Am I right? How can I increase the number of commands? Thanks. Guillaume

max number of commands called on a component

On Thursday 23 December 2010 12:30:53 gde [..] ... wrote:
> Using Orocos 1.10
>
> Hello,
> I try to call many many commands on a component. I would like to know if
> there is a limitation of the number of command which could be called
> before the receiver component executed it (I think 16 :-P).
>
> I don't care of the activity of ComponentA.
> ComponentB has nonPeriodicActivity, is scheduled RT (on linux, for the test
> :-P)
>
> To explain, an example of code
>

> ComponentA::mthDoPostCommandToB(nbPosts)
> {
>     TaskContext* ComponentB = getPeer("ComponentB");
>     Command<bool()> cmdDisplayOfB;
> 
>     boost::array <Command<bool()>, 500> listCmd;
> 
>     cmdDisplayOfB =
> ComponentB->commands()->getCommand<bool()>("cmdDisplay"); if(
> cmdDisplayOfB.ready() == false)
>     {
>         log(Error) << "cmdDisplayOfB is not ready" << endlog();
>     }
>     else
>     {
>        for (int32_t i = 0 ; i < nbPosts; ++i)
>     {
>         list[i] = cmdDisplayOfB; //making a copy
>     }
>     for (int32_t i = 0 ; i < nbAppel; ++i)
>     {
>         list[i]();
>         cout << "cmdDisplayOfB: " << &list[i] << endl;
>     }
>     sleep(1000); //to not loose the commands of the list
> }
> 
> bool
> ComponentB::cmdDoDisplay()
> {
>     cout << "Step " << m_i << endl;
>     ++m_i;
>     static int i = 0;
>     if (i == 0)
>     {
>         sleep(1);
>         ++i;
>     }
>     return true;
> }
> bool
> ComponentB::cmdDisplayDone()
> {
>     return true;
> }
> 

> So on the TaskBrowser:
>
> ComponentA.mthDoPostCommandToB(50)
> 
> The display is
> 
> Post 0 (the first execution is begun because all the posts, but is long
> (because sleep(1))
> 
> Post 1
> Post 2
> ...
> Post 16
> 

>
> Am I right?
> How can I increase the number of commands?

Startup ccmake and change the ORONUM_EXECUTION_PROC_QUEUE_SIZE flag from 16 to
something else (this is at compile time, for all components).

If you want even more control, you'll need to use
engine()->setCommandProcessor( new CommandProcessor(100) ) in each component
that requires it (for example, hard-coding it in the component's constructor).

Peter

max number of commands

Thanks a lot : I tried the second way (using engine()->setCommandProcessor( new CommandProcessor(100) ) ) ... but the new engine must be created before the initialization of the command.
So, we cannot write (without a seg fault):

ComponentB::ComponentB(const std::string& name) :
			TaskContext(),
                        cmdDisplay("cmdDisplay", &ComponentB::cmdDoDisplay, &ComponentB::cmdDisplayDone, this)
{
    engine()->setCommandProcessor( new CommandProcessor(100) );
    this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
}

We must write :

ComponentB::ComponentB(const std::string& name) :
			TaskContext()
{
    engine()->setCommandProcessor( new CommandProcessor(100) );
    cmdDisplay = Command("cmdDisplay", &ComponentB::cmdDoDisplay, &ComponentB::cmdDisplayDone, this);
    this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
}

A last question : is the original CommandProcessor deleted by anybody when we replace it by "new CommandProcessor(16)" ?

max number of commands called on a component

Thanks a lot : I tried the second way (using engine()->setCommandProcessor( new CommandProcessor(100) ) ) ... but the new engine must be created before the initialization of the command. So, we cannot write (without a seg fault):

ComponentB::ComponentB(const std::string& name) :
            TaskContext(),
                        cmdDisplay("cmdDisplay", &ComponentB::cmdDoDisplay, &ComponentB::cmdDisplayDone, this)
{
    engine()->setCommandProcessor( new CommandProcessor(100) );
    this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
}

We must write :

ComponentB::ComponentB(const std::string& name) :
            TaskContext()
{
    engine()->setCommandProcessor( new CommandProcessor(100) );
    cmdDisplay = Command("cmdDisplay", &ComponentB::cmdDoDisplay, &ComponentB::cmdDisplayDone, this);
    this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
}

A last question : is the original CommandProcessor deleted by anybody when we replace it by "new CommandProcessor(16)" ?

max number of commands

On Thursday 23 December 2010 14:47:05 gde [..] ... wrote:
> Thanks a lot : I tried the second way (using engine()->setCommandProcessor(
> new CommandProcessor(100) ) ) ... but the new engine must be created
> before the initialization of the command. So, we cannot write (without a
> seg fault):
>

> ComponentB::ComponentB(const std::string& name) :
> 			TaskContext(),
>                         cmdDisplay("cmdDisplay", &ComponentB::cmdDoDisplay,
> &ComponentB::cmdDisplayDone, this) {
>     engine()->setCommandProcessor( new CommandProcessor(100) );
>     this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
> }
> 

>
> We must write :
>
> ComponentB::ComponentB(const std::string& name) :
> 			TaskContext()
> {
>     engine()->setCommandProcessor( new CommandProcessor(100) );
>     cmdDisplay = Command("cmdDisplay", &ComponentB::cmdDoDisplay,
> &ComponentB::cmdDisplayDone, this);
> this->commands()->addCommand(&cmdDisplay, "cmdDisplay");
> }
> 

>
> A last question : is the original CommandProcessor deleted by anybody when
> we replace it by "new CommandProcessor(16)" ?

Yes. the setCommandProcessor deletes the old instance. That's why you got the
crash as well. You might, for convenience, write a base class component that
has this larger commandprocessor such that you can keep your existing command
initialisation code in the constructor.

Peter

max number of commands

I got the same conclusion : but does my component herit some command from TaskContext?
Increase the number of command does have effect on performances (if all the capacity is not used)?

max number of commands

I got the same conclusion : but does my component herit some command from TaskContext? Increase the number of command does have effect on performances (if all the capacity is not used)?

max number of commands

On Thursday 23 December 2010 15:44:30 gde [..] ... wrote:
> I got the same conclusion : but does my component herit some command from
> TaskContext?

They are all methods. So they don't use the command processor.

> Increase the number of command does have effect on
> performances (if all the capacity is not used)?

No, but you shouldn't have a queue much larger than 100-200 items, since the
lock-free algorithms in 1.x can't handle much more than that efficiently.

Peter

max number of commands called on a component

Using Orocos 1.10

Hello,
I try to call many many commands on a component. I would like to know if there is a limitation of the number of command which could be called before the receiver component executed it (I think 16 :-P).

I don't care of the activity of ComponentA.
ComponentB has nonPeriodicActivity, is scheduled RT (on linux, for the test :-P)

To explain, an example of code

ComponentA::mthDoPostCommandToB(nbPosts)
{
    TaskContext* ComponentB = getPeer("ComponentB");
    Command<bool()> cmdDisplayOfB;
 
    boost::array <Command<bool()>, 500> listCmd;
 
    cmdDisplayOfB = ComponentB->commands()->getCommand<bool()>("cmdDisplay");
    if( cmdDisplayOfB.ready() == false)
    {
        log(Error) << "cmdDisplayOfB is not ready" << endlog();
    }
    else
    {
       for (int32_t i = 0 ; i < nbPosts; ++i)
    {
        list[i] = cmdDisplayOfB; //making a copy
    }
    for (int32_t i = 0 ; i < nbAppel; ++i)
    {
        list[i]();
        cout << "cmdDisplayOfB: " << &list[i] << endl;
    }
    sleep(1000); //to not loose the commands of the list
}
 
bool
ComponentB::cmdDoDisplay()
{
    cout << "Step " << m_i << endl;
    ++m_i; 
    static int i = 0;
    if (i == 0)
    {
        sleep(1);
        ++i;
    }
    return true;
}
bool
ComponentB::cmdDisplayDone()
{
    return true;
}

So on the TaskBrowser:
ComponentA.mthDoPostCommandToB(50)
 
The display is
 
Post 0 (the first execution is begun because all the posts, but is long (because sleep(1))
 
Post 1
Post 2
...
Post 16

Am I right?
How can I increase the number of commands?
Thanks.
Guillaume