-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor floorplan grammar #17
Conversation
1fda262
to
a399203
Compare
This uses the variation template to generate a new floorplan model
This also refactors the v1->v2 template to use a base fpm template
This commit also: - Add example of manually specified model for v2 - Updates the variation model to use the floorplan v2 model
a399203
to
8626cd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, I just have some minor comments and questions, but nothing critical.
self.frame = Frame(self, self.name) | ||
|
||
|
||
class Feature(FeatureSemantics): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the distinction between *Semantics
and *
classes described somewhere? At least for me, it's not obvious from just reading the code. Maybe something like a class diagram would be helpful if it can be generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps not in sufficient detail or explicitly, I briefly talk about the design decisions in docs/v2-motivation.md
. It's just a distinction between the language syntax and the static semantics of the concepts
self.translation = translation | ||
self.of = of | ||
self.wrt = wrt | ||
self.name = "position-{}-wrt-{}".format(of.name, wrt.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you want to override the built-in __str__
method for this using class variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because textx instantiates some of the classes dynamically, overriding str creates issues at times. I tried it for a few classes, and it wasn't worth the trouble.
|
||
# TODO move this elsewhere | ||
def to_deg(self): | ||
if self.unit == "deg": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Python enum
would be cleaner for this? Unless it's already defined in numpy
or some library already in use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inheritance with the textx dynamic instantiation was a little tricky. enum might work, but I'd rather leave it as is for now since we don't have that many constants.
class VariableReference: | ||
def __init__(self, parent, var_neg, variable) -> None: | ||
self.parent = parent | ||
self.var_neg = var_neg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does negative mean in this context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the sign of the value assignment (whether a minus sign is present or not), e.g. room.width = - default_width
Most of the changes are documented in
docs/v2-motivation.md
. As a very short summary, not exhaustive and in no particular order:exce_floorplan
tofloorplan_dsl
v2
by concern: semantics, validation and scoping have their own modules.v1
is still included in this repository until it can be fully deprecated (e.g. Refactor the 3D mesh and occupancy grid generation #11 has also been closed).v1
models tov2
using Jinja templatestextx generate models/examples/hbrs.floorplan --target floorplan-v2 -o models/examples --overwrite
v2
coordinates.json
to follow the schema in the kinova modelsdocs
folder to allow GH pages to see and use them.coordinates.json
to use the appropriate QUDT units (i.e.DEG
instead ofdegrees
)Note that the blender export won't work any more (it is untested) but will be removed soon from this repository (see #11 )