Closed RussTedrake closed 6 months ago
cc @wernerpe
Let me make sure I understand the call to action: we should be sure to escape any special HTML characters when inserting the system.get_name()
and type(system)
strings into the Graphviz output. Is that right?
According to here, that just means <
and >
and &
need escaping.
The relevant code is here: https://github.com/RobotLocomotion/drake/blob/199717d89dccca3848718b185e258378ec4a92a8/systems/framework/system_base.cc#L80-L90
I suppose we might as well escape the port names as well: https://github.com/RobotLocomotion/drake/blob/199717d89dccca3848718b185e258378ec4a92a8/systems/framework/system_base.cc#L226
Yes. I think that's the most robust solution. Thanks.
What happened?
I just spend an embarassing amount of time debugging an obscure error on the autograder (which was initially hard to reproduce locally). I suspect it is due to #20204.
Long story short, running
python3 cleaned_notebook.py
works fine. Runningpython3 -c "from runpy import run_path; run_path('cleaned_notebook.py')"
causesdot
to fail withUnknown HTML element <run_path>
.Running from the command line, the name in the diagram given the systems defined immediately in the py file is e.g.
<B>__main__.InnerController</B><BR/>
. But running through run_path, then naming scheme produces illegal dot output<B><run_path>.InnerController</B><BR/>
We should not allow GetGraphvizString to emit illegal graphviz.
Here are the contents of
cleaned_notebook.py
Version
No response
What operating system are you using?
Ubuntu 22.04
What installation option are you using?
pip install drake
Relevant log output
No response