From Orocos FSM to rFSM

Hi,

I want to explore the Lua rFSM libraries in my new components.
I am quite used with standard Orocos scripts, and I would like to migrate
my FSMs to rFSMs.

- there is nothing in the docs about "from orocos scripting to lua
scripting"; is there any example available? for quite complex, hierarchical
FSMs?
- is it possible to pass arguments to a rFSM (called parameters for the
Orocos FSMs)? If yes, what is the syntax?

Thanks in advance,

Charles.

From Orocos FSM to rFSM

Hi Charles,

On Thu, Mar 22, 2012 at 11:05:11AM +0100, Charles Lesire-Cabaniols wrote:

> I want to explore the Lua rFSM libraries in my new components.
> I am quite used with standard Orocos scripts, and I would like to migrate my
> FSMs to rFSMs.
>
> - there is nothing in the docs about "from orocos scripting to lua
> - scripting";

That would be interesting, but probably be better if I didn't write
that myself. If somebody who has gone through that process could give
feedback I would be pleased to collect it on a wiki page.

> is there any example available? for quite complex, hierarchical FSMs?

The "brick_stacking" application (that used the youbot) is moderatly
complex and maybe a good starting point:

https://github.com/kmarkus/brick_stacking

You can find more complex examples with iTaSC, but these maybe too
complex to get started with.

The simple didactical example can be found here:
http://gitorious.org/+orocos-maintainers/orocos-toolchain/rfsm-rtt-example

> - is it possible to pass arguments to a rFSM (called parameters for the Orocos
> FSMs)? If yes, what is the syntax?

It's possible, but there's no single best way to do this because (
terms of separation of concerns) it really depends where the parameter
is located. Referring to the rfsm-rtt-example from above, in most
cases it makes sense to retrieve/define the parameter in the
launch_fsm.lua RTTLua component such that it will be visible within
the fsm when loaded. I just pushed a minimal example to the
rfsm-rtt-example to illustrate that.

Markus

From Orocos FSM to rFSM

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

> Hi Charles,
>
> On Thu, Mar 22, 2012 at 11:05:11AM +0100, Charles Lesire-Cabaniols wrote:
>
> > I want to explore the Lua rFSM libraries in my new components.
> > I am quite used with standard Orocos scripts, and I would like to
> migrate my
> > FSMs to rFSMs.
> >
> > - there is nothing in the docs about "from orocos scripting to lua
> > - scripting";
>
> That would be interesting, but probably be better if I didn't write
> that myself. If somebody who has gone through that process could give
> feedback I would be pleased to collect it on a wiki page.
>
> > is there any example available? for quite complex, hierarchical FSMs?
>
> The "brick_stacking" application (that used the youbot) is moderatly
> complex and maybe a good starting point:
>
> https://github.com/kmarkus/brick_stacking
>
> You can find more complex examples with iTaSC, but these maybe too
> complex to get started with.
>
> The simple didactical example can be found here:
> http://gitorious.org/+orocos-maintainers/orocos-toolchain/rfsm-rtt-example
>
> > - is it possible to pass arguments to a rFSM (called parameters for the
> Orocos
> > FSMs)? If yes, what is the syntax?
>
> It's possible, but there's no single best way to do this because (
> terms of separation of concerns) it really depends where the parameter
> is located. Referring to the rfsm-rtt-example from above, in most
> cases it makes sense to retrieve/define the parameter in the
> launch_fsm.lua RTTLua component such that it will be visible within
> the fsm when loaded. I just pushed a minimal example to the
> rfsm-rtt-example to illustrate that.
>

Effectively, it ends in defining a property of the component that executes
the rFSM.

However, there is no clear interface for the rFSM (what are the needed
parameters), and you have to read the entire code to find the needed
parameters.

>
> Markus
>
>

From Orocos FSM to rFSM

On Fri, Mar 23, 2012 at 01:45:58PM +0100, Charles Lesire-Cabaniols wrote:
>
>
> 2012/3/22 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> Hi Charles,
>
> On Thu, Mar 22, 2012 at 11:05:11AM +0100, Charles Lesire-Cabaniols wrote:
>
> > I want to explore the Lua rFSM libraries in my new components.
> > I am quite used with standard Orocos scripts, and I would like to migrate
> my
> > FSMs to rFSMs.
> >
> > - there is nothing in the docs about "from orocos scripting to lua
> > - scripting";
>
> That would be interesting, but probably be better if I didn't write
> that myself. If somebody who has gone through that process could give
> feedback I would be pleased to collect it on a wiki page.
>
> > is there any example available? for quite complex, hierarchical FSMs?
>
> The "brick_stacking" application (that used the youbot) is moderatly
> complex and maybe a good starting point:
>
> https://github.com/kmarkus/brick_stacking
>
> You can find more complex examples with iTaSC, but these maybe too
> complex to get started with.
>
> The simple didactical example can be found here:
> http://gitorious.org/+orocos-maintainers/orocos-toolchain/rfsm-rtt-example
>
> > - is it possible to pass arguments to a rFSM (called parameters for the
> Orocos
> > FSMs)? If yes, what is the syntax?
>
> It's possible, but there's no single best way to do this because (
> terms of separation of concerns) it really depends where the parameter
> is located. Referring to the rfsm-rtt-example from above, in most
> cases it makes sense to retrieve/define the parameter in the
> launch_fsm.lua RTTLua component such that it will be visible within
> the fsm when loaded. I just pushed a minimal example to the
> rfsm-rtt-example to illustrate that.
>
>
> Effectively, it ends in defining a property of the component that executes the
> rFSM.
>
> However, there is no clear interface for the rFSM (what are the needed
> parameters), and you have to read the entire code to find the needed
> parameters.

True. That is something I've been thinking of for a while. The simple
solution has been to add assertions to the header of the fsm to check
that the required parameter is set. This could be formalized more for
instance by extending the rfsm.load function to provide a list of
values for parameters required by the fsm (similar to the RTT fsm
constructors).

Is that what you are looking for? IMO this is dangerously close to
being "policy", but maybe important enough to be justified.

Markus

From Orocos FSM to rFSM

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

> On Fri, Mar 23, 2012 at 01:45:58PM +0100, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/3/22 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > Hi Charles,
> >
> > On Thu, Mar 22, 2012 at 11:05:11AM +0100, Charles Lesire-Cabaniols
> wrote:
> >
> > > I want to explore the Lua rFSM libraries in my new components.
> > > I am quite used with standard Orocos scripts, and I would like to
> migrate
> > my
> > > FSMs to rFSMs.
> > >
> > > - there is nothing in the docs about "from orocos scripting to lua
> > > - scripting";
> >
> > That would be interesting, but probably be better if I didn't write
> > that myself. If somebody who has gone through that process could give
> > feedback I would be pleased to collect it on a wiki page.
> >
> > > is there any example available? for quite complex, hierarchical
> FSMs?
> >
> > The "brick_stacking" application (that used the youbot) is moderatly
> > complex and maybe a good starting point:
> >
> > https://github.com/kmarkus/brick_stacking
> >
> > You can find more complex examples with iTaSC, but these maybe too
> > complex to get started with.
> >
> > The simple didactical example can be found here:
> >
> http://gitorious.org/+orocos-maintainers/orocos-toolchain/rfsm-rtt-example
> >
> > > - is it possible to pass arguments to a rFSM (called parameters
> for the
> > Orocos
> > > FSMs)? If yes, what is the syntax?
> >
> > It's possible, but there's no single best way to do this because (
> > terms of separation of concerns) it really depends where the
> parameter
> > is located. Referring to the rfsm-rtt-example from above, in most
> > cases it makes sense to retrieve/define the parameter in the
> > launch_fsm.lua RTTLua component such that it will be visible within
> > the fsm when loaded. I just pushed a minimal example to the
> > rfsm-rtt-example to illustrate that.
> >
> >
> > Effectively, it ends in defining a property of the component that
> executes the
> > rFSM.
> >
> > However, there is no clear interface for the rFSM (what are the needed
> > parameters), and you have to read the entire code to find the needed
> > parameters.
>
> True. That is something I've been thinking of for a while. The simple
> solution has been to add assertions to the header of the fsm to check
> that the required parameter is set. This could be formalized more for
> instance by extending the rfsm.load function to provide a list of
> values for parameters required by the fsm (similar to the RTT fsm
> constructors).
>

