Skip to content

Commit

Permalink
Address Christian's comments
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Lampacrescia <[email protected]>
  • Loading branch information
MarcoLm993 committed Nov 12, 2024
1 parent d77a754 commit 28aec89
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
mkdir ros_interfaces_ws
cd ros_interfaces_ws
ln -s ../ros_support_interfaces src
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# run the tests
- name: Run tests
run: |
Expand Down
10 changes: 6 additions & 4 deletions docs/source/howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -388,25 +388,27 @@ ____________

The maximum time the global clock is allowed to reach.

The tag defining it is `<max_time value="100" unit="s" />`. The `value` argument is the max time, and the argument `unit` specifies the time unit of the provided value. Supported units are `s`, `ms`, `us`, `ns`.
The tag is called `max_time`. The `value` argument is the max time, and the argument `unit` specifies the time unit of the provided value. Supported units are `s`, `ms`, `us`, `ns`.

Max Array Size
_________________

The maximum size assigned to a dynamic array.

The tag defining it is `<max_array_size value="100" />`. The `value` argument defines the max size the dynamic array can reach, and is 100 by default.
The tag is called `max_array_size`. The `value` argument defines the max size the dynamic array can reach, and is 100 by default.

BT Tick Rate
_________________

The tick rate of the Behavior Tree (in Hz).

The tag defining it is `<bt_tick_rate value="1.0">`. The `value` argument defines the tick rate in Hz, and is 1.0 by default.
The tag is called `bt_tick_rate`. The `value` argument defines the tick rate in Hz, and is 1.0 by default.

BT Tick If Not Running
_________________________

Whether we shall keep ticking a Behavior Tree after it returns something different from `RUNNING` (i.e. `SUCCESS` or `FAILURE`).

The tag defining it is `<bt_tick_if_not_running value="false" />`. The `value` argument enables / disables the ticking of non-running Behavior Trees, and is set to `false` by default. After the tree is stopped, the model execution will stop as well.
The tag is called `bt_tick_if_not_running`. The `value` argument enables or disables the ticking of non-running Behavior Trees, and is set to `false` by default. After the tree is stopped, the model execution will stop as well.

For example `<bt_tick_if_not_running value="false" />` would stop ticking the tree after it returned either _SUCCESS_ or _FAILURE_.
10 changes: 6 additions & 4 deletions src/as2fm/jani_generator/scxml_helpers/top_level_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class FullModel:
max_time: Optional[int] = None
# Max size of "dynamic" arrays defined in the SCXML models
max_array_size: int = field(default=100)
# Tick rate for the loaded BT
# Tick rate for the loaded BT in Hz
bt_tick_rate: float = field(default=1.0)
# Whether to keep ticking the BT after it returns SUCCESS / FAILURE
bt_tick_not_running: bool = field(default=False)
bt_tick_when_not_running: bool = field(default=False)
# Path to the behavior tree loaded in the model
bt: Optional[str] = None
# Paths to the SCXML models of the BT nodes used in the model
Expand Down Expand Up @@ -101,7 +101,7 @@ def parse_main_xml(xml_path: str) -> FullModel:
elif remove_namespace(mc_parameter.tag) == "bt_tick_rate":
model.bt_tick_rate = float(mc_parameter.attrib["value"])
elif remove_namespace(mc_parameter.tag) == "bt_tick_if_not_running":
model.bt_tick_not_running = bool(mc_parameter.attrib["value"])
model.bt_tick_when_not_running = bool(mc_parameter.attrib["value"])
else:
raise ValueError(
error(mc_parameter, f"Invalid mc_parameter tag: {mc_parameter.tag}")
Expand Down Expand Up @@ -165,7 +165,9 @@ def generate_plain_scxml_models_and_timers(
# Convert behavior tree and plugins to ROS-SCXML
if model.bt is not None:
ros_scxmls.extend(
bt_converter(model.bt, model.plugins, model.bt_tick_rate, model.bt_tick_not_running)
bt_converter(
model.bt, model.plugins, model.bt_tick_rate, model.bt_tick_when_not_running
)
)
# Convert the loaded entries to plain SCXML
plain_scxml_models = []
Expand Down

0 comments on commit 28aec89

Please sign in to comment.