R: fails to configure and start component from orocos script

Thank you a lot.

I remove the "program" from my script and now it works!

I am looking at your very useful youBoot exercise and I noticed that you use

connectPeers("Supervisor","Controller")

before using

connect("Controller.ctrl","Simulator.ctrl",cp)

Is this necesary?

In my example I didn't use connectPeers but apparently no error was shown.

----Messaggio originale----
Da: steven [dot] bellens [..] ...
Data: 18-apr-2011 9.09
A: "gprizzi [..] ..."<gprizzi [..] ...>
Cc: "orocos-users [..] ..."<orocos-users [..] ...>
Ogg: Re: [Orocos-users] fails to configure and start component from orocos script

2011/4/17 gprizzi [..] ... <gprizzi [..] ...>:
> Dear Sirs,
>
> I am trying to configure and start components from an Orocos script.
> I am working with toolchain 2.3.1.
> I looked at the tutorial "Configuring and starting Components from an
> Orocos script" on Orocos web site
> and I wrote the following "startup.ops" script.
>
>
> program loadmyapp
> {
> path("/usr/local/lib/orocos")
> import("rosetta")
> import("ocl")
> require("print")
> loadComponent("indControllerInput1","rosetta::IndControllerInputInterface")
>
> loadComponent("behDefArm1","rosetta::BehaviorActivation")
> setActivity("indControllerInput1",0.01,HighestPriority,ORO_SCHED_RT)
> setActivity("behDefArm1",0.1,HighestPriority,ORO_SCHED_RT)
>
> var ConnPolicy cp_1
>
> cp_1.type = DATA
> cp_1.size = 1
> cp_1.lock_policy = LOCKED
>
> connect("indCtrlInputInt1.RobotArmPosition","behDefArm1.RobotArmPosition",
> cp_1)
> if ( behDefArm1.configure() == false ) // line 19
> print.ln("behDefArm1 configuration failed!")
> else {
> print.ln("starting components")
> indControllerInput1.start()
> behDefArm1.start()
> }
> }
>
>
> To test my script I run deployer-xenomai and using it I issued the commands:
>
> .provide scripting
> scripting.loadPrograms("startup.ops")

An alternative is to not define the script as a program (remove the
first 2 lines and the last) and start it together with the deployer
using the -s option

deployer-xenomai -s startup.ops

OK I tried this and now works!

>
> I get the following error:
>
> Deployer [S]> scripting.loadPrograms("startup.ops")
> 160.354 [ ERROR ][ProgramLoader::loadProgram] startup.ops :Parse error at
> line 19: Service or Task "Deployer" has no Peer or Service behDefArm1 (or
> Deployer was not found at all).
> = false
>
> I am doing something wrong.

I guess the deployer probably failed to set-up the behDefArm1 object
in the first place here:
"loadComponent("behDefArm1","rosetta::BehaviorActivation") "

Did the package build properly?
Did the deployer manage to import the package libraries?
Did it manage to create the behDefArm1 component?

You can have a look at the deployer output messages in debug mode
(-ldebug option)

>
> Can you help me to undesrtand the right way I have to follow to write a
> script that can load my components, connect, configure and run them?

You're on the right path :)

>
> I can't understand for instance how I can use behDefArm1 as an object and
> invoke on it the method configure without having defined it.

You d0 define it here:

"loadComponent("behDefArm1","rosetta::BehaviorActivation") "

Ok. I had in my mind the orogen model where I had to write

behaviorActivation1 = task("behDefArm1", "BehaviorActivation")

to define explicitly a reference to the instance of the task.

Regards,

Steven

>
> Thank you.
>
> G. Rizzi
>
>

fails to configure and start component from orocos script

2011/4/18 gprizzi [..] ... <gprizzi [..] ...>:
> Thank you a lot.
>
> I remove the "program"  from my script and now it works!
>
> I am looking at your very useful youBoot exercise and I noticed that you use
>
> connectPeers("Supervisor","Controller")
>
> before using
>
> connect("Controller.ctrl","Simulator.ctrl",cp)
>
> Is this necesary?

I'm not sure about this. I think the connectPeers is not needed for
connecting ports, but you need it when you want to call a Peer's
service for example.

Steven

>
> In my example I didn't use connectPeers but apparently no error was shown.
>
>
>
> ----Messaggio originale----
> Da: steven [dot] bellens [..] ...
> Data: 18-apr-2011 9.09
> A: "gprizzi [..] ..."<gprizzi [..] ...>
> Cc:
> "orocos-users [..] ..."<orocos-users [..] ...>
> Ogg: Re: [Orocos-users] fails to configure and start component from orocos
> script
>
> 2011/4/17 gprizzi [..] ... <gprizzi [..] ...>:
>>  Dear Sirs,
>>
>>  I am trying to configure and start components from an Orocos script.
>>  I am working with toolchain 2.3.1.
>>  I looked at the tutorial "Configuring and starting Components from an
>> Orocos script" on Orocos web site
>>  and I wrote the following "startup.ops" script.
>>
>>
>> program loadmyapp
>> {
>> path("/usr/local/lib/orocos")
>> import("rosetta")
>> import("ocl")
>> require("print")
>>
>> loadComponent("indControllerInput1","rosetta::IndControllerInputInterface")
>>
>> loadComponent("behDefArm1","rosetta::BehaviorActivation")
>> setActivity("indControllerInput1",0.01,HighestPriority,ORO_SCHED_RT)
>> setActivity("behDefArm1",0.1,HighestPriority,ORO_SCHED_RT)
>>
>> var ConnPolicy cp_1
>>
>> cp_1.type = DATA
>> cp_1.size = 1
>> cp_1.lock_policy = LOCKED
>>
>> connect("indCtrlInputInt1.RobotArmPosition","behDefArm1.RobotArmPosition",
>> cp_1)
>> if ( behDefArm1.configure() == false )                     // line 19
>>    print.ln("behDefArm1 configuration failed!")
>> else {
>>       print.ln("starting components")
>>       indControllerInput1.start()
>>       behDefArm1.start()
>>    }
>> }
>>
>>
>> To test my script I run deployer-xenomai and using it I issued the
>> commands:
>>
>>  .provide scripting
>> scripting.loadPrograms("startup.ops")
>
>
> An alternative is to not define the script as a program (remove the
> first 2 lines and the last) and start it together with the deployer
> using the -s option
>
> deployer-xenomai -s startup.ops
>
>
> OK I tried this and now works!
>
>>
>> I get the following error:
>>
>> Deployer [S]> scripting.loadPrograms("startup.ops")
>> 160.354 [ ERROR  ][ProgramLoader::loadProgram] startup.ops :Parse error at
>> line 19: Service or Task "Deployer" has no Peer or Service behDefArm1 (or
>> Deployer was not found at all).
>>  = false
>>
>> I am doing something wrong.
>
>
> I guess the deployer probably failed to set-up the behDefArm1 object
> in the first place here:
> "loadComponent("behDefArm1","rosetta::BehaviorActivation")  "
>
> Did the package build properly?
> Did the deployer manage to import the package libraries?
> Did it manage to create the behDefArm1 component?
>
> You can have a look at the deployer output messages in debug mode
> (-ldebug option)
>
>>
>> Can you help me to undesrtand the right way I have to follow to write a
>> script that can load my components, connect, configure and run them?
>
> You're on the right path :)
>
>>
>> I can't understand for instance how I can use behDefArm1 as an object and
>> invoke on it the method configure without having defined it.
>
> You d0 define it here:
>
> "loadComponent("behDefArm1","rosetta::BehaviorActivation") "
>
>
> Ok. I had in my mind the orogen model where I had to write
>
>     behaviorActivation1 = task("behDefArm1", "BehaviorActivation")
>
> to define explicitly  a reference to the instance of the task.
>
>
>
>
> Regards,
>
> Steven
>
>>
>> Thank you.
>>
>> G. Rizzi
>>
>>
>
>
>

fails to configure and start component from orocos script

2011/4/18 Steven Bellens <steven [dot] bellens [..] ...>

> 2011/4/18 gprizzi [..] ... <gprizzi [..] ...>:
> > Thank you a lot.
> >
> > I remove the "program" from my script and now it works!
> >
> > I am looking at your very useful youBoot exercise and I noticed that you
> use
> >
> > connectPeers("Supervisor","Controller")
> >
> > before using
> >
> > connect("Controller.ctrl","Simulator.ctrl",cp)
> >
> > Is this necesary?
>
> I'm not sure about this. I think the connectPeers is not needed for
> connecting ports, but you need it when you want to call a Peer's
> service for example.
>
>