I am not sure loading a FSM in a RTT Component is the only use case.
It may also appear when you load a sub-FSM (that returns a state) into your
own FSM... and then you may have to define a parameter that is not related
to the Orocos component (for instance because it is constant, related to
your root fsm).

Such a 'required parameters' specification is needed in general, not only
in the Orocos-RTT context.

>
> Is that what you are looking for? IMO this is dangerously close to
> being "policy", but maybe important enough to be justified.
>
> Markus
>

From Orocos FSM to rFSM

On Fri, Mar 23, 2012 at 03:51:46PM +0100, Charles Lesire-Cabaniols wrote:
>
>
> 2012/3/23 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> On Fri, Mar 23, 2012 at 01:45:58PM +0100, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/3/22 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
...
> > > - is it possible to pass arguments to a rFSM (called parameters for
> the
> > Orocos
> > > FSMs)? If yes, what is the syntax?
> >
> > It's possible, but there's no single best way to do this because (
> > terms of separation of concerns) it really depends where the
> parameter
> > is located. Referring to the rfsm-rtt-example from above, in most
> > cases it makes sense to retrieve/define the parameter in the
> > launch_fsm.lua RTTLua component such that it will be visible within
> > the fsm when loaded. I just pushed a minimal example to the
> > rfsm-rtt-example to illustrate that.
> >
> >
> > Effectively, it ends in defining a property of the component that
> executes the
> > rFSM.
> >
> > However, there is no clear interface for the rFSM (what are the needed
> > parameters), and you have to read the entire code to find the needed
> > parameters.
>
> True. That is something I've been thinking of for a while. The simple
> solution has been to add assertions to the header of the fsm to check
> that the required parameter is set. This could be formalized more for
> instance by extending the rfsm.load function to provide a list of
> values for parameters required by the fsm (similar to the RTT fsm
> constructors).
>
>
> I am not sure loading a FSM in a RTT Component is the only use case.
> It may also appear when you load a sub-FSM (that returns a state) into your own

No, for including a sub-fsm you should also use rfsm.load!

> FSM... and then you may have to define a parameter that is not related to the
> Orocos component (for instance because it is constant, related to your root
> fsm).

I don't see how that would be possible? If on each loading of a subfsm
the required parameters must be supplied, then a sub-fsm will never
see required parameters of the parent?

> Such a 'required parameters' specification is needed in general, not
> only in the Orocos-RTT context.

I do agree.

Markus

From Orocos FSM to rFSM

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

> On Fri, Mar 23, 2012 at 03:51:46PM +0100, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/3/23 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > On Fri, Mar 23, 2012 at 01:45:58PM +0100, Charles Lesire-Cabaniols
> wrote:
> > >
> > >
> > > 2012/3/22 Markus Klotzbuecher <
> markus [dot] klotzbuecher [..] ...>
> ...
> > > > - is it possible to pass arguments to a rFSM (called
> parameters for
> > the
> > > Orocos
> > > > FSMs)? If yes, what is the syntax?
> > >
> > > It's possible, but there's no single best way to do this
> because (
> > > terms of separation of concerns) it really depends where the
> > parameter
> > > is located. Referring to the rfsm-rtt-example from above, in
> most
> > > cases it makes sense to retrieve/define the parameter in the
> > > launch_fsm.lua RTTLua component such that it will be visible
> within
> > > the fsm when loaded. I just pushed a minimal example to the
> > > rfsm-rtt-example to illustrate that.
> > >
> > >
> > > Effectively, it ends in defining a property of the component that
> > executes the
> > > rFSM.
> > >
> > > However, there is no clear interface for the rFSM (what are the
> needed
> > > parameters), and you have to read the entire code to find the
> needed
> > > parameters.
> >
> > True. That is something I've been thinking of for a while. The simple
> > solution has been to add assertions to the header of the fsm to check
> > that the required parameter is set. This could be formalized more for
> > instance by extending the rfsm.load function to provide a list of
> > values for parameters required by the fsm (similar to the RTT fsm
> > constructors).
> >
> >
> > I am not sure loading a FSM in a RTT Component is the only use case.
> > It may also appear when you load a sub-FSM (that returns a state) into
> your own
>
> No, for including a sub-fsm you should also use rfsm.load!
>
> > FSM... and then you may have to define a parameter that is not related
> to the
> > Orocos component (for instance because it is constant, related to your
> root
> > fsm).
>
> I don't see how that would be possible? If on each loading of a subfsm
> the required parameters must be supplied, then a sub-fsm will never
> see required parameters of the parent?
>

