load a lua script in a cpp component with an ops script

Hello,

I want to use a lua script to specify the behaviour of a cpp component. To do this, I have a script connect.ops with the following lines :

loadComponent("ComponentA","NamespaceA::ComponentA") loadService("ComponentA","Lua") ComponentA.Lua.exec_file("fsm.lua") ComponentA.configure() ComponentA.start()

with fsm.lua (using rfsm) as in the cookbook : http://www.orocos.org/wiki/orocos/toolchain/luacookbook

To start it, I launch the following line : rosrun ocl deployer-gnulinux -s connect.ops

It runs without any error but i can't succeed to use the fsm in my deployer (nothing happens and I don't see any trace of my fsm). What do i need to do this?

Thank you,

Benoit

Re: load a lua script in a cpp component with an ops script

BenoitGoepfert wrote:
Hello,

I want to use a lua script to specify the behaviour of a cpp component. To do this, I have a script connect.ops with the following lines :

loadComponent("ComponentA","NamespaceA::ComponentA") loadService("ComponentA","Lua") ComponentA.Lua.exec_file("fsm.lua") ComponentA.configure() ComponentA.start()

with fsm.lua (using rfsm) as in the cookbook : http://www.orocos.org/wiki/orocos/toolchain/luacookbook

To start it, I launch the following line : rosrun ocl deployer-gnulinux -s connect.ops

It runs without any error but i can't succeed to use the fsm in my deployer (nothing happens and I don't see any trace of my fsm). What do i need to do this?

Thank you,

Benoit

This is a really old question, but I'm about to venture into this same world and I wonder if Benoit ever got a response? Benoit, did you have any luck with this path?

(Sorry for the double post... I used the forum instead of email and didn't realize "Add new comment" and "Quote" were separate options. Apologies.)

-dustin

load a lua script in a cpp

This is a really old question, but I'm about to venture into this same world and I wonder if Benoit ever got a response? Benoit, did you have any luck with this path?

-dustin

load a lua script in a cpp component with an ops script

On Fri, Jan 11, 2013 at 9:39 PM, <dustin [dot] r [dot] gooding [..] ...> wrote:

>

BenoitGoepfert wrote:
Hello,
>
> I want to use a lua script to specify the behaviour of a cpp component. To
> do
> this, I have a script connect.ops with the following lines :
>
> loadComponent("ComponentA","NamespaceA::ComponentA")
> loadService("ComponentA","Lua")
> ComponentA.Lua.exec_file("fsm.lua")
> ComponentA.configure()
> ComponentA.start()
>
> with fsm.lua (using rfsm) as in the cookbook :
> http://www.orocos.org/wiki/orocos/toolchain/luacookbook
>
> To start it, I launch the following line :
> rosrun ocl deployer-gnulinux -s connect.ops
>
> It runs without any error but i can't succeed to use the fsm in my deployer
> (nothing happens and I don't see any trace of my fsm).
> What do i need to do this?
>
> Thank you,
>
> Benoit

>
> This is a really old question, but I'm about to venture into this same
> world
> and I wonder if Benoit ever got a response? Benoit, did you have any luck
> with this path?
>

Looking at the above, I would think that he should have set a period of the
component and do exec_file on a launch_fsm.lua file instead of on a fsm.lua
file.

The section "Running rFSM in a Service" of the Cookbook already proposes
one way to do this. I also vaguely remember that
rfsm_rtt.service_launch_rfsm function did not fit our purpose in the past
and that we had to code something ourselves, inspired on that function.

Looking at the length of it, the cookbook should split out some sections
into tutorial child pages to cover such often asked questions

Peter

load a lua script in a cpp component with an ops script

On Fri, Jan 11, 2013 at 11:25:06PM +0100, Peter Soetens wrote:
> On Fri, Jan 11, 2013 at 9:39 PM, <dustin [dot] r [dot] gooding [..] ...> wrote:
>
>

BenoitGoepfert wrote:
Hello,
>
> I want to use a lua script to specify the behaviour of a cpp component. To
> do
> this, I have a script connect.ops with the following lines :
>
> loadComponent("ComponentA","NamespaceA::ComponentA")
> loadService("ComponentA","Lua")
> ComponentA.Lua.exec_file("fsm.lua")
> ComponentA.configure()
> ComponentA.start()
>
> with fsm.lua (using rfsm) as in the cookbook :
> http://www.orocos.org/wiki/orocos/toolchain/luacookbook
>
> To start it, I launch the following line :
> rosrun ocl deployer-gnulinux -s connect.ops
>
> It runs without any error but i can't succeed to use the fsm in my deployer
> (nothing happens and I don't see any trace of my fsm).
> What do i need to do this?
>
> Thank you,
>
> Benoit

>
> This is a really old question, but I'm about to venture into this same
> world
> and I wonder if Benoit ever got a response? Benoit, did you have any luck
> with this path?
>
>
> Looking at the above, I would think that he should have set a period of the
> component and do exec_file on a launch_fsm.lua file instead of on a fsm.lua
> file.

Yes, but the launch_fsm.lua is for components, ConfigureHook etc,
don't have any meaning for a Service.

> The section "Running rFSM in a Service" of the Cookbook already proposes one
> way to do this. I also vaguely remember that rfsm_rtt.service_launch_rfsm
> function did not fit our purpose in the past and that we had to code something
> ourselves, inspired on that function.

You'll most likely want to register a function with the
ExecutionEngine to trigger the fsm when the parent component is
triggered. rfsm_rtt.service_launch_rfsm doesn't do much, essentially
only:

_fsm = rfsm.load("' .. file .. '")
fsm = rfsm.init(_fsm)"
function trigger() rfsm.step(fsm); return true end
eehook = rtt.EEHook("trigger")
eehook:enable()

> Looking at the length of it, the cookbook should split out some sections into
> tutorial child pages to cover such often asked questions

Yes, definitely. I'm planning to move the entire rFSM stuff to a
separate page, when I get around to it.

Markus