Commit 89846968 authored by Sebastien Timmermans's avatar Sebastien Timmermans 🎹
Browse files

[Fix] seg fault due to use of dirdyn without nqu nor nqc, issue #137 == add...

[Fix] seg fault due to use of dirdyn without nqu nor nqc, issue #137 == add check in dirdyn init to stop irrelevant process
parent 713044aa
......@@ -97,14 +97,13 @@ MbsAux * initMbsAux(MbsData *s)
if (nquc)
{
mbs_aux->iquc = get_ivec_1(nquc);
mbs_aux->iquc[0]=nquc;
for(i=1;i<=nqu;i++)
mbs_aux->iquc[i] = s->qu[i];
for(i=1;i<=nqc;i++)
mbs_aux->iquc[i+nqu] = s->qc[i];
}
else
mbs_aux->iquc = NULL;
mbs_aux->iquc = get_ivec_1(nquc);
allocate_sensor(mbs_aux->psens, njoint);
init_sensor(mbs_aux->psens, njoint);
......
......@@ -89,7 +89,7 @@ void mbs_close_kin(MbsData *s, MbsAux *mbs_aux)
double term;
nL = s->nhu;
nC = mbs_aux->iquc[0];
nC = s->nqu + s->nqc;
for(i=1;i<=nL;i++)
{
for(j=1;j<=nC;j++)
......@@ -116,7 +116,7 @@ void mbs_close_kin(MbsData *s, MbsAux *mbs_aux)
// calcul des vitesses dependantes (qdv = Bvuc * qduc)
nL = s->nqv;
nk = mbs_aux->iquc[0];
nk = s->nqu + s->nqc;
for(i=1;i<=nL;i++)
{
term = 0.0;
......
......@@ -188,6 +188,18 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
Simu_realtime *realtime;
Realtime_visu *visu;
#endif
// Check the usefulness of dirdyn
//----------------
if (mbs_data->nqu+mbs_data->nqc == 0)
{
mbs_msg("\t >Dirdyn> If no independant nor driven joints are present, the direct dynamic process has no reason to be used !\n");
mbs_msg("\t >Dirdyn> Irrelevant process !\n");
mbs_error_msg("[%d] in mbs_dirdyn_init !! \n", -410);
}
else if (mbs_data->nqu == 0)
{
mbs_warning_msg("\t >Dirdyn> You are using the direct dynamic process without any not-driven independant joint ! \n");
}
// INITIALIZATION
// - - - - - - - -
......
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