Right. Maybe I misexplained my thought. Same player try again:
fsm A has fsm B as a sub-fsm. B may have a parameter P, and then when A
loads B, it has to give a value to P.
But that does not mean that A itself has a parameter!
Hence the fact that P is not related to the Orocos component that may load
and execute A...

>
> > Such a 'required parameters' specification is needed in general, not
> > only in the Orocos-RTT context.
>
> I do agree.
>
> Markus
>

From Orocos FSM to rFSM

On Fri, Mar 23, 2012 at 04:15:50PM +0100, Charles Lesire-Cabaniols wrote:
>
>
> 2012/3/23 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
>
> On Fri, Mar 23, 2012 at 03:51:46PM +0100, Charles Lesire-Cabaniols wrote:
> >
> >
> > 2012/3/23 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>
> >
> > On Fri, Mar 23, 2012 at 01:45:58PM +0100, Charles Lesire-Cabaniols
> wrote:
> > >
> > >
> > > 2012/3/22 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...
> >
> ...
> > > > - is it possible to pass arguments to a rFSM (called
> parameters for
> > the
> > > Orocos
> > > > FSMs)? If yes, what is the syntax?
> > >
> > > It's possible, but there's no single best way to do this
> because (
> > > terms of separation of concerns) it really depends where the
> > parameter
> > > is located. Referring to the rfsm-rtt-example from above, in
> most
> > > cases it makes sense to retrieve/define the parameter in the
> > > launch_fsm.lua RTTLua component such that it will be visible
> within
> > > the fsm when loaded. I just pushed a minimal example to the
> > > rfsm-rtt-example to illustrate that.
> > >
> > >
> > > Effectively, it ends in defining a property of the component that
> > executes the
> > > rFSM.
> > >
> > > However, there is no clear interface for the rFSM (what are the
> needed
> > > parameters), and you have to read the entire code to find the
> needed
> > > parameters.
> >
> > True. That is something I've been thinking of for a while. The simple
> > solution has been to add assertions to the header of the fsm to check
> > that the required parameter is set. This could be formalized more for
> > instance by extending the rfsm.load function to provide a list of
> > values for parameters required by the fsm (similar to the RTT fsm
> > constructors).
> >
> >
> > I am not sure loading a FSM in a RTT Component is the only use case.
> > It may also appear when you load a sub-FSM (that returns a state) into
> your own
>
> No, for including a sub-fsm you should also use rfsm.load!
>
> > FSM... and then you may have to define a parameter that is not related to
> the
> > Orocos component (for instance because it is constant, related to your
> root
> > fsm).
>
> I don't see how that would be possible? If on each loading of a subfsm
> the required parameters must be supplied, then a sub-fsm will never
> see required parameters of the parent?
>
>
> Right. Maybe I misexplained my thought. Same player try again:
> fsm A has fsm B as a sub-fsm. B may have a parameter P, and then when A loads
> B, it has to give a value to P.
> But that does not mean that A itself has a parameter!

No, but it *could* and thereby propagate it to the parent. But it
could also just provide a hard-coded value. This depends on the
meaning of the parameter...

> Hence the fact that P is not related to the Orocos component that may load and
> execute A...

I think that the requirements of composed entities can be safely (in
terms of not breaking compositionality) be viewed as being propagated
as requirements of the parent.

Markus

From Orocos FSM to rFSM

2012/3/22 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>:
> Hi,
>
> I want to explore the Lua rFSM libraries in my new components.
> I am quite used with standard Orocos scripts, and I would like to migrate my
> FSMs to rFSMs.
>
> - there is nothing in the docs about "from orocos scripting to lua
> scripting"; is there any example available? for quite complex, hierarchical
> FSMs?

