Interface misuse checks - #231
Closed
maltehue wants to merge 9 commits into
Closed
Conversation
# Conflicts: # test/test_motion_statechart/test_motion_statechart.py
ichumuh
requested changes
Nov 24, 2025
| if ( | ||
| node._motion_statechart is not None | ||
| and node._motion_statechart is not self.motion_statechart | ||
| ): |
Member
There was a problem hiding this comment.
I think all of these errors are special cases of this if. I think the code gets cleaner if you first check if the backreference is None and if yes, you add the node.
if not none, but the backreference is the same as the goal, you do nothing.
then you check your special cases and since you know the node already belongs to a statechart, you don't need many of the is not None checks anymore. you might even be able to use match/case
| goal = TestGoal() | ||
| msc.add_node(goal) | ||
| with pytest.raises(InvalidSelfReferenceInStartCondition): | ||
| goal.start_condition = goal.observation_variable > 0 |
Member
There was a problem hiding this comment.
tests that the other conditions are fine
| n3 = ConstTrueNode() | ||
| msc.add_node(n1) | ||
| msc.add_node(n2) | ||
| msc.add_node(n3) |
| assert str(err.variable_name) == str(n1.life_cycle_variable.name) | ||
|
|
||
|
|
||
| def test_end_condition_requires_observation_variables(): |
| n = ConstTrueNode() | ||
|
|
||
| msc.add_node(g1) | ||
| msc.add_node(g2) |
Member
There was a problem hiding this comment.
msc.add_nodes([
g1 := TestGoal(),
g2:= TestGoal(),
])# Conflicts: # giskardpy/motion_statechart/exceptions.py # giskardpy/motion_statechart/graph_node.py # giskardpy/motion_statechart/motion_statechart.py # test/test_motion_statechart/test_motion_statechart.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR for the todo card: Implement interface misuse checks#201
One commit for each of the tasks
regarding the MotionStatechart.compile() issue i added two tests
test_compile_without_qp_controller_when_no_constraintsandtest_compile_raises_when_constraints_present_but_no_qp_configthat in my opinion test the desired behavior that was already present. Or did that issue mean something else?