kmarkus / rfsm Goto Github PK
View Code? Open in Web Editor NEWrFSM is a lightweight Statechart implementation in Lua
License: Other
rFSM is a lightweight Statechart implementation in Lua
License: Other
lua: ...isolated/src/orocos/orocos_toolchain/rFSM/tools/rfsm-viz:72: invalid escape sequence near '.'
when i try to run a lua deployer with rfsm-viz i get above error.
/opt/ros/indigo/lib/rfsm/rfsm-viz all -f /home/me/test.lua
returns
lua: /opt/ros/indigo/lib/rfsm/rfsm-viz:72: invalid escape sequence near '\.'
https://lua.org/manual/5.2/manual.html#8.2
Function module is deprecated. It is easy to set up a module with regular Lua code. Modules are not expected to set global variables.
The COPYING file specifies GPL3, but the READme.md says "rFSM is dual licensed under LGPL/BSD."
and the headers (at least some of them say GPL-2.
Can we get some clarity on this, and perhaps update the COPYING file.
I have a problem when running rfsm-dbg ... I seem to be missing the fsmdbg module. Can you help me?
$ head tools/rfsm-dbg
#!/usr/bin/env lua
-- -*- lua -*-
require("rfsm")
require("fsmdbg") -- THIS LINE
I'm a new user of rFSM but it seems to me that rfsm2uml.rfsm2dot()
does not handle graph with too much (>2) depth.
I've run the following code :
require "rfsm"
require "rfsm2uml"
fsm = rfsm.init(rfsm.load("test_fsm.lua") )
rfsm2uml.rfsm2dot(fsm, "test-uml.dot")
With test_fsm.lua :
return rfsm.state {
configured = rfsm.state {},
operationnal = rfsm.state {
idle = rfsm.state {},
--== Manual states ==-
joint_pos = rfsm.state {
running = rfsm.state {},
done = rfsm.state {},
--============================== Joint pos transitions ===================================
rfsm.trans {src="initial", tgt="running" },
rfsm.trans {src="running",tgt="done", events={'joint_pos.done'}},
},
--============================== Operational transitions ===================================
rfsm.trans {src="initial", tgt="idle" },
rfsm.trans {src="joint_pos",tgt="idle", events={'idle'}},
rfsm.trans {src="idle",tgt="joint_pos", events={'joint_pos'}},
},
--============================== Main transitions ===================================
rfsm.trans {src="initial", tgt="configured" },
rfsm.trans {src="configured", tgt="operationnal", events={'start'}},
rfsm.trans {src="operationnal", tgt="configured", events={'stop'}},
}
While everything is running fine when removing states & transitions inside joint_pos
state, rfsm2uml.rfsm2dot will fail with those. Even if the underlying FSM seems to be working fine.
It gives the following error while run by rttlua
:
Real-time memory: 517888 bytes free of 524288 allocated.
OROCOS RTTLua 1.0-beta5 / Lua 5.1.5 (gnulinux)
INFO: created undeclared connector root.initial
INFO: created undeclared connector root.operationnal.initial
INFO: created undeclared connector root.operationnal.joint_pos.initial
WARNING: no outgoing transitions from node 'root.operationnal.joint_pos.done'
No state 'root.operationnal.joint_pos'
/home/antoineh/orocos/foxy/bin/rttlua-gnulinux: ...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:136: assertion failed!
stack traceback:
[C]: in function 'assert'
...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:136: in function 'new_sista'
...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:250: in function 'proc_node'
...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:272: in function 'func'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:233: in function 'f'
/home/antoineh/orocos/foxy/share/lua/5.1/utils.lua:246: in function 'map'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:229: in function '__mapfsm'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:236: in function 'f'
/home/antoineh/orocos/foxy/share/lua/5.1/utils.lua:246: in function 'map'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:229: in function '__mapfsm'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:236: in function 'f'
/home/antoineh/orocos/foxy/share/lua/5.1/utils.lua:246: in function 'map'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:229: in function '__mapfsm'
...os2-integration/src/rtt_ros2_utilities/rFSM/rfsm.lua:244: in function 'mapfsm'
...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:270: in function 'fsm2gh'
...integration/src/rtt_ros2_utilities/rFSM/rfsm2uml.lua:298: in function 'rfsm2dot'
test.lua:6: in main chunk
[C]: ?
TLSF bytes allocated=524288 overhead=6400 max-used=6400 currently-used=6400 still-allocated=0
Adding an event to an 'initial' transition causes rFSM to stall, without throwing an error.
For example rfsm.trans{src="initial", tgt="stateA", events={"e_done"}}.
Especially when this transition is part of a hierachical FSM:
uplevel = rfsm.state{
stateAA=rfsm.state{},
stateBB=rfsm.state{
stateA = rfsm.state{},
rfsm.trans{src="initial", tgt="stateA", events={"e_done"}},
},
rfsm.trans{src="initial", tgt="stateAA"},
rfsm.trans{src="stateAA", tgt="stateBB", events={"e_done"}}
}
rFSM does not make the exit of the previous state (state AA), just stays in this state.
There is no hint whatsoever that it is a transition in a next sub-state that causes the error.
Especially annoying when the sub-states are in different files...
At time of writing, code coverage is ~75% of loaded code, and could be improved
File Hits Missed Coverage
-------------------------------------------------------
../ansicolors.lua 41 0 100.00%
../examples/composite_exitconn.lua 13 0 100.00%
../examples/composite_nested.lua 28 0 100.00%
../examples/connector_simple.lua 8 0 100.00%
../examples/connector_split.lua 18 0 100.00%
../examples/simple_doo_idle.lua 10 0 100.00%
../rfsm.lua 460 116 79.86%
../rfsm2tree.lua 16 54 22.86%
../rfsm2uml.lua 132 19 87.42%
../rfsm_testing.lua 56 13 81.16%
../rfsmpp.lua 31 38 44.93%
../utils.lua 105 121 46.46%
fsmtest_composite_nested.lua 31 5 86.11%
fsmtest_exitconn.lua 23 1 95.83%
fsmtest_simple_conn.lua 34 2 94.44%
fsmtest_simple_conn_with_split.lua 26 2 92.86%
fsmtest_simple_idle_doo.lua 33 0 100.00%
-------------------------------------------------------
Total 1065 371 74.16%
cat luacov.report.out | egrep 0.00 | egrep -v 100.00
../examples/await.lua 0 21 0.00%
../examples/ball_tracker.lua 0 12 0.00%
../examples/ball_tracker_scope.lua 0 11 0.00%
../examples/connector_cycles.lua 0 5 0.00%
../examples/connector_cycles2.lua 0 10 0.00%
../examples/emem_test.lua 0 27 0.00%
../examples/extension/base_fsm.lua 0 5 0.00%
../examples/extension/base_fsm_extended.lua 0 7 0.00%
../examples/hello_world.lua 0 4 0.00%
../examples/introductory.lua 0 22 0.00%
../examples/monitor_state.lua 0 14 0.00%
../examples/nested_fsm/launch.lua 0 5 0.00%
../examples/nested_fsm/root.lua 0 3 0.00%
../examples/nested_fsm/subfsm.lua 0 6 0.00%
../examples/ping-pong.lua 0 11 0.00%
../examples/preview_example.lua 0 15 0.00%
../examples/preview_example2.lua 0 21 0.00%
../examples/relative_trans.lua 0 7 0.00%
../examples/runscript.lua 0 6 0.00%
../examples/seqand.lua 0 19 0.00%
../examples/simple.lua 0 4 0.00%
../examples/simple_idle_doo.lua 0 12 0.00%
../examples/timeevent.lua 0 18 0.00%
../examples/total_failure.lua 0 5 0.00%
../rfsm2json.lua 0 27 0.00%
../rfsm_await.lua 0 44 0.00%
../rfsm_checkevents.lua 0 17 0.00%
../rfsm_emem.lua 0 25 0.00%
../rfsm_ext.lua 0 77 0.00%
../rfsm_marsh.lua 0 36 0.00%
../rfsm_preview.lua 0 25 0.00%
../rfsm_proto.lua 0 84 0.00%
../rfsm_rtt.lua 0 117 0.00%
../rfsm_timeevent.lua 0 51 0.00%
../tests/fsmdbg_simple.lua 0 10 0.00%
../tests/fsmtest_composite_nested.lua 0 20 0.00%
../tests/fsmtest_exitconn.lua 0 14 0.00%
../tests/fsmtest_simple_conn.lua 0 20 0.00%
../tests/fsmtest_simple_conn_with_split.lua 0 17 0.00%
../tests/fsmtest_simple_idle_doo.lua 0 16 0.00%
../time.lua 0 51 0.00%
../tools/rfsm-sim.lua 0 80 0.00%
fsmdbg_simple.lua 0 10 0.00%
with luarocks, install luacov
rFSM$ luarocks --lua-version 5.2 install luacov --local
rFSM$ cd tests
rFSM/tests$ cat <<EOF > .luacov
includeuntestedfiles = { '.', '..' }
EOF
consider using the unit test wrapper script from #25
otherwise the syntax is similar to:
rFSM/tests$ eval "$(luarocks --lua-version 5.2 path --bin)"
rFSM/tests$ lua5.2 -lluacov <testname.lua>
rFSM/tests$ luacov
Support for Lua 5.4 would be very nice indeed.
5.1 is rather old now?
I am wondering if there is any modification that can be done, such that I can have two load statements in the same file but still have one instance. The design of the code is such that I need to have this same auxiliary state under two composite states.
I tried to make another implementation of rfsm.load
which uses require
, but it fails. I have made a post here that describes my problem. Any ideas and/or pointers?
https://stackoverflow.com/questions/72721508/avoid-loading-the-same-script-twice-with-rfsm-library-in-lua
https://lua.org/manual/5.2/manual.html#8.2
Function unpack was moved into the table library and therefore must be called as table.unpack
If there are several events in the queue, only the one(s) triggering the first (highest prio) transition will be considered. All other events will be dropped silently. What is the rationale behind this?
If events arrive faster than you can process them, i.e. there will be a queue with more than one element,
you will loose some of these events.
Is this intended behavior?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.