To have done this some time ago, it is not really hard. Just read the
doc (and some lua before if you don't know it, as it was my case)
http://people.mech.kuleuven.be/~mklotzbucher/rfsm/README.html

It should be really straigth forward as you have
entry/run/exit/transition actions in both (it's more in the FSM side
than in the implementation side).

If you need to interact with other Orocos component, then I think
you'll need to be familiar with this :
http://www.orocos.org/wiki/orocos/toolchain/luacookbook

I think you'll bump more into lua synthax than in FSM translation problems.

I wonder if a code translator is not possible beetwen Orocos scripts
and rFSM ...

> - is it possible to pass arguments to a rFSM (called parameters for the
> Orocos FSMs)? If yes, what is the syntax?
>
> Thanks in advance,
>
> Charles.
>
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

From Orocos FSM to rFSM

On Thu, Mar 22, 2012 at 12:23:36PM +0100, Willy Lambert wrote:
> 2012/3/22 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>:
> > Hi,
> >
> > I want to explore the Lua rFSM libraries in my new components.
> > I am quite used with standard Orocos scripts, and I would like to migrate my
> > FSMs to rFSMs.
> >
> > - there is nothing in the docs about "from orocos scripting to lua
> > scripting"; is there any example available? for quite complex, hierarchical
> > FSMs?
>
> To have done this some time ago, it is not really hard. Just read the
> doc (and some lua before if you don't know it, as it was my case)
> http://people.mech.kuleuven.be/~mklotzbucher/rfsm/README.html
>
> It should be really straigth forward as you have
> entry/run/exit/transition actions in both (it's more in the FSM side
> than in the implementation side).
>
> If you need to interact with other Orocos component, then I think
> you'll need to be familiar with this :
> http://www.orocos.org/wiki/orocos/toolchain/luacookbook
>
> I think you'll bump more into lua synthax than in FSM translation problems.
>
> I wonder if a code translator is not possible beetwen Orocos scripts
> and rFSM ...

Syntaxwise it shouldn't be too hard, but there are also semantic
differences. As an example, the action execution of a transition from
State A to B with Orocos fsm is

effect() -> exit(A) -> enter(B)

while rFSM (as UML and Statecharts) do

exit(A) -> effect -> enter(B)

So it really requires some human thinking to ensure it is still
correct!

Markus

From Orocos FSM to rFSM

2012/3/22 Markus Klotzbuecher <markus [dot] klotzbuecher [..] ...>:
> On Thu, Mar 22, 2012 at 12:23:36PM +0100, Willy Lambert wrote:
>> 2012/3/22 Charles Lesire-Cabaniols <charles [dot] lesire [..] ...>:
>> > Hi,
>> >
>> > I want to explore the Lua rFSM libraries in my new components.
>> > I am quite used with standard Orocos scripts, and I would like to migrate my
>> > FSMs to rFSMs.
>> >
>> > - there is nothing in the docs about "from orocos scripting to lua
>> > scripting"; is there any example available? for quite complex, hierarchical
>> > FSMs?
>>
>> To have done this some time ago, it is not really hard. Just read the
>> doc (and some lua before if you don't know it, as it was my case)
>> http://people.mech.kuleuven.be/~mklotzbucher/rfsm/README.html
>>
>> It should be really straigth forward as you have
>> entry/run/exit/transition actions in both (it's more in the FSM side
>> than in the implementation side).
>>
>> If you need to interact with other Orocos component, then I think
>> you'll need to be familiar with this :
>> http://www.orocos.org/wiki/orocos/toolchain/luacookbook
>>
>> I think you'll bump more into lua synthax than in FSM translation problems.
>>
>> I wonder if a code translator is not possible beetwen Orocos scripts
>> and rFSM ...
>
> Syntaxwise it shouldn't be too hard, but there are also semantic
> differences. As an example, the action execution of a transition from
> State A to B with Orocos fsm is
>
>  effect() ->  exit(A) -> enter(B)
>
> while rFSM (as UML and Statecharts) do
>
>  exit(A) -> effect -> enter(B)
>
> So it really requires some human thinking to ensure it is still
> correct!
>

hum, this is a first candidate for "from orocos scripting to lua"

> Markus
>
>