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")
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.
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?
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.
Thank you.
G. Rizzi
fails to configure and start component from orocos script
On Sunday 17 April 2011 21:58:35 gprizzi [..] ... wrote:
> 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")
loadPrograms has been deprecated. Use 'runScript' instead. runScript does not
require a program {} section and can execute top level scripts too. It
accepts all scripting syntax - top-level, program, function and state machine.
>
> 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.
>
> 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?
>
> 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.
Top-level scripts are executed line-by-line, so you can load a component on
line 1 and use it on line 2. In program {} scripts, it is first fully parsed,
and then executed. So in that case, you can not load a component in line 1 and
then use it on line 2, since the loading only happens at program run-time.
>
> Thank you.
>
> G. Rizzi
Peter
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
>
> 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") "
Regards,
Steven
>
> Thank you.
>
> G. Rizzi
>
>