Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add residual torque to TORQUE_ACTIVATIONS_DRIVEN function #623

Merged
merged 21 commits into from
Mar 2, 2023

Conversation

AnaisFarr
Copy link
Contributor

@AnaisFarr AnaisFarr commented Feb 22, 2023

All Submissions:

  • Have you followed the guidelines in our Contributing document [docs/contribution.md]?
  • Have you checked to ensure there aren't other open [Pull Requests] for the same update/change?
  • Have you opened/linked the issue related to your pull request?
  • Have you used the tag [WIP] for on-going changes, and removed it when the pull request was ready?
  • When ready to merge, have you sent a comment pinging @pariterre in it?

New Feature Submissions:

  1. Does your submission pass the tests (if not please explain why this is intended)?
  2. Did you write a proper documentation (docstrings and ReadMe)
  3. Have you linted your code locally prior to submission (using the command: black . -l120 --exclude "external/*")?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new examples for your core changes, as applicable?
  • Have you written new tests for your core changes, as applicable?

This change is Reviewable

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 19 of 19 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @AnaisFarr)


bioptim/dynamics/configure_problem.py line 1233 at r1 (raw file):

        name = "residual_tau"
        name_residual_tau = ConfigureProblem._get_kinematics_based_names(nlp, name)
        ConfigureProblem._adjust_mapping(name, ["qdot", "taudot"], nlp)  ### @pariterre???

I agree

Code quote:

### @pariterre???

bioptim/dynamics/dynamics_functions.py line 270 at r1 (raw file):

            tau_residual = DynamicsFunctions.get(nlp.controls["residual_tau"], controls)
        tau = nlp.model.torque(tau_activation, q, qdot)
        tau = tau + tau_residual if with_residual_torque else tau

Please add the ():
(tau + tau_residual) if with_residual_torque else tau

Code quote:

tau + tau_residual if with_residual_torque else tau

bioptim/dynamics/dynamics_functions.py line 271 at r1 (raw file):

        tau = nlp.model.torque(tau_activation, q, qdot)
        tau = tau + tau_residual if with_residual_torque else tau
        tau = tau + nlp.model.passive_joint_torque(q, qdot) if with_passive_torque else tau

Add the () here too, just to make sure


bioptim/examples/torque_driven_ocp/residual_torque_actuator.py line 2 at r1 (raw file):

"""
This is an example of the use of torque actuator using a model of 2 segments and 2 degrees of freedom

torque_activation_driven.py ?

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please black with -l120 (and not the default -l80)

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @AnaisFarr)

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 14 of 14 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @AnaisFarr)


bioptim/examples/torque_driven_ocp/residual_torque_actuator.py line 2 at r1 (raw file):

Previously, pariterre (Pariterre) wrote…

torque_activation_driven.py ?

Please change this file name


bioptim/examples/torque_driven_ocp/residual_torque_actuator.py line 121 at r2 (raw file):

    sol.print_cost()
    print(sol.states)
    print(sol.controls)

Do not add these prints

Code quote:

    print(sol.states)
    print(sol.controls)

@codecov
Copy link

codecov bot commented Feb 27, 2023

Codecov Report

Patch coverage: 84.37% and project coverage change: +0.01 🎉

Comparison is base (91ace20) 81.67% compared to head (55da867) 81.69%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #623      +/-   ##
==========================================
+ Coverage   81.67%   81.69%   +0.01%     
==========================================
  Files         106      107       +1     
  Lines       11805    11849      +44     
==========================================
+ Hits         9642     9680      +38     
- Misses       2163     2169       +6     
Impacted Files Coverage Δ
...act/contact_forces_inequality_constraint_muscle.py 13.46% <0.00%> (ø)
...ith_contact/muscle_activations_contacts_tracker.py 22.44% <0.00%> (ø)
...es/muscle_driven_ocp/muscle_activations_tracker.py 76.14% <50.00%> (ø)
...ples/torque_driven_ocp/torque_activation_driven.py 81.81% <81.81%> (ø)
bioptim/dynamics/configure_problem.py 91.15% <100.00%> (+0.17%) ⬆️
bioptim/dynamics/dynamics_functions.py 94.38% <100.00%> (+0.06%) ⬆️
bioptim/examples/acados/static_arm.py 42.85% <100.00%> (ø)
...ioptim/examples/fatigue/static_arm_with_fatigue.py 67.85% <100.00%> (ø)
...xamples/getting_started/example_external_forces.py 87.87% <100.00%> (ø)
...es/muscle_driven_ocp/muscle_excitations_tracker.py 73.63% <100.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@AnaisFarr AnaisFarr changed the title [WIP] Add residual torque to TORQUE_ACTIVATION_DRIVEN function Add residual torque to TORQUE_ACTIVATION_DRIVEN function Mar 1, 2023
@AnaisFarr AnaisFarr changed the title Add residual torque to TORQUE_ACTIVATION_DRIVEN function Add residual torque to TORQUE_ACTIVATIONS_DRIVEN function Mar 1, 2023
@AnaisFarr
Copy link
Contributor Author

Ready to merge @pariterre

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @EveCharbie)

Copy link
Member

@pariterre pariterre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @EveCharbie)

@pariterre pariterre merged commit e4462cc into pyomeca:master Mar 2, 2023
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.

None yet

3 participants