HiroIshida / yamaopt

robotic optimal sensor placement
MIT License
0 stars 1 forks source link

Catch polygon is not convex error #13

Closed 708yamaguchi closed 2 years ago

708yamaguchi commented 2 years ago

Catch is_convex assertion.

Without this PR, solver.py stopped when non-convex polygon is inputted.

Is it OK to catch AssertionError?

HiroIshida commented 2 years ago

Thanks. I think, because other assertions that check the dimension of joint angle exists in the solve function, it's maybe better to implement a custom exception such as ConcavePolygonException inside the polygon_constraint.py and catch that exception in the solver.py.

It's even better if you add a case where concave polygon is mixed in the polygon list in the test, and check if the concave polygon is properly skipped. https://github.com/HiroIshida/yamaopt/blob/6fd9d8b24cf0a179ea721ccd139b287d01ed6aca/tests/test_solver.py#L121

708yamaguchi commented 2 years ago

Thank you for your review!

I added ConcavePolygonException and test concave polygon input.

Concave polygon is successfully skipped in my laptop.

$ python example_multi.py -robot pr2
desired
[0. 0. 0.]
desired
[ 0.         -0.          1.57079633]
desired
[ 0.          0.         -1.57079633]
Input polygon is not convex. Skipped.
HiroIshida commented 2 years ago

Thanks, LGTM