-
Notifications
You must be signed in to change notification settings - Fork 47
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
Removing mx_reduced by creating "biorbd wrapper" #881
Conversation
@pariterre @Ipuch This is what I was thinking about for the "biorbd wrapper". |
I would advocate for a supplementary interface (BiorbdModelToCasadiFunc ?) to biorbd. An entire class that does this for every function called by biorbd so we don't have to change the current class BiorbdModel, BiorbdMultiModel, Holonomic etc ... Also, every function of the models that do not through a MX, absolutely need to be fixed. I'm thinking about rotation matrices that are still objects of biorbd for example. Good Job ! |
There was a problem hiding this 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 r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @EveCharbie)
bioptim/models/biorbd/biorbd_model.py
line 212 at r1 (raw file):
def reshape_qdot(self, k_stab=1) -> MX: q_mx_reduced = MX.sym("q_mx_reduced", self.nb_q, 1)
If we go this route, which I actually like, all MX should be removed from bioptim altogether (not 100% sure it works). It would be the responsability of the BioModel to keep track (if needed) of extra symbolic MX!
bioptim/models/biorbd/biorbd_model.py
line 357 at r1 (raw file):
q_mx_reduced = MX.sym("q_mx_reduced", self.nb_q, 1) qdot_mx_reduced = MX.sym("qdot_mx_reduced", self.nb_qdot, 1) tau_mx_reduced = MX.sym("tau_mx_reduced", self.nb_tau, 1)
Same here, it would be the dynamic responsability to declare MX.sym (if for instance they can't use SX, and return something which is dependent on .cx
bioptim/optimization/optimization_variable.py
line 565 at r1 (raw file):
@property def mx(self): return self.unscaled.mx
This would therefore rendered useless, which would GREATLY simplify bioptim (as only .cx would be useful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 of 5 files reviewed, 3 unresolved discussions (waiting on @pariterre)
bioptim/models/biorbd/biorbd_model.py
line 212 at r1 (raw file):
Previously, pariterre (Pariterre) wrote…
If we go this route, which I actually like, all MX should be removed from bioptim altogether (not 100% sure it works). It would be the responsability of the BioModel to keep track (if needed) of extra symbolic MX!
Done.
bioptim/models/biorbd/biorbd_model.py
line 357 at r1 (raw file):
Previously, pariterre (Pariterre) wrote…
Same here, it would be the dynamic responsability to declare MX.sym (if for instance they can't use SX, and return something which is dependent on .cx
Done.
bioptim/optimization/optimization_variable.py
line 565 at r1 (raw file):
Previously, pariterre (Pariterre) wrote…
This would therefore rendered useless, which would GREATLY simplify bioptim (as only .cx would be useful)
Done.
hell yeah !
clean
docs: variational model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 9 of 12 files at r9, 24 of 24 files at r10, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @EveCharbie and @Ipuch)
bioptim/examples/torque_driven_ocp/spring_load.py
line 151 at r10 (raw file):
stiffness = 100 tau += -sign(q[0]) * stiffness * q[0] # damping
-=
bioptim/dynamics/configure_problem.py
line 1968 at r10 (raw file):
phase_dynamics: PhaseDynamics = PhaseDynamics.SHARED_DURING_THE_PHASE, numerical_data_timeseries: dict[str, np.ndarray] = None, # external_forces: ExternalForceSetTimeSeries = None,
To be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r11, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Ipuch)
This change is