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

Two visualizers #18

Merged
merged 36 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
042df8b
a visualizer
ct2034 Aug 6, 2024
9877a65
names in quotes
ct2034 Aug 7, 2024
c86f54e
sanitizing names for ids
ct2034 Aug 7, 2024
6541f3d
img output
ct2034 Aug 7, 2024
538f567
Adding the usual Linters (#8)
ct2034 Aug 7, 2024
1b20bf9
Improve docs (#20)
MarcoLm993 Aug 12, 2024
9085a75
Improve tutorials (#21)
MarcoLm993 Aug 14, 2024
6613f6c
Install our packages for automatic API docs to work (#22)
ct2034 Aug 14, 2024
db253aa
Update pip (#24)
ct2034 Aug 15, 2024
3a2860e
Install bt_tools in deploy, too (#25)
MarcoLm993 Aug 15, 2024
3fd0078
trying more linters (#19)
ct2034 Aug 15, 2024
d92228d
Prepare features before integration week (#26)
MarcoLm993 Sep 5, 2024
5802070
fixes in docu
MKlauck Sep 13, 2024
ef11c56
minor fix
MKlauck Sep 13, 2024
fbbc3f6
Handle more complex expressions and add missing ROS actions functiona…
MarcoLm993 Sep 20, 2024
0ad060c
moving to own folder
ct2034 Sep 24, 2024
19285ff
a bitmap-based trace visualizer
ct2034 Sep 24, 2024
fdbe4de
adding text
ct2034 Sep 25, 2024
fd92367
colors and tests
Sep 25, 2024
4f669f4
Merge branch 'main' into add/visualizer
ct2034 Sep 25, 2024
e829033
correct dependencies
ct2034 Sep 25, 2024
ee094a1
missing logic in main
ct2034 Sep 25, 2024
382d6b8
CI!!
ct2034 Sep 25, 2024
ab6f0ea
Merge branch 'main' into add/visualizer
ct2034 Sep 25, 2024
1c6ce5f
fixing ci
ct2034 Sep 25, 2024
e0c3a44
not needed
ct2034 Sep 25, 2024
a570ee9
not needed either
ct2034 Sep 25, 2024
655bfae
full path
ct2034 Sep 25, 2024
48a061e
installing fonts
ct2034 Sep 25, 2024
b259491
Downgrade numpy
ct2034 Sep 25, 2024
eadb2db
networkx?!
ct2034 Sep 25, 2024
e378ef3
the version of nx i amusing
ct2034 Sep 25, 2024
85140d6
defining pip version
ct2034 Sep 26, 2024
dfdd9de
renaming jani/plantuml binary
ct2034 Sep 26, 2024
2d62777
actions in labels
ct2034 Sep 26, 2024
3136422
testing for jani visualizer
ct2034 Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
img output
Signed-off-by: Christian Henkel <christian.henkel2@de.bosch.com>
ct2034 committed Sep 25, 2024
commit 6541f3dcab1027737367631714590739e3970022
5 changes: 4 additions & 1 deletion jani_visualizer/pyproject.toml
Original file line number Diff line number Diff line change
@@ -16,7 +16,10 @@ classifiers = [
"Programming Language :: Python :: 3.10",
]
keywords = []
dependencies = []
dependencies = [
"webcolors",
"plantuml",
]

requires-python = ">=3.7"

23 changes: 17 additions & 6 deletions jani_visualizer/src/jani_visualizer/main.py
Original file line number Diff line number Diff line change
@@ -18,14 +18,16 @@
import argparse
import os
import json
import plantuml

from jani_visualizer.visualizer import PlantUMLAutomata

def main_to_plantuml():
parser = argparse.ArgumentParser(
description='Converts a `*.jani` file to a `*.plantuml` file.')
parser.add_argument('input_fname', type=str, help='The input jani file.')
parser.add_argument('output_fname', type=str, help='The output plantuml file.')
parser.add_argument('output_plantuml_fname', type=str, help='The output plantuml file.')
parser.add_argument('output_svg_fname', type=str, help='The output svg file.')
parser.add_argument('--no-syncs', action='store_true',
help='Don\'t connects transitions that are synchronized.')
parser.add_argument('--no-assignments', action='store_true',
@@ -41,13 +43,22 @@ def main_to_plantuml():
except json.JSONDecodeError as e:
raise ValueError(f"Error while reading the input file {args.input_fname}") from e

assert not os.path.isfile(args.output_fname), \
f"File {args.output_fname} must not exist."
assert not os.path.isfile(args.output_plantuml_fname), \
f"File {args.output_plantuml_fname} must not exist."

assert not os.path.isfile(args.output_svg_fname), \
f"File {args.output_svg_fname} must not exist."

pua = PlantUMLAutomata(jani_dict)
with open(args.output_fname, 'w') as f:
f.write(pua.to_plantuml(
puml_str = pua.to_plantuml(
with_assignments=not args.no_assignments,
with_guards=not args.no_guard,
with_syncs=not args.no_syncs
))
)
with open(args.output_plantuml_fname, 'w') as f:
f.write(puml_str)

plantuml.PlantUML('http://www.plantuml.com/plantuml/img/').processes_file(
args.output_plantuml_fname, outfile=args.output_svg_fname)
url = plantuml.PlantUML('http://www.plantuml.com/plantuml/img/').get_url(puml_str)
print(f"{url=}")
1 change: 1 addition & 0 deletions jani_visualizer/src/jani_visualizer/visualizer.py
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ def to_plantuml(self,
colors_per_action = self._preprocess_syncs()

puml: str = "@startuml\n"
puml += "scale 500 width\n"

for automaton in self.jani_automata:
# add a box for the automaton