Commit dfffad46 authored by Sebastien Timmermans's avatar Sebastien Timmermans 🎹

Merge branch '207-mbsyspy-seg-fault-during-close-geo-in-part' into 'dev'

Resolve "[MBsysPy] seg fault during close geo in part"

Closes #207

See merge request robotran/mbsysc!325
parents 1d970129 589fddae
......@@ -2,6 +2,8 @@
* To be defined
* **For user: Requires to generate again user files (and user file generation application)**
* [Partitionning] Option `visualize` is used to generate failed loop closing procedure (default is no generation)
* [Fix] Failing loop closing procedure was always trying to generate animation whatever was the option.
* [Python]
* **For user: update your MBsysPy project as previous indexing was starting at 0.**
* **function `MbsData.mbs_load_from_file` renamed to `MbsData.load_state`
......
......@@ -47,6 +47,9 @@ int mbs_close_geo(MbsData *s, MbsAux *mbs_aux)
if (iter >= mbs_aux->MAX_NR_ITER) // Error management
{
mbs_msg("\t \t >CLOSE GEO> Impossible to close the geometry after %d iterations \n", iter);
if (mbs_aux->close_anim) {
mbs_anim_close_geo(s, mbs_aux);
}
mbs_anim_close_geo(s, mbs_aux);
return -50;
}
......
......@@ -491,6 +491,9 @@ void mbs_run_part(MbsPart* mbs_part, MbsData* mbs_data)
}
mbs_aux = initMbsAux(mbs_data);
// Options (set by the user)
mbs_aux->close_anim = mbs_part->options->visualise;
nbiter = mbs_close_geo(mbs_data, mbs_aux); // on essaie de fermer
nbiterMax = mbs_aux->MAX_NR_ITER;
freeMbsAux(mbs_aux, mbs_data);
......
......@@ -13,7 +13,8 @@
typedef struct MbsPartOptions
{
int rowperm; //!< 1 to allow line permutation; 0 otherwise, defaut = 0
int visualise; // no = 0, yes = 1, defaut = 0
int visualise; //!< In case of loop closure failing, set to 1 to plot the
//!< closing procedure iteration, default = 0.
int drivers; // no = 0, yes = 1, defaut = 0
int verbose; //!< 1 to get print indications related partitioning module; 0 otherwise, defaut = 1
int clearmbsglobal; // inout = 1, out = 2, none = 3, all = 4, defaut = 1
......
......@@ -618,11 +618,12 @@ int mbs_fct_solvekin(MbsData *s, MbsSolvekin *sk)
}
// Computation of driven variable and independant joints
if (s->nqc && sk->trajectorytype != 2) {
if (s->nqc && sk->trajectorytype != 2 && sk->options->motion != closeloop) {
// if there is driven and if they are not defined in trajectory file
// if animating a close loop procedure: assumes q_u and q_c are already updated.
user_DrivenJoints(s, s->tsim);
}
else if (sk->trajectorytype == 2) {
else if (sk->trajectorytype == 2 && sk->options->motion != closeloop) {
// Also compute independant joint
err1 = mbs_lut_res_interp(sk->q, s->tsim, lutq);
err2 = mbs_lut_res_interp(sk->qd, s->tsim, lutqd);
......@@ -679,6 +680,7 @@ int mbs_fct_solvekin(MbsData *s, MbsSolvekin *sk)
else {
// We only do one iteration of N-R
err = mbs_step_close_geo(s, sk->mbs_aux);
return err;
}
// Kinematic resolution
......
......@@ -100,6 +100,9 @@ class MbsPart(object):
self.mbs = mbs
# Setting options with different default values in MBsysPy
self.set_options(visualise=1)
# Path to user function used by partitionning modue
self.user_path = self.mbs.user_path
if user_path is not None:
......@@ -321,8 +324,9 @@ class MbsPart(object):
1 to allow line permutation, 0 to forbid it.
defaut is 0
visualise: int
Unused but 1 stand for yes, 0 for no.
defaut is 0
In case of loop closure failing, set to 1 to plot the closing
procedure iterations.
defaut is 1
drivers: int
Unused but 1 stand for yes, 0 for no.
defaut is 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment