[WIP] Implementing a contraint to keep frames aligned#1042
[WIP] Implementing a contraint to keep frames aligned#1042p-shg wants to merge 16 commits intopyomeca:masterfrom
Conversation
Constraint implementation seems sound and first dummy example seems to work TODO make dummy example to verify that torques and forces can be transferred
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1042 +/- ##
==========================================
- Coverage 77.15% 76.76% -0.40%
==========================================
Files 193 193
Lines 21019 21137 +118
==========================================
+ Hits 16218 16225 +7
- Misses 4801 4912 +111
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WIP on main constraint example
…Lagrange multiplier
…t' into FrameAlignementHolonomicConstraint
pariterre
left a comment
There was a problem hiding this comment.
@pariterre reviewed 14 files and all commit messages, and made 11 comments.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @p-shg).
bioptim/examples/toy_examples/holonomic_constraints/frame_alignment_lagrange_2d.py line 266 at r1 (raw file):
if __name__ == "__main__": main()
Please add this example to the GUI (bioptim/examples/main.py) and to the test folder
bioptim/examples/toy_examples/holonomic_constraints/test_frame_alignment_2constraints.py line 215 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
bioptim/examples/toy_examples/holonomic_constraints/test_frame_alignment_lagrange_2d copy.py line 269 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
Remove the "copy" in the file name and if it is just a copy of another file, please remove
bioptim/examples/toy_examples/holonomic_constraints/test_translation_laplace_1d.py line 195 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
bioptim/examples/toy_examples/holonomic_constraints/test_frame_alignment_constraint.py line 271 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
bioptim/models/biorbd/holonomic_biorbd_model.py line 497 at r1 (raw file):
# return -partitioned_constraints_jacobian_v_inv @ self._holonomic_constraints_jacobian_time_derivative_finite_difference(q, qdot) @ qdot # return -partitioned_constraints_jacobian_v_inv @ self._holonomic_constraints_jacobian_time_derivative(q, qdot) @ qdot return -partitioned_constraints_jacobian_v_inv @ self.holonomic_constraints_double_derivative(q, qdot, MX())
When the right code is confirmed, please remove these comments
bioptim/models/protocols/holonomic_constraints.py line 120 at r1 (raw file):
# Jdot_rows.append(Jdot_row.T) # Transposer pour obtenir (1, 5) # # Jdot = vertcat(*Jdot_rows) # (2, 5)
When confirmed, please remove these comments
bioptim/models/protocols/holonomic_constraints.py line 148 at r1 (raw file):
""" Generate the holonomic constraint that forces the orientation of two frames to be identical (i.e. the relative rotation between them is the
It seems that "relative_rotation" can be something else than identity as it seems the user are allowed to send values? If so, please update the comments accordingly.
Also, for ease of use, maybe the users could be allowed to send Euler angles? (or one or the other?)
bioptim/models/protocols/holonomic_constraints.py line 195 at r1 (raw file):
# Global homogeneous matrices (4×4) of the two frames # T1_glob = model.homogeneous_matrices_in_global(segment_index=frame_1_idx)(q_sym, parameters) # shape (4,4) # T2_glob = model.homogeneous_matrices_in_global(segment_index=frame_2_idx)(q_sym, parameters) # shape (4,4)
Are these two lines docs or previous codes?
bioptim/examples/toy_examples/holonomic_constraints/two_cubes_with_corrected_dofs.py line 214 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
bioptim/examples/toy_examples/holonomic_constraints/test_frame_alignment_constraint_asobjective.py line 173 at r1 (raw file):
if __name__ == "__main__": main()
Why is this file named "test_..."? If this is a test, please move to the "tests" folder, it can be put an underused shard (5 or 6?). If this is an example, please add to the GUI (bioptim/examples/main.py) and to the test folder
Please and a "_" between "as" and "objective" in the file name
Constraint implementation seems sound and first dummy example seems to work TODO make dummy example to verify that torques and forces can be transferred
All Submissions:
New Feature Submissions:
black . -l120 --exclude "external/*")?Changes to Core Features:
Constraint formulation is implemented and seems to work ok. @Ipuch please have a look and see if this makes sense
First example implemented, constraint seems to be applied
TODO: Implement an example where forces and torques need to be transferred through the holonomic constraint to verify that it works
TODO add tests for both those examples
This change is