Using OperationCallers in scripting

Hi guys,

I have a component that declares a needed operation using the
OperationCaller object:
this->requires("miror")->addOperationCaller(miror_command);
where miror_command is a RTT::OperationCaller<bool(double)>("miror_command")

My issue is that I would like to define a StateMachine executed in that
component that would use this caller to call the actual operation.
However, the OperationCaller is not available from the scripting:

Deployer [S]> MirorControler.miror_command
No method "miror_command" registered for the object or task
"MirorControler".

Whereas it appears in my component interface:

> ls MirorControler
(...)
Requires Operations : miror_command[R]

Would it be easy to extend the scripting so that operation callers would be
accessible from scripting?

Is there a workaround to this (like casting the OperationCaller to an
Operation), which would make the function available in scripting?

What is the rttlua status about this?

Best,

Charles

Using OperationCallers in scripting

On Fri, Nov 30, 2012 at 2:08 PM, Charles Lesire-Cabaniols
<charles [dot] lesire [..] ...> wrote:
> Hi guys,
>
> I have a component that declares a needed operation using the
> OperationCaller object:
> this->requires("miror")->addOperationCaller(miror_command);
> where miror_command is a RTT::OperationCaller<bool(double)>("miror_command")
>
> My issue is that I would like to define a StateMachine executed in that
> component that would use this caller to call the actual operation.
> However, the OperationCaller is not available from the scripting:
>
> Deployer [S]> MirorControler.miror_command
> No method "miror_command" registered for the object or task
> "MirorControler".
>
> Whereas it appears in my component interface:
>
>> ls MirorControler
> (...)
> Requires Operations : miror_command[R]
>
> Would it be easy to extend the scripting so that operation callers would be
> accessible from scripting?

No. We had this discussion before on this list. The OperationCaller is
a C++ structure that mimicks what you can do in scripting, ie have
code that binds after compilation time to an operation. For having
this in scripting (also lua) you need to use 'indirection', ie, add a
component with an alias peer name and use 'alias.operation' or
'alias:getOperation("operation")' in lua.

>
> Is there a workaround to this (like casting the OperationCaller to an
> Operation), which would make the function available in scripting?

Not so easily. You would need access to the OperationInterfacePart,
while the caller only stores an OperationCallerBase object, ie the
pure C++ operation object. Also, this would only work after the
OperationCaller was initialized.

You could extend OperationCaller to store this pointer if it's
available, and extend rtt scripting + lua to also lookup 'parts' in
the requires interface.

>
> What is the rttlua status about this?

Same restrictions.

Peter