rttlua: error in printing a component interface

Hi,

I have imported a package that contains my component, named Obc, in rttlua.

Everything seems to work (using the component, configuring it, reading
ports...), except when I try to print its interface, using either
rttlib.stat() or 'return'.
It gives me the following error:

> obc = depl:getPeer("Obc")
> =obc
error calling 'print'
(...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:559:
Operation.call: wrong number of args. expected 2, got 0)

Any idea?

Using the deployer, 'ls Obc' displays correctly :
Deployer [S]> ls Obc

Listing TaskContext Obc[S] :

Configuration Properties:
string rx_path = /dev/ttyS1 (Rx device path)
string tx_path = /dev/ttyS2 (Tx device path)
array[3f] origin = (0, 0, 0) (Origin of the world
frame in WGS84 GPS coords ([0]/[1] lat/long (degree), [2] altitude
(meters)))
uint id = 0 (Uav id)
double wp_threshold = 1 (Waypoint distance
threshold to be considered as reached.)
string target_name = Robert (Target name.)
bool target_detected = false (Flag for target
detection.)

Provided Interface:
Attributes :
bool enable_tx = true
bool have_gps = true

Operations : activate altitude cleanup configure error
getCpuAffinity getId getImplName getInterfaceName getMaxA getMaxV getMinDt
getPeriod getPhase getPhaseStr getState gotou inFatalError inRunTimeError
isActive isConfigured isRunning loadService move obstacleAdd obstacleDel
obstacleUpdate pitchRoll quickSetObj quickWaypointDel setCpuAffinity setObj
setPeriod setPhase setPhaseDescente setPhaseStr start stop track trigger
update wayAdd wayDel wayPop wayPush waypointAdd waypointDel

Data Flow Ports:
Out(U) State state => 0.000000 0.000000 0 0 0 0 0
(4.29497e+09 0) (4.29497e+09 (0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0,
0))
In(U) Talc.Avionique.Pose pose <= ( use 'pose.read(sample)' to
read a sample from this port)
Out(U) Talc.Avionique.Destination destination =>
(/Talc/Avionique/Destination)
Out(U) Talc.Avionique.Destination orientation =>
(/Talc/Avionique/Destination)
In(U) string target_json <= ( use 'target_json.read(sample)' to
read a sample from this port)
Out(U) State target_state => 0.000000 0.000000 0 0 0 0 0
(4.29497e+09 0) (4.29497e+09 (0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0,
0))

Services:
destination ( Output robot destination. )
orientation ( Output robot orientation. )
pose ( Input robot Pose. )
state ( Output state. )
target_json ( Input target detection as a json string. )
target_state ( Output target state. )

Requires Operations : (none)
Requests Services : (none)

Peers : (none)

rttlua: error in printing a component interface

Hi Charles,

On Wed, Apr 04, 2012 at 11:00:17AM +0200, Charles Lesire-Cabaniols wrote:
> Hi,
>
> I have imported a package that contains my component, named Obc, in rttlua.
>
> Everything seems to work (using the component, configuring it, reading
> ports...), except when I try to print its interface, using either rttlib.stat()
> or 'return'.
> It gives me the following error:
>
> > obc = depl:getPeer("Obc")
> > =obc
> error calling 'print' (...home/lesire/work/autoproj/ocl/lua/modules/
> rttlib.lua:559: Operation.call: wrong number of args. expected 2, got 0)

Is this the full backtrace or is there more? Which version of OCL are
you using? (If it's not, could you give the current OCL toolchain-2.5
from git a try?)

Markus

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> Hi Charles,
>
> On Wed, Apr 04, 2012 at 11:00:17AM +0200, Charles Lesire-Cabaniols wrote:
> > Hi,
> >
> > I have imported a package that contains my component, named Obc, in
> rttlua.
> >
> > Everything seems to work (using the component, configuring it, reading
> > ports...), except when I try to print its interface, using either
> rttlib.stat()
> > or 'return'.
> > It gives me the following error:
> >
> > > obc = depl:getPeer("Obc")
> > > =obc
> > error calling 'print' (...home/lesire/work/autoproj/ocl/lua/modules/
> > rttlib.lua:559: Operation.call: wrong number of args. expected 2, got 0)
>
> Is this the full backtrace or is there more? Which version of OCL are
> you using? (If it's not, could you give the current OCL toolchain-2.5
> from git a try?)
>

I just have this error trace when using 'return'
I am on the master branches of the Orocos toolchain packages.
Same result with toolchain-2.5.

The complete trace of rttlib.stat:

> rttlib.stat()
Name State isActive
Period
lua PreOperational true
0
deployer Stopped true
0
Camera PreOperational true
0
Detection Running true
0
ImageWriter Stopped true
0
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615:
Operation.call: wrong number of args. expected 2, got 0
stack traceback:
[C]: ?
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615: in
function 'getState'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:577: in
function 'func'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:549: in
function '__mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:550: in
function '__mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:550: in
function '__mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:550: in
function '__mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:553: in
function 'mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:586: in
function 'stat'
stdin:1: in main chunk
[C]: ?

>
> Markus
>

rttlua: error in printing a component interface

On Wed, Apr 04, 2012 at 01:34:38PM +0200, Charles Lesire-Cabaniols wrote:
>
>
> 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> Hi Charles,
>
> On Wed, Apr 04, 2012 at 11:00:17AM +0200, Charles Lesire-Cabaniols wrote:
> > Hi,
> >
> > I have imported a package that contains my component, named Obc, in
> rttlua.
> >
> > Everything seems to work (using the component, configuring it, reading
> > ports...), except when I try to print its interface, using either
> rttlib.stat()
> > or 'return'.
> > It gives me the following error:
> >
> > > obc = depl:getPeer("Obc")
> > > =obc
> > error calling 'print' (...home/lesire/work/autoproj/ocl/lua/modules/
> > rttlib.lua:559: Operation.call: wrong number of args. expected 2, got 0)
>
> Is this the full backtrace or is there more? Which version of OCL are
> you using? (If it's not, could you give the current OCL toolchain-2.5
> from git a try?)
>
>
> I just have this error trace when using 'return'
> I am on the master branches of the Orocos toolchain packages.
> Same result with toolchain-2.5.
>
> The complete trace of rttlib.stat:
>
> > rttlib.stat()
> Name State isActive Period
>
> lua PreOperational true 0
>
> deployer Stopped true 0
>
> Camera PreOperational true 0
>
> Detection Running true 0
>
> ImageWriter Stopped true 0
>
> ...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615: Operation.call:
> wrong number of args. expected 2, got 0
> stack traceback:
> [C]: ?
> ...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615: in function
> 'getState'

Huh,hmm, it fails in the getState call (that returns the TaskContext
state). Is it possible that your component adds a custom getState
operation which shadows the default Lua one?

Markus

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> On Wed, Apr 04, 2012 at 01:34:38PM +0200, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > Hi Charles,
> >
> > On Wed, Apr 04, 2012 at 11:00:17AM +0200, Charles Lesire-Cabaniols
> wrote:
> > > Hi,
> > >
> > > I have imported a package that contains my component, named Obc, in
> > rttlua.
> > >
> > > Everything seems to work (using the component, configuring it,
> reading
> > > ports...), except when I try to print its interface, using either
> > rttlib.stat()
> > > or 'return'.
> > > It gives me the following error:
> > >
> > > > obc = depl:getPeer("Obc")
> > > > =obc
> > > error calling 'print'
> (...home/lesire/work/autoproj/ocl/lua/modules/
> > > rttlib.lua:559: Operation.call: wrong number of args. expected 2,
> got 0)
> >
> > Is this the full backtrace or is there more? Which version of OCL are
> > you using? (If it's not, could you give the current OCL toolchain-2.5
> > from git a try?)
> >
> >
> > I just have this error trace when using 'return'
> > I am on the master branches of the Orocos toolchain packages.
> > Same result with toolchain-2.5.
> >
> > The complete trace of rttlib.stat:
> >
> > > rttlib.stat()
> > Name State isActive
> Period
> >
> > lua PreOperational true 0
> >
> > deployer Stopped true 0
> >
> > Camera PreOperational true 0
> >
> > Detection Running true 0
> >
> > ImageWriter Stopped true 0
> >
> > ...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615:
> Operation.call:
> > wrong number of args. expected 2, got 0
> > stack traceback:
> > [C]: ?
> > ...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:615: in
> function
> > 'getState'
>
> Huh,hmm, it fails in the getState call (that returns the TaskContext
> state). Is it possible that your component adds a custom getState
> operation which shadows the default Lua one?
>

