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

Needed to merge the two PRs here #867

Merged
merged 127 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 121 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
90f7415
calcule numerical cov
mickaelbegon Jan 28, 2024
bd5e6a0
numerical cov is still to small
mickaelbegon Jan 28, 2024
89b02a3
start working on rockit example
mickaelbegon Jan 28, 2024
56b3919
Fix: constaints wrt time in rockit example
mickaelbegon Jan 28, 2024
c2c0e70
continue fixing rockit example
mickaelbegon Jan 28, 2024
6ffc4ed
VALID: sOCP pour mass_point_model - rockit still not working
mickaelbegon Jan 29, 2024
9fdd043
tried to understand
EveCharbie Jan 29, 2024
101488b
back to original code from MICK
EveCharbie Jan 29, 2024
b6c8546
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Feb 23, 2024
da37821
naninf_option
EveCharbie Feb 23, 2024
5fbb947
added stochastic plots
EveCharbie Feb 24, 2024
7210c25
first draft of noisy_integrate
EveCharbie Feb 26, 2024
81a3301
removed double noise on controls
EveCharbie Feb 26, 2024
6bae186
Think noisy_integrate is ok
EveCharbie Feb 26, 2024
6250b4e
readded an example of how to save bioptim version
EveCharbie Feb 26, 2024
c36f3ed
Merge remote-tracking branch 'origin/gillis_noise_eve' into gillis_no…
EveCharbie Feb 26, 2024
fb403b3
noisy integrate plot bad looking
EveCharbie Feb 26, 2024
48833ef
penalty shape throwing error
EveCharbie Feb 26, 2024
6d34b65
save bioptim plots automatically
EveCharbie Feb 26, 2024
8094c62
cannot get inf_du and inf_pr from nlpsol_out :(
EveCharbie Feb 27, 2024
ade1afe
blacked
EveCharbie Feb 27, 2024
9beae22
woupsi checked at the wrong place
EveCharbie Feb 27, 2024
4a8741b
fixed the motor noise to be gaussian
EveCharbie Feb 27, 2024
9d1380f
blacked
EveCharbie Feb 27, 2024
ae7be94
I think this solution is ugly, but would work
EveCharbie Feb 28, 2024
c2d4094
Think this solution could work, but gets blocked by matplotlib
EveCharbie Feb 28, 2024
5f93f22
blacked before re diving into it
EveCharbie Mar 1, 2024
7e023ff
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 1, 2024
311d6f9
made the requested changes to the examples
EveCharbie Mar 1, 2024
9cafb7a
made small changes requested
EveCharbie Mar 4, 2024
a5fdae5
This bug was fixed weeks ago!!!!! will change test values :@
EveCharbie Mar 4, 2024
1baba96
extra_dynamics_func + nan_inf_test
EveCharbie Mar 4, 2024
58ca129
refactored noisy integrate as requested
EveCharbie Mar 4, 2024
dc3f1c4
test noisy_integrate + removed confusion dynamics_func list
EveCharbie Mar 4, 2024
1346eda
fixed the output graphs, but bug in casadi/ipopt?
EveCharbie Mar 5, 2024
1113fae
blacked
EveCharbie Mar 5, 2024
d4690f0
aesthetics on check_conditionning
EveCharbie Mar 5, 2024
170a641
refactored check_conditioning
EveCharbie Mar 5, 2024
9c9f4e8
refactored to remove code duplicates (no more phases though)
EveCharbie Mar 6, 2024
5646eb5
starts to be clean
EveCharbie Mar 7, 2024
963807a
stochastic min efforts quadratic
EveCharbie Mar 7, 2024
71aed66
moved ipopt plots to its own file
EveCharbie Mar 7, 2024
ef00670
live check conditionning seems to work (without constraints)
EveCharbie Mar 7, 2024
21277f4
socp constraints in g_internal
EveCharbie Mar 8, 2024
fe0c133
fixed some tests
EveCharbie Mar 11, 2024
15772ac
blacked
EveCharbie Mar 11, 2024
f193328
internal constraints multi-node mess up?
EveCharbie Mar 11, 2024
68e6a0e
fixed tests variationnal ocp
EveCharbie Mar 11, 2024
898dfae
blacked
EveCharbie Mar 11, 2024
d1cb5fa
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 11, 2024
afb127d
fixed some tests
EveCharbie Mar 12, 2024
82ef208
fixed some tests
EveCharbie Mar 12, 2024
c228acc
backed
EveCharbie Mar 12, 2024
c4fa5ab
woupsi
EveCharbie Mar 12, 2024
46ad363
temporary, will be reverted
EveCharbie Mar 12, 2024
02175b1
Temporarily restored the constraint pool
EveCharbie Mar 12, 2024
e5ffcec
blacked
EveCharbie Mar 12, 2024
73042bb
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 12, 2024
8b44d7f
fixed tests ?
EveCharbie Mar 13, 2024
f761aca
casadi update
EveCharbie Mar 13, 2024
84d753f
woups
EveCharbie Mar 13, 2024
ef1ec15
ipopt output plots work in real time, but are really slow!
EveCharbie Mar 15, 2024
470e76e
blacked
EveCharbie Mar 15, 2024
9622fce
more details to ipopt plots
EveCharbie Mar 15, 2024
aa1a299
IPOPT output works live on SOCP
EveCharbie Mar 15, 2024
a047e9d
removed max_g
EveCharbie Mar 15, 2024
ce3369a
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 16, 2024
18dacc1
ipopt out put small fix
EveCharbie Mar 17, 2024
3d4acbf
Merge remote-tracking branch 'origin/gillis_noise_eve' into gillis_no…
EveCharbie Mar 17, 2024
d9df0f5
other small fix ipoot_output_plot
EveCharbie Mar 18, 2024
57a7d13
blacked
EveCharbie Mar 19, 2024
11f669d
fix Kevin's merge
EveCharbie Mar 19, 2024
cb91543
made requested changes
EveCharbie Mar 20, 2024
ea89ef3
added minimal testing of the live plots
EveCharbie Mar 20, 2024
0c28767
blacked
EveCharbie Mar 20, 2024
9cbe782
just to relaunch tests
EveCharbie Mar 21, 2024
010bcd0
just to relaunch tests
EveCharbie Mar 21, 2024
b19a907
trying to fix test on Ubuntu
EveCharbie Mar 24, 2024
5ed4f6b
to restart tests
EveCharbie Mar 26, 2024
ff8c300
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 26, 2024
525fbfc
Merge remote-tracking branch 'pyomeca/master' into gillis_noise_eve
EveCharbie Mar 28, 2024
c52bbcd
external_forces are set as np.ndarrays
EveCharbie Mar 28, 2024
33a9316
I think the sym are declared correctly, next:replace num + remove m-dyn
EveCharbie Mar 28, 2024
f06d7db
k
EveCharbie Mar 28, 2024
2c1c55a
the function creation seems to work for the simplest case
EveCharbie Mar 29, 2024
de28347
example external_forces passes in RK4/RK8 :D
EveCharbie Mar 29, 2024
b2d10fa
IRK external_forces OK
EveCharbie Mar 29, 2024
5076c78
blacked
EveCharbie Mar 29, 2024
a13349b
pendulum test passes
EveCharbie Mar 29, 2024
809b18b
blacked
EveCharbie Mar 29, 2024
413682c
fixed some tests
EveCharbie Mar 29, 2024
f073c1f
blacked
EveCharbie Mar 29, 2024
9bbbf28
fixed the custom dynamics ?
EveCharbie Mar 29, 2024
b84b20c
other merging problems
EveCharbie Mar 29, 2024
5f27ca8
fixed some tests
EveCharbie Mar 29, 2024
afae924
plots working again
EveCharbie Apr 1, 2024
775990e
reverted changes on pendulum
EveCharbie Apr 1, 2024
fa1905d
fixed some tests
EveCharbie Apr 1, 2024
9f89909
blacked
EveCharbie Apr 1, 2024
29083ab
woups
EveCharbie Apr 1, 2024
21cd216
fixed some tests
EveCharbie Apr 2, 2024
f0cdf56
\
EveCharbie Apr 2, 2024
f254237
Merge branch 'test' of https://github.com/EveCharbie/BiorbdOptim into…
EveCharbie Apr 2, 2024
15ec976
stochastic tests should pass
EveCharbie Apr 2, 2024
a221af4
claened the initialization and fixed some tests
EveCharbie Apr 2, 2024
25ea32d
fixed some more tests
EveCharbie Apr 2, 2024
494e06c
still fixing tests
EveCharbie Apr 2, 2024
645144d
blacked
EveCharbie Apr 2, 2024
5d3f868
Merge remote-tracking branch 'origin/test' into test
EveCharbie Apr 2, 2024
1b2040e
getting closer
EveCharbie Apr 2, 2024
305d679
blacked
EveCharbie Apr 2, 2024
11dd1ee
fixed the last test
EveCharbie Apr 3, 2024
8b365eb
added a test for poit_of_application
EveCharbie Apr 3, 2024
467284d
changed to the new declaration format
EveCharbie Apr 3, 2024
5351e40
blacked
EveCharbie Apr 3, 2024
c02c37c
woups
EveCharbie Apr 3, 2024
452ffa3
6 -> 9
EveCharbie Apr 3, 2024
be2b3d8
made requested changes (lots of name changes)
EveCharbie Apr 5, 2024
3ccf572
blacked
EveCharbie Apr 5, 2024
b9627f9
woups
EveCharbie Apr 5, 2024
5ec1054
fixed some names
EveCharbie Apr 5, 2024
e357fd6
no attribute nlp
EveCharbie Apr 5, 2024
f1ff21d
fixing tests?
EveCharbie Apr 5, 2024
0e6631c
blacked
EveCharbie Apr 5, 2024
161ef97
removed ocp
EveCharbie Apr 5, 2024
419929a
better raise
EveCharbie Apr 5, 2024
93be904
--'
EveCharbie Apr 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1872,17 +1872,8 @@ The solver must minimize the force to lift the box while reaching the marker in
It is designed to show how to use external forces. An example of external forces that depends on the state (for
example, a spring) can be found at 'examples/torque_driven_ocp/spring_load.py'

`Bioptim` expects `external_forces` to be a list (for each shooting node) of np.ndarray [6 x n],
where the six components are [Mx, My, Mz, Fx, Fy, Fz], expressed at the origin of the global reference frame for each node n.
Let us take a look at the definition of the external forces in
this example :

```python
external_forces = [[["Seg1", (0, 0, 0, 0, 0, -2)], ["Test", (0, 0, 0, 0, 0, 5)]] for _ in range(n_shooting)]
```

`external_forces` is 30-element long, and each sub list array are composed of a string, the name of the segment, and a tuple, the external force.
The tuple is [Mx, My, Mz, Fx, Fy, Fz] for each node (in this example, we take 30 shooting nodes).
`Bioptim` expects `external_forces` to be a np.ndarray [6 x n x n_shooting], where the six components are
[Mx, My, Mz, Fx, Fy, Fz], expressed at the origin of the global reference frame for each node.

### The [example_implicit_dynamics.py](./bioptim/examples/getting_started/example_implicit_dynamics.py) file
*#TODO*
Expand Down
28 changes: 21 additions & 7 deletions bioptim/dynamics/configure_new_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def _declare_cx_and_plot(self):
)
if not self.skip_plot:
self.nlp.plot[f"{self.name}_states"] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a: (
lambda t0, phases_dt, node_idx, x, u, p, a, d: (
x[self.nlp.states.key_index(self.name), :]
if x.any()
else np.ndarray((cx[0][0].shape[0], 1)) * np.nan
Expand Down Expand Up @@ -455,7 +455,7 @@ def _declare_cx_and_plot(self):
plot_type = PlotType.PLOT if self.nlp.control_type == ControlType.LINEAR_CONTINUOUS else PlotType.STEP
if not self.skip_plot:
self.nlp.plot[f"{self.name}_controls"] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a: (
lambda t0, phases_dt, node_idx, x, u, p, a, d: (
u[self.nlp.controls.key_index(self.name), :]
if u.any()
else np.ndarray((cx[0][0].shape[0], 1)) * np.nan
Expand Down Expand Up @@ -518,6 +518,20 @@ def _declare_cx_and_plot(self):
self.nlp.variable_mappings[self.name],
node_index,
)
if not self.skip_plot:
all_variables_in_one_subplot = True if self.name in ["m", "cov", "k"] else False
self.nlp.plot[f"{self.name}_algebraic"] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a, d: (
a[self.nlp.algebraic_states.key_index(self.name), :]
if a.any()
else np.ndarray((cx[0][0].shape[0], 1)) * np.nan
),
plot_type=PlotType.STEP,
axes_idx=self.axes_idx,
legend=self.legend,
combine_to=self.combine_name,
all_variables_in_one_subplot=all_variables_in_one_subplot,
)


def _manage_fatigue_to_new_variable(
Expand Down Expand Up @@ -577,7 +591,7 @@ def _manage_fatigue_to_new_variable(
legend = [f"{name}_{i}" for i in name_elements]
fatigue_plot_name = f"fatigue_{name}"
nlp.plot[fatigue_plot_name] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a: (
lambda t0, phases_dt, node_idx, x, u, p, a, d: (
x[:n_elements, :] if x.any() else np.ndarray((len(name_elements), 1))
)
* np.nan,
Expand All @@ -587,7 +601,7 @@ def _manage_fatigue_to_new_variable(
)
control_plot_name = f"{name}_controls" if not multi_interface and split_controls else f"{name}"
nlp.plot[control_plot_name] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a: (
lambda t0, phases_dt, node_idx, x, u, p, a, d: (
u[:n_elements, :] if u.any() else np.ndarray((len(name_elements), 1))
)
* np.nan,
Expand All @@ -607,7 +621,7 @@ def _manage_fatigue_to_new_variable(
var_names_with_suffix[-1], name_elements, ocp, nlp, as_states, as_controls, skip_plot=True
)
nlp.plot[f"{var_names_with_suffix[-1]}_controls"] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a, key: (
lambda t0, phases_dt, node_idx, x, u, p, a, d, key: (
u[nlp.controls.key_index(key), :] if u.any() else np.ndarray((len(name_elements), 1)) * np.nan
),
plot_type=PlotType.STEP,
Expand All @@ -618,7 +632,7 @@ def _manage_fatigue_to_new_variable(
elif i == 0:
NewVariableConfiguration(f"{name}", name_elements, ocp, nlp, as_states, as_controls, skip_plot=True)
nlp.plot[f"{name}_controls"] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a, key: (
lambda t0, phases_dt, node_idx, x, u, p, a, d, key: (
u[nlp.controls.key_index(key), :] if u.any() else np.ndarray((len(name_elements), 1)) * np.nan
),
plot_type=PlotType.STEP,
Expand All @@ -631,7 +645,7 @@ def _manage_fatigue_to_new_variable(
name_tp = f"{var_names_with_suffix[-1]}_{params}"
NewVariableConfiguration(name_tp, name_elements, ocp, nlp, True, False, skip_plot=True)
nlp.plot[name_tp] = CustomPlot(
lambda t0, phases_dt, node_idx, x, u, p, a, key, mod: (
lambda t0, phases_dt, node_idx, x, u, p, a, d, key, mod: (
mod * x[nlp.states.key_index(key), :] if x.any() else np.ndarray((len(name_elements), 1)) * np.nan
),
plot_type=PlotType.INTEGRATED,
Expand Down
Loading
Loading