Skip to content

Accept a stacked (N, r, c) ndarray as a sequence of poses (SE3, SO3, SE2, SO2) - #243

Open
RoboX2020 wants to merge 3 commits into
rai-opensource:masterfrom
RoboX2020:prajval/feat/se3-ndarray-sequence
Open

RoboX2020 wants to merge 3 commits into
rai-opensource:masterfrom
RoboX2020:prajval/feat/se3-ndarray-sequence

Conversation

@RoboX2020

Copy link
Copy Markdown

Closes #236.

SE3(arr) with an (N, 4, 4) array raised "bad argument to constructor", and with check=False it returned a malformed object (length 1, but .A of shape (N, 4, 4)).

Changes:

  • BasePoseList.arghandler: an ndarray with shape (N, r, c), where (r, c) is the shape of one value of the class, is now taken as N values, the same as SE3(list(arr)). Each matrix still goes through the class's validity check when check=True. This covers the matrix classes SE3, SO3, SE2 and SO2.
  • With check=False, an array of the wrong shape is now rejected instead of silently stored. Only the value checks are skipped.
  • The SE3 error message now lists the accepted forms, and the constructor docstring documents the new form.

Test: test_constructor_stacked_array covers SE3 and SO3 from a stacked array with both check values, the empty (0, 4, 4) case, rejection of invalid matrices with check=True and of a wrong-sized stack with either value. It fails on master and passes with this change.

Run locally (Python 3.11): pytest tests gives 348 passed, 3 skipped. black 23.10.0 is clean. Not run: the docs build and other Python versions.

Added support for stacked numpy arrays in baseposelist.py.
… error

Added support for SE3 constructor with (N, 4, 4) NumPy array.
Add unit test for SE3 constructor with stacked array input.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: SE3 constructor should accept an (N, 4, 4) ndarray as N poses

1 participant