Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tutorials #21

Merged
merged 9 commits into from
Aug 14, 2024
Merged

Improve tutorials #21

merged 9 commits into from
Aug 14, 2024

Conversation

MarcoLm993
Copy link
Collaborator

No description provided.

Signed-off-by: Marco Lampacrescia <[email protected]>
@MarcoLm993 MarcoLm993 requested a review from ct2034 August 13, 2024 09:48
Signed-off-by: Marco Lampacrescia <[email protected]>
Signed-off-by: Marco Lampacrescia <[email protected]>
Signed-off-by: Marco Lampacrescia <[email protected]>
</state>
</scxml>

In this example, the SCXML model consists of three states, `s0`, `s1`, and `s2`, and three transitions, `e1`, `e2` and `e3`, that transition each state to the next one.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In this example, the SCXML model consists of three states, `s0`, `s1`, and `s2`, and three transitions, `e1`, `e2` and `e3`, that transition each state to the next one.
In this example, the SCXML model consists of three states, `s0`, `s1`, and `s2`, and three transitions, these transitions are triggered by the event `e1`, `e2` and `e3` respectively.


The events are expected to be sent by another scxml model, similarly to how it is done in the `s2` state.

In order to make it more appealing to robotics developers, we have extended the default SCXML language with some ROS and BT specific features.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to make it more appealing to robotics developers, we have extended the default SCXML language with some ROS and BT specific features.
In order to fit the techstack of typical robotics developers, we have extended the default SCXML language to support ROS specific features and behavior trees.


In AS2FM, we extended the SCXML language with some additional functionalities, to support the following ROS specific features:

* :ref:`ROS Timers <ros_timers>`: to schedule events at a specific rate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* :ref:`ROS Timers <ros_timers>`: to schedule events at a specific rate
* :ref:`ROS Timers <ros_timers>`: to trigger transitions at a specific rate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, this would be fine. But since events are a concept in SCXML already, this could be misleading.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but transitions are an SCXML concept, too! Will rework it a little

* :ref:`ROS Services <ros_services>`: to call a ROS service and implement service servers
* :ref:`ROS Actions <ros_actions>`: to call a ROS action and implement action servers (under development)

All functionalities require the interface to be declared before being used, similarly to variables in the SCXML datamodel.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
All functionalities require the interface to be declared before being used, similarly to variables in the SCXML datamodel.
All functionalities require the interface to be declared before being used, similarly to variables in the SCXML datamodel.
And similar to how ROS requires these interfaces to be declared in a node.

ROS Timers
___________

ROS Timers are used to schedule events at a specific rate. They can be declared as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ROS Timers are used to schedule events at a specific rate. They can be declared as follows:
ROS Timers are used to trigger transitions at a specific rate. They can be declared as follows:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are called Drainer ..

Comment on lines 38 to 41
* a **battery_drainer**, that at each time step drains the battery by 1%, and each time the charge trigger is received, it recharges the battery to 100%.
* a **battery_manager**, that at each time the battery level is received checks if it is below 30% and, if so, triggers the alarm.

The **behavior tree** continuously checks the alarm topic and, once it is triggered, sends a charge trigger to the battery_drainer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* a **battery_drainer**, that at each time step drains the battery by 1%, and each time the charge trigger is received, it recharges the battery to 100%.
* a **battery_manager**, that at each time the battery level is received checks if it is below 30% and, if so, triggers the alarm.
The **behavior tree** continuously checks the alarm topic and, once it is triggered, sends a charge trigger to the battery_drainer.
* a **Battery Drainer**, that at each time step drains the battery by 1%, and each time the charge trigger is received, it recharges the battery to 100%.
* a **Battery Manager**, that at each time the battery level is received checks if it is below 30% and, if so, triggers the alarm.
The **Behavior Tree** continuously checks the alarm topic and, once it is triggered, sends a charge trigger to the battery_drainer.


The JANI property given in `battery_depleted.jani <https://github.com/convince-project/as2fm/tree/main/jani_generator/test/_test_data/ros_example/battery_depleted.jani>`_ defines the property of interest to be model checked. In this case, it calculates the minimal probability that the battery level is below or equal to zero eventually, i.e., all we verify here is that the battery is empty at some point.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we also provide a bt, it would make more sense to use the version where the battery is also charged and verify that it never runs out. I think this would make a bit more sense. Otherwise, people could get hung up on the point that the bt is useless.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but we do not have that property implemented yet. We only have the emtpy, belowe 20% and alarm on.
I can implement one more property for the battery to get charged after a minimum amount of time

.. code-block:: bash

scxml_to_jani path_to_main.xml
In the `main.xml file <https://github.com/convince-project/as2fm/tree/main/jani_generator/test/_test_data/ros_example/main.xml>`_ introduced earlier, the maximum run time of the system is specified with ``max_time`` and shared across the components. To make sure that the model checked property makes sense, the allowed runtime needs to be high enough to have enough time to deplete the battery, i.e., in this example the maximal time needs to be at least 100s because the battery is depleted by 1% per second.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe an aspect that goes a little too deep for a first tutorial. I mean we probably need a how-to for properties at some point anyway. Maybe we can mention this there? But just an idea. We can also keep it here for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can keep it as is, and point to some other reference in the how to for further info?


.. _jani_conversion:

How to convert from CONVINCE robotic JANI to plain JANI?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah .. maybe we can add a note that this is not really needed right now and completely independent of the ROS stuff

Signed-off-by: Marco Lampacrescia <[email protected]>
@ct2034 ct2034 merged commit bec6b2e into main Aug 14, 2024
8 checks passed
@ct2034 ct2034 deleted the improve-tutorials branch August 14, 2024 12:56
ct2034 pushed a commit that referenced this pull request Sep 25, 2024
Signed-off-by: Marco Lampacrescia <[email protected]>
Signed-off-by: Christian Henkel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants