Call an operation written in "run.ops" from a lua script

Hi, I wrote a simple function in my run.ops script. The function is also listed in the operations of the Deployer. I can call the function from commandline "Deployer [R]> functionName()" but if I try to call the operation from another lua script (from itasc_supervisro.lua) I get "attempt to call field 'functionName' (a nil value)". To call the function from lua I use:

peertable.Deployer.createTopic()
and I'm sure the Deployer is in the peertable. What am I doing wrong?

Call an operation written in "run.ops" from a lua script

On Mon, May 06, 2013 at 04:11:05PM +0200, alain [dot] scialoja [..] ... wrote:
> Hi,
> I wrote a simple function in my run.ops script. The function is also listed
> in the operations of the Deployer. I can call the function from commandline
> "Deployer [R]> functionName()" but if I try to call the operation from
> another lua script (from itasc_supervisro.lua) I get "attempt to call field
> 'functionName' (a nil value)". To call the function from lua I use:
> peertable.Deployer.createTopic()
>
> and I'm sure the Deployer is in the peertable.
> What am I doing wrong?

How do you add this function? Please provide more detail.

Does printing the interface of the Deployer

>=peertable.Deployer

show your function?

Markus

Call an operation written in "run.ops" from a lua script

Thank you, I solved it using:

functionName=peertable.Deployer:getOperation("functionName")      
...
functionName()

I still don't understand why with the Deployer I need to import the Operation while not with other components... but i works. :)

Alain

Call an operation written in "run.ops" from a lua script

The function is added as follow in the Orocos script:

export void functionName{
  print.ln("function executed")
}

If I print the interface from the lua state machine, the function is printed in the Operations. I used:

print(peertable.Deployer)

to call the function I use:

peertable.Deployer.functionName()

But I still get: "ENTRYerror executing entry of root.NONemergency.s_en_outBound: .../thesis_ROS_LV/iBot_app/scripts/itasc_supervisor.lua:405: attempt to call method 'functionName' (a nil value) "

I just realized I can't call also the predefined Operations of the Deployer (e.g. getComponentTypes()) I already defined some Operations in custom Orocos Components (C++) and I'm calling these from the state machine without any problem.