Kinematic and dynamic body: interaction?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Thu May 09, 2013 6:16 pm

Ok I modify the frictionDemo to just load the FlatPlane.ngd

Enclave and Joe please sync, build and run and see if this simple mesh can reproduce the bug before I start adding check code.
The flat Plane is a one polygon Mesh, therefore If it can reproduce the bug, then it si eassy to stape teh code all the way until the bug happens.
I will add lot of sanioti chek code, but let us first fin a simple mesh that reprocude teh bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Thu May 09, 2013 6:21 pm

Oh you say that teh flatplane loads fine. but box.ngd does not

I change the demo to load only box.ngd, please try again let us make sure we can reproduce it.
That mesh is still simple enough to debug.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Thu May 09, 2013 6:53 pm

Julio

I am sync to SVN, r64

The sandbox is running ok, but i see only the skybox. The bug is not present.
I am using a VS2008 at this moment.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Thu May 09, 2013 8:53 pm

It may mean that that shape does no have the problem.
you say teh teh bridg did, let us tyr that then

in file: C:\tmp\newton-dynamics\applications\demosSandbox\sdkDemos\demos\BasicFriction.cpp
line: 69

change this line
GetWorkingFileName ("box.ngd", fileName);

with this
GetWorkingFileName ("hangingBridge.ngd", fileName);

and if that does not fail try different one until we find one the case the crash
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Sweenie » Fri May 10, 2013 2:27 am

The sandbox demo was crashing on both of my computers Win 7 and Windows XP until I changed the language settings of my system to English(USA) instead of Swedish.
So this probably could be an issue with decimals being parsed wrong. In Sweden comma(,) is the decimal separator and dot(.) is the thousand separator. Guess that goes for other European countries as well.
Never been an issue before though, so has something changed recently that could affect how numbers are parsed?
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Kinematic and dynamic body: interaction?

Postby JoeJ » Fri May 10, 2013 2:33 am

Sweenie wrote:changed the language settings of my system to English(USA) instead of Swedish.
So this probably could be an issue with decimals being parsed wrong. In Sweden comma


Ha - have had the same idea over night (but not tried yet).
I remember some apps did not work because ., - mismatch :)
Julio, maybe you can tell tinyxml what convention to use?
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Kinematic and dynamic body: interaction?

Postby JoeJ » Fri May 10, 2013 2:40 am

Confirmed - i did not change whole language setting only made . decimal and ' thousend - and all is ok.
That can be done in language region settings - more options. No reboot required.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: Kinematic and dynamic body: interaction?

Postby Sweenie » Fri May 10, 2013 2:51 am

JoeJ wrote:Ha - have had the same idea over night (but not tried yet).
I remember some apps did not work because ., - mismatch :)
Julio, maybe you can tell tinyxml what convention to use?


Hehe yeah, I often run into this problem when using .NET and forget to handle localization correctly. :roll:
Everything works fine until someone with a different localization runs the app. :?
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Fri May 10, 2013 4:49 am

Yes!!! We found a what causes a bug!

It is a format of numbers, the comma and dot.

Julio uses:

123,456,789.00
-123,456,789.00

I am using:

123 456 789,00
-123 456 789,00

I am using the russian version Windows 7 with Russian locale, but Julio using English(USA) with USA locale.
I just change a language format to USA locale and everything running ok!

This issue is inside somewere tinyxml? It looks like the parser cannot read a numeric data from the ngd file, and then we get an crash.

Sweennie, thanks a lot for message about error reason. 8)

EDIT: Julio, why this error is occured only after you migrate to wxWidgets, not before?

Try to switch you computer regional locale settings to another, for example Russian. You must get a crash then!
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Sweenie » Fri May 10, 2013 5:44 am

Not sure if this is the best fix, but worked for me...

in dScene.cpp function bool dScene::Deserialize (const char* const fileName)
i changed the code from this...
Code: Select all
doc.LoadFile();

to this...

Code: Select all
char* oldloc = setlocale( LC_ALL, 0 );
setlocale( LC_ALL, "C" );
doc.LoadFile();
setlocale( LC_ALL, oldloc );


You'll need to add #include <clocale> in dSceneStdafx.h

[EDIT]
Aha, seems it was WxWidgets causing this after all...
The locale by default is "C" but i guess wxWidgets change it during initialization.

#if wxUSE_INTL
// called during wxApp initialization to set the locale to correspond to
// the user default (i.e. system locale under Windows, LC_ALL under Unix)
virtual void SetLocale();
#endif // wxUSE_INTL
Sweenie
 