You're right, my Obc components provides a 'getState' operation...
Is there a workaround without modifying my component?

>
> Markus
>

rttlua: error in printing a component interface

On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles Lesire-Cabaniols wrote:
> 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
...

> Huh,hmm, it fails in the getState call (that returns the TaskContext
> state). Is it possible that your component adds a custom getState
> operation which shadows the default Lua one?
>
> You're right, my Obc components provides a 'getState' operation...
> Is there a workaround without modifying my component?

Can you give patch below a try? I expect this to fix the problem in
rttlib, however it is still confusing to have such overriding, so I
would advise to rename in the long run.

Markus

>From 68c3583143892a63d0cf9af067fe48069e15f11e Mon Sep 17 00:00:00 2001
From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
Date: Wed, 4 Apr 2012 14:53:38 +0200
Subject: [PATCH] Avoid failures in rttlib if a component shadows Lua
operations.

Thanks to Charles Lesire-Cabaniols for discovering this.
---
lua/modules/rttlib.lua | 55 +++++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 26 deletions(-)

diff --git a/lua/modules/rttlib.lua b/lua/modules/rttlib.lua
index 4c22c17..ed39ad4 100644

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles Lesire-Cabaniols wrote:
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> ...
>
> > Huh,hmm, it fails in the getState call (that returns the TaskContext
> > state). Is it possible that your component adds a custom getState
> > operation which shadows the default Lua one?
> >
> > You're right, my Obc components provides a 'getState' operation...
> > Is there a workaround without modifying my component?
>
> Can you give patch below a try? I expect this to fix the problem in
> rttlib, however it is still confusing to have such overriding, so I
> would advise to rename in the long run.
>

I can't apply your patch to my sources (neither in toolchain-2.5 nor in
master branch) because you seem to have other modifications prior to the
patch that invalidate it...

>
> Markus
>
>
>
> From 68c3583143892a63d0cf9af067fe48069e15f11e Mon Sep 17 00:00:00 2001
> From: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Date: Wed, 4 Apr 2012 14:53:38 +0200
> Subject: [PATCH] Avoid failures in rttlib if a component shadows Lua
> operations.
>
> Thanks to Charles Lesire-Cabaniols for discovering this.
> ---
> lua/modules/rttlib.lua | 55
> +++++++++++++++++++++++++----------------------
> 1 files changed, 29 insertions(+), 26 deletions(-)
>
> diff --git a/lua/modules/rttlib.lua b/lua/modules/rttlib.lua
> index 4c22c17..ed39ad4 100644

rttlua: error in printing a component interface

On Wed, Apr 04, 2012 at 03:15:47PM +0200, Charles Lesire-Cabaniols wrote:
>
> 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles Lesire-Cabaniols wrote:
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> ...
>
> > Huh,hmm, it fails in the getState call (that returns the TaskContext
> > state). Is it possible that your component adds a custom getState
> > operation which shadows the default Lua one?
> >
> > You're right, my Obc components provides a 'getState' operation...
> > Is there a workaround without modifying my component?
>
> Can you give patch below a try? I expect this to fix the problem in
> rttlib, however it is still confusing to have such overriding, so I
> would advise to rename in the long run.
>
>
> I can't apply your patch to my sources (neither in toolchain-2.5 nor in master
> branch) because you seem to have other modifications prior to the patch that
> invalidate it...

No, I only have that one on top of toolchain-2.5:

$ git log origin/toolchain-2.5..
commit 68c3583143892a63d0cf9af067fe48069e15f11e
Author: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
Date: Wed Apr 4 14:53:38 2012 +0200

Avoid failures in rttlib if a component shadows Lua operations.

Thanks to Charles Lesire-Cabaniols for discovering this.

Is it possible you email program wrapped lines? I'll attach the patch
instead of sending it inline...

Markus

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> On Wed, Apr 04, 2012 at 03:15:47PM +0200, Charles Lesire-Cabaniols wrote:
> >
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles Lesire-Cabaniols
> wrote:
> > > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...
> >
> > ...
> >
> > > Huh,hmm, it fails in the getState call (that returns the
> TaskContext
> > > state). Is it possible that your component adds a custom
> getState
> > > operation which shadows the default Lua one?
> > >
> > > You're right, my Obc components provides a 'getState' operation...
> > > Is there a workaround without modifying my component?
> >
> > Can you give patch below a try? I expect this to fix the problem in
> > rttlib, however it is still confusing to have such overriding, so I
> > would advise to rename in the long run.
> >
> >
> > I can't apply your patch to my sources (neither in toolchain-2.5 nor in
> master
> > branch) because you seem to have other modifications prior to the patch
> that
> > invalidate it...
>
> No, I only have that one on top of toolchain-2.5:
>
> $ git log origin/toolchain-2.5..
> commit 68c3583143892a63d0cf9af067fe48069e15f11e
> Author: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Date: Wed Apr 4 14:53:38 2012 +0200
>
> Avoid failures in rttlib if a component shadows Lua operations.
>
> Thanks to Charles Lesire-Cabaniols for discovering this.
>
>
> Is it possible you email program wrapped lines? I'll attach the patch
> instead of sending it inline...
>

Seems to be the case. The patch applied successfully, however:

> rttlib.stat()
Name State isActive
Period
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:583: attempt to
call field 'isActive' (a nil value)
stack traceback:
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:583: in
function 'func'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:552: in
function '__mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:556: in
function 'mappeers'
...home/lesire/work/autoproj/ocl/lua/modules/rttlib.lua:589: in
function 'stat'
stdin:1: in main chunk
[C]: ?
>

>
> Markus
>

rttlua: error in printing a component interface

On Wed, Apr 04, 2012 at 04:19:26PM +0200, Charles Lesire-Cabaniols wrote:
>
>
> 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> On Wed, Apr 04, 2012 at 03:15:47PM +0200, Charles Lesire-Cabaniols wrote:
> >
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles Lesire-Cabaniols
> wrote:
> > > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> > ...
> >
> > > Huh,hmm, it fails in the getState call (that returns the
> TaskContext
> > > state). Is it possible that your component adds a custom
> getState
> > > operation which shadows the default Lua one?
> > >
> > > You're right, my Obc components provides a 'getState' operation...
> > > Is there a workaround without modifying my component?
> >
> > Can you give patch below a try? I expect this to fix the problem in
> > rttlib, however it is still confusing to have such overriding, so I
> > would advise to rename in the long run.
> >
> >
> > I can't apply your patch to my sources (neither in toolchain-2.5 nor in
> master
> > branch) because you seem to have other modifications prior to the patch
> that
> > invalidate it...
>
> No, I only have that one on top of toolchain-2.5:
>
> $ git log origin/toolchain-2.5..
> commit 68c3583143892a63d0cf9af067fe48069e15f11e
> Author: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> Date: Wed Apr 4 14:53:38 2012 +0200
>
> Avoid failures in rttlib if a component shadows Lua operations.
>
> Thanks to Charles Lesire-Cabaniols for discovering this.
>
>
> Is it possible you email program wrapped lines? I'll attach the patch
> instead of sending it inline...
>
>
> Seems to be the case. The patch applied successfully, however:

Ups, these _are_ available only as operations.
New patch attached.
Hope I got it this time.

Markus

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> On Wed, Apr 04, 2012 at 04:19:26PM +0200, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > On Wed, Apr 04, 2012 at 03:15:47PM +0200, Charles Lesire-Cabaniols
> wrote:
> > >
> > > 2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...
> >
> > >
> > > On Wed, Apr 04, 2012 at 02:20:29PM +0200, Charles
> Lesire-Cabaniols
> > wrote:
> > > > 2012/4/4 Markus Klotzbuecher <
> markus [dot] klotzbuecher [..] ...>
> > > ...
> > >
> > > > Huh,hmm, it fails in the getState call (that returns the
> > TaskContext
> > > > state). Is it possible that your component adds a custom
> > getState
> > > > operation which shadows the default Lua one?
> > > >
> > > > You're right, my Obc components provides a 'getState'
> operation...
> > > > Is there a workaround without modifying my component?
> > >
> > > Can you give patch below a try? I expect this to fix the
> problem in
> > > rttlib, however it is still confusing to have such overriding,
> so I
> > > would advise to rename in the long run.
> > >
> > >
> > > I can't apply your patch to my sources (neither in toolchain-2.5
> nor in
> > master
> > > branch) because you seem to have other modifications prior to the
> patch
> > that
> > > invalidate it...
> >
> > No, I only have that one on top of toolchain-2.5:
> >
> > $ git log origin/toolchain-2.5..
> > commit 68c3583143892a63d0cf9af067fe48069e15f11e
> > Author: Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> > Date: Wed Apr 4 14:53:38 2012 +0200
> >
> > Avoid failures in rttlib if a component shadows Lua operations.
> >
> > Thanks to Charles Lesire-Cabaniols for discovering this.
> >
> >
> > Is it possible you email program wrapped lines? I'll attach the patch
> > instead of sending it inline...
> >
> >
> > Seems to be the case. The patch applied successfully, however:
>
> Ups, these _are_ available only as operations.
> New patch attached.
> Hope I got it this time.
>

Ok, I got it :)

Thanks !

> rttlib.stat()
Name State isActive
Period
lua PreOperational true
0
deployer Stopped true
0
Camera PreOperational true
0
Detection Running true
0
ImageWriter Stopped true
0
Obc PreOperational true
0
Matching Running true
0
StateWriter Stopped true
0
>

>
> Markus
>

rttlua: error in printing a component interface

...

> Ups, these _are_ available only as operations.
> New patch attached.
> Hope I got it this time.
>
>
> Ok, I got it :)
>
> Thanks !
>
> > rttlib.stat()
> Name State isActive Period
> lua PreOperational true 0
> deployer Stopped true 0
> Camera PreOperational true 0
> Detection Running true 0
> ImageWriter Stopped true 0
> Obc PreOperational true 0
> Matching Running true 0
> StateWriter Stopped true 0

Great, thanks for testing.
I'll push the patch directly through to toolchain-2.5.

Markus

rttlua: error in printing a component interface

2012/4/4 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>

> ...
>
> > Ups, these _are_ available only as operations.
> > New patch attached.
> > Hope I got it this time.
> >
> >
> > Ok, I got it :)
> >
> > Thanks !
> >
> > > rttlib.stat()
> > Name State isActive
> Period
> > lua PreOperational true 0
> > deployer Stopped true 0
> > Camera PreOperational true 0
> > Detection Running true 0
> > ImageWriter Stopped true 0
> > Obc PreOperational true 0
> > Matching Running true 0
> > StateWriter Stopped true 0
>
> Great, thanks for testing.
> I'll push the patch directly through to toolchain-2.5.
>

Good.
However, the patch is not applicable as is to 'master'... may cause some
troubles when merging for the next 2.6 release!

Charles.

>
> Markus
>