When you create Ports your Components doesn't want to know to whom they are
connected ! (It's on of the job of Orocos : decoupling), So when you connect
them, only the supervision program that do the connection know it (here the
Deployer), and your 2 connected components continue their live without
knowing that someone is existing.

If you explicitely want your components to be aware of each other, you may
add them as peers. It should be an explicit design choice or a need when
using Orocos Operations.

So you absolutely don't need the connectPeer command and in a way, you
should *not* use it if you have no reason to do it on a philosophical point
of view (if you do so you won't break anything thougth).

> Steven
>
> >
> > In my example I didn't use connectPeers but apparently no error was
> shown.
> >
> >
> >
> > ----Messaggio originale----
> > Da: steven [dot] bellens [..] ...
> > Data: 18-apr-2011 9.09
> > A: "gprizzi [..] ..."<gprizzi [..] ...>
> > Cc:
> > "orocos-users [..] ..."<
> orocos-users [..] ...>
> > Ogg: Re: [Orocos-users] fails to configure and start component from
> orocos
> > script
> >
> > 2011/4/17 gprizzi [..] ... <gprizzi [..] ...>:
> >> Dear Sirs,
> >>
> >> I am trying to configure and start components from an Orocos script.
> >> I am working with toolchain 2.3.1.
> >> I looked at the tutorial "Configuring and starting Components from an
> >> Orocos script" on Orocos web site
> >> and I wrote the following "startup.ops" script.
> >>
> >>
> >> program loadmyapp
> >> {
> >> path("/usr/local/lib/orocos")
> >> import("rosetta")
> >> import("ocl")
> >> require("print")
> >>
> >>
> loadComponent("indControllerInput1","rosetta::IndControllerInputInterface")
> >>
> >> loadComponent("behDefArm1","rosetta::BehaviorActivation")
> >> setActivity("indControllerInput1",0.01,HighestPriority,ORO_SCHED_RT)
> >> setActivity("behDefArm1",0.1,HighestPriority,ORO_SCHED_RT)
> >>
> >> var ConnPolicy cp_1
> >>
> >> cp_1.type = DATA
> >> cp_1.size = 1
> >> cp_1.lock_policy = LOCKED
> >>
> >>
> connect("indCtrlInputInt1.RobotArmPosition","behDefArm1.RobotArmPosition",
> >> cp_1)
> >> if ( behDefArm1.configure() == false ) // line 19
> >> print.ln("behDefArm1 configuration failed!")
> >> else {
> >> print.ln("starting components")
> >> indControllerInput1.start()
> >> behDefArm1.start()
> >> }
> >> }
> >>
> >>
> >> To test my script I run deployer-xenomai and using it I issued the
> >> commands:
> >>
> >> .provide scripting
> >> scripting.loadPrograms("startup.ops")
> >
> >
> > An alternative is to not define the script as a program (remove the
> > first 2 lines and the last) and start it together with the deployer
> > using the -s option
> >
> > deployer-xenomai -s startup.ops
> >
> >
> > OK I tried this and now works!
> >
> >>
> >> I get the following error:
> >>
> >> Deployer [S]> scripting.loadPrograms("startup.ops")
> >> 160.354 [ ERROR ][ProgramLoader::loadProgram] startup.ops :Parse error
> at
> >> line 19: Service or Task "Deployer" has no Peer or Service behDefArm1
> (or
> >> Deployer was not found at all).
> >> = false
> >>
> >> I am doing something wrong.
> >
> >
> > I guess the deployer probably failed to set-up the behDefArm1 object
> > in the first place here:
> > "loadComponent("behDefArm1","rosetta::BehaviorActivation") "
> >
> > Did the package build properly?
> > Did the deployer manage to import the package libraries?
> > Did it manage to create the behDefArm1 component?
> >
> > You can have a look at the deployer output messages in debug mode
> > (-ldebug option)
> >
> >>
> >> Can you help me to undesrtand the right way I have to follow to write a
> >> script that can load my components, connect, configure and run them?
> >
> > You're on the right path :)
> >
> >>
> >> I can't understand for instance how I can use behDefArm1 as an object
> and
> >> invoke on it the method configure without having defined it.
> >
> > You d0 define it here:
> >
> > "loadComponent("behDefArm1","rosetta::BehaviorActivation") "
> >
> >
> > Ok. I had in my mind the orogen model where I had to write
> >
> > behaviorActivation1 = task("behDefArm1", "BehaviorActivation")
> >
> > to define explicitly a reference to the instance of the task.
> >
> >
> >
> >
> > Regards,
> >
> > Steven
> >
> >>
> >> Thank you.
> >>
> >> G. Rizzi
> >>
> >>
> >
> >
> >
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>