Posts: 503
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Fri May 10, 2013 9:15 am

All right :D
Thank you guys, I added the solution that Sweenie proposed to the dScene utility library.
It is all check in and should work for everyone without changing anything on you OS.

on the bright side we found few issues.
The stack overrun but is a real Visual studio 2012 express, problem with inline function in debug mode
basically if you set the project to inline when ever possible in debug, the compile inline some functions but the PBD will no be aware of the and the debugger will interpreted as a memory overrun.
That was the bug that Joe had, and I get when I first converted the VS2010 to VS 2012 projects.
after I set the compiler setting to default, the stack crash was fixed.

the secund thing is that we now have VS 2012 project.
I now see that VS 2012 is by far so much superior that VS 2010.
VS 2010 in my opinion was by far the worse version of Visual studio, and it look like on 2012 the add what the promise for 2010 and what the could not fix the took it away.

the remove all of the Bach Build and Back clean functionality, which for me was useful but now no as much, this si no big deal.

the added more instruction set to eh 32 bit compiler, because it compile code to x87, and it never use some of the predicates instruction like conditional movs.
the was whi VS in 32 bit was so much slawer that GCC, LLVM, and Intel.
I guess the completion force then to improve the 32 bit compiler.

there is auto factorization, but it is not vectorizing the vector class.
I thonk it is because the vector class is writin in a way the is no friendly for that for example the Add function is writeen like this

Code: Select all
template<class T>
TemplateVector<T> TemplateVector<T>::operator+ (const TemplateVector<T> &B) const
{
   return TemplateVector<T> (m_x + B.m_x, m_y + B.m_y, m_z + B.m_z, m_w);
}


I will probably have to write like this
Code: Select all
template<class T>
TemplateVector<T> TemplateVector<T>::operator+ (const TemplateVector<T> &B) const
{
   return TemplateVector<T> (m_x + B.m_x, m_y + B.m_y, m_z + B.m_z, m_w + B.m_w);
}

or add a union of an array of four floats, to the class and write it like this
Code: Select all
template<class T>
TemplateVector<T> TemplateVector<T>::operator+ (const TemplateVector<T> &B) const
{
    TemplateVector<T> tmp;
     for (I = 0; I < 4; I ++) {
         tmp.vect[I] = vect[I] + B.m_vect[I];
     }
    return tmp;
}


if either of these two modes works, and yield packed simd binaries, I will get rid of all of the simd code in the engine.
all in all VS 2012 seem so much better and should generate better 32 bit code than old previous versions.
Now we can go to deal with the rest of the Player controller modifications.

Please do some last test to see if this fix actually solve the bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Fri May 10, 2013 12:34 pm

Julio, are you did this test?

Try to switch you computer regional locale settings to another, for example Russian. Or change the dot separator "." to comma ",". You must get a crash then!


Because on my system demo is still not working, i get the same assert. When i switch comma seperator "," to dot ".", everything works fine.

I am update from SVN rev.66

Check it please, bug still not solved. :shock:
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Julio Jerez » Fri May 10, 2013 1:02 pm

how do I do this?

Try to switch you computer regional locale settings to another, for example Russian. Or change the dot separator "." to comma ",". You must get a crash then!
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Fri May 10, 2013 1:10 pm

Please look to the screenshot:

1)Open control panel, then open "Language and regional setting".
2) On the main page switch "Format" field to Russian (Russia)
or open the "More options" and change the comma separator to dot.
Attachments
error10.png
error10.png (60.74 KiB) Viewed 3870 times
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

Re: Kinematic and dynamic body: interaction?

Postby Enclave » Fri May 10, 2013 1:42 pm

Julio, i know why this bug is still present.

Code: Select all
   TiXmlDocument doc (fileName);

   // apply last Configuration, using standard localization
   char* const oldloc = setlocale( LC_ALL, 0 );
   setlocale( LC_ALL, "C" );
   doc.LoadFile();
   dAssert (!doc.Error());
   setlocale( LC_ALL, oldloc ); <<<----------------- Comment this line!

   bool state = true;


You too early set a locale back. You just load the file, and next step is the parsing. You must put line " setlocale( LC_ALL, oldloc )" in another place, a little further in the code, after parsing the all files.

I am also believe this place is not good for setting locale. Is much better to set it in somewhere in the beginning of initialisation of the demo program, and set it back when it's finished.
Enclave
 
Posts: 81
Joined: Wed May 01, 2013 6:00 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest