Skip to content

Commit

Permalink
fixing inheritance issue with ActionDispatcher and StochasticController
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Kolve committed Sep 11, 2020
1 parent 8ba168f commit a5739c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ai2thor/tests/test_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ def assert_near(point1, point2, error_message=''):
for k in point1.keys():
assert round(point1[k], 3) == round(point2[k], 3), error_message

def test_stochastic_controller():
controller = UnityTestController(agentControllerType='stochastic')
controller.reset('FloorPlan28')
assert controller.last_event.metadata['lastActionSuccess']

def test_rectangle_aspect():
controller = UnityTestController(width=600, height=300)
controller.reset('FloorPlan28')
Expand Down
8 changes: 6 additions & 2 deletions unity/Assets/Scripts/ActionDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ private static MethodInfo getDispatchMethod(Type targetType, dynamic serverComma

// if the method is more specific and the parameters match
// we will dispatch to this method instead of the base type
if (hierarchy.IndexOf(mi.DeclaringType) < hierarchy.IndexOf(methods[j].DeclaringType) && signatureMatch) {
methods[j] = mi;
if (signatureMatch) {
replaced = true;
if (hierarchy.IndexOf(mi.DeclaringType) < hierarchy.IndexOf(methods[j].DeclaringType)) {
methods[j] = mi;
}
}

}
if (!replaced) {
// we sort the list of methods so that we evaluate
Expand Down

0 comments on commit a5739c7

Please sign in to comment.