Repository navigation
Conversation
TrajectoryGenerator.solve() returns the polynomial coefficients as 6x1 column vectors, so the simulated roll and pitch are 1-element arrays. AtsushiSakai#861 worked around this in rotation_matrix(), but with show_animation on Quadrotor.transformation_matrix() still passes them to math.cos/sin, and the pinned NumPy 2.5.4 raises "TypeError: only 0-dimensional arrays can be converted to Python scalars" on the first frame. Flatten the coefficients so every state is a scalar, and drop the workaround in rotation_matrix(). The simulated poses are unchanged.
This branch has not been deployed
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.
Reference issue
None, found while running the examples with the pinned requirements.
What does this implement/fix?
Running the drone example with animation on (the default) fails on the first frame with the pinned NumPy 2.5.4:
TrajectoryGenerator.solve()returns the coefficients as 6x1 column vectors, so the simulatedrollandpitchend up as 1-element arrays. #861 worked around this inrotation_matrix()withroll_array[0], butQuadrotor.transformation_matrix()still passes the arrays tomath.cos/math.sin.test1runs withshow_animation = False, so CI never reaches that code.This flattens the coefficients in
main(), so every simulated state is a scalar, and drops theroll_array[0]workaround. The simulated poses are unchanged: I compared all 409 poses before and after and they are identical.Additional information
The new test
test_poses_can_be_drawncomputestransformation_matrix()for every pose, asQuadrotor.plot()does, without opening a figure. It fails on master with theTypeErrorabove and passes with this change.Ran on Windows 11, Python 3.13 with the pinned requirements:
pytest tests/test_drone_3d_trajectory_following.py -Werror: 2 passedpython drone_3d_trajectory_following.pywith the Agg backend runs toDoneCheckList