NewtonCustomJoints on linux64/32

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonCustomJoints on linux64/32

Postby Carli » Wed Apr 28, 2010 8:00 am

Hi,

i want to integrate the NewtonCustomJoints into my project, but the linker does not find the functions from the lib.

Which libraries do I have to link for having the functions? I did not find any "JointLibrary.so" in the download folder :S
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Carli » Wed Apr 28, 2010 8:23 am

Some additional Info:

when I link the functions to libdJointLibrary.a, i get some errors a la "(.text+0x240): undefined reference to `dMatrix::operator*(dMatrix const&) const'"

Linking libdMath.a does not help, too.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Wed Apr 28, 2010 1:42 pm

If you are using anything lower than 2.19 there is not custom joint library, just the source files.
However If you download the lastest 2.19 Linux, there are makefiles for all the libraies.
they produce .a files, but you can just add the line to make generate the .so

for 2.20 I will add the line to cgerate jointlibary.so, math.so and so on, too.


Carli wrote:Some additional Info:
when I link the functions to libdJointLibrary.a, i get some errors a la "(.text+0x240): undefined reference to `dMatrix::operator*(dMatrix const&) const'"
Linking libdMath.a does not help, too.

I think this is a bug in GCC, sometime when linking libraries, the order of in which you specify then can make the linker fail linking.
I had that problem too and seaching over teh unbuntu forum I found other people with similar problems linking .a file with newer GCC.
http://ubuntuforums.org/showthread.php?t=829608
change the order of the libraries and in your makefile and see if it works.

This seem to be a very big Bug in GCC, but it looks like it does not bother anyone.
It is almost like the GCC people do not want Linux developers builing applications that link to static libraries, and the make if difficult.

It appear that .a extension does not indicates to the linker that the library is statically linked.
instead the option -static shoul be used, but I could not figured out for to use that flag
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCustomJoints on linux64/32

Postby Carli » Wed Apr 28, 2010 5:31 pm

I'm not using makefiles. I have a simple preprocessor directive {$linklib dMath}.
Maybe i'll find a way to tell the FPC the order of the linkings

Edit: aaah it works.
When i add the external declaration and the $linklib, too, it links correctly.

Edit2:
i don't think it's necessary to generate .so files for everything. It's much better to have it linked static for not having the .so file copied to /usr/lib/

thx for your effort.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 1:27 am

NewtonUpdate crashes when i set the first row of the "pins" matrix of the PlayerController to (0,1,0).

Here the backtrace:

Code: Select all
#0 dgBroadPhaseCollision::ConvexCast(dgCollision*, dgMatrix const&, dgVector const&, float&, unsigned int (*)(dgBody const*, dgCollision const*, void*), void*, dgConvexCastReturnInfo*, int, int) const at :0
#1 NewtonWorldConvexCast at :0
#2 CustomPlayerController::FindFloor(dMatrix const&, dVector const&, dVector, NewtonCollision*, float&, dVector&, int) const at :0
#3 CustomPlayerController::PlayerOnFreeFall(float, int) at :0
#4 CustomPlayerController::KinematicMotion(float, int) at :0
#5 dgJacobianMemory::ApplyExternalForcesAndAcceleration(float) const at :0
#6 dgJacobianMemory::CalculateForcesSimulationMode(float) const at :0
#7 dgSolverWorlkerThreads::ThreadExecute() at :0
#8 dgWorldDynamicUpdate::UpdateDynamics(dgWorld*, int, float) at :0
#9 dgWorld::Update(float) at :0
#10 Newton::UpdatePhysics(float) at :0
#11 NewtonUpdate at :0
#12 TICK(0x7ffff0e94040, 0) at gameengine.pas:360
#13 SIMULATE(0x0, 0) at gametemplate.pas:235
#14 STEP(0x0) at ginterface.pas:369
#15 EXECUTE(0x0) at ginterface.pas:166
#16 RUN(0x7ffff0e94040, false) at tasks.pas:102
#17 main at gwx.lpr:84


Hint: I have a lot of needle-like collisions in a compound-collision for describing the ground of the scene.
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Thu Apr 29, 2010 8:28 am

that does not tell me anything abput teh crash? if it is reproducible, can you post or send me a test?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 10:53 am

Here you have:

http://www.file-upload.net/download-2475160/hg.rar.html

it's a linux64 build.

but if you want, you can compile it under windows, too. you just have to open "src/gwx.lpi" with lazarus (http://sourceforge.net/project/showfile ... p_id=89339) and then press f9

In the menu you press "ctrl+s" and then "s".
Ingame, you press "f" the error will happen.
the code that causes the error is in "src/newtonjoints.pas".

Edit:
Code: Select all
#define MAX_CONTACTS               16

maybe that's the reason?
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Thu Apr 29, 2010 11:46 am

Oh but thsi is pascal, I do no thonk I am going to lear anoteh IDE just for debug a demo.
Here is what I can do.

-Build the Joint Libary dll. I beule there is win in the SDK
-Build a window project using your IDE but tha link to the Newton.dll and the Jointlibrary.dll
-send me the project with teh running exe,and I can chek it out from there

if it doe not crash you can do it in Linux and I can debug too. but it is simpler in windows.
Make sure you got teh lates Newton SDK
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 11:56 am

before i start my win, i want to ask a question:

what data structiure is behind the float* of the first parameter of CreateCustomPlayerController?
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 12:04 pm

Here you can see a picture when i give the identity matrix as the first parameter:
http://www.pic-upload.de/view-5463461/36.png.html
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Thu Apr 29, 2010 12:11 pm

I am confused, but this is the prototype

NewtonUserJoint *CreateCustomPlayerController (const dFloat* localFrame, const NewtonBody* player, dFloat maxStairStepFactor, dFloat cushion)

from the wiki tutorial Tutorial_202_PlayerController
Code: Select all
      // No we make and make a upright capsule for the collision mesh
      dMatrix orientation;
      orientation.m_front = dVector (0.0f, 1.0f, 0.0f, 0.0f);         // this is the player up direction
      orientation.m_up    = dVector (1.0f, 0.0f, 0.0f, 0.0f);         // this is the player front direction
      orientation.m_right = orientation.m_front * orientation.m_up;   // this is the player sideway direction
      orientation.m_posit = dVector (0.0f, 0.0f, 0.0f, 1.0f);

      // add a body with a box shape
      //shape = CreateNewtonCapsule (world, player, playerHigh, playerRadius, m_wood, orientation);
      shape = CreateNewtonCylinder (world, player, playerHigh, playerRadius, m_wood, orientation);
      playerBody = CreateRigidBody (world, player, shape, 10.0f);
      NewtonReleaseCollision (world, shape);

      // make sure the player does not go to sleep
      NewtonBodySetAutoSleep (playerBody, 0);

      // now we will attach a player controller to the body
      NewtonUserJoint* playerController;
      // the player can take step up to 0.7 units;
      dFloat maxStairStepFactor = 0.7f / playerHigh;
      playerController = CreateCustomPlayerController (&orientation[0][0], playerBody, maxStairStepFactor, padding);


you can see that localFrame is a pointer to a matrix that specify the local frame of the player.
teh firts row is the up direction, (0, 1, 0, 0) in the demo
teh secund row is the front direction (1, 0, 0, 0) in the demo maybe for you is (0, 0, 1, 0)
the third row is teh cross product of the first and secund row
the last row in vector (0, 0, 0, 1)

is that what you are asking for.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 12:25 pm

Yes, i just implemented this demo.

Now, i have a windows build for you: http://www.file-upload.net/download-2475377/hg.rar.html

I hope you find out, what's the problem. (maxbe some problem withtoo many convex hulls in compound collisions?)
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Thu Apr 29, 2010 1:15 pm

I will check the demo tonight.

did you verify the first parameter is correct?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCustomJoints on linux64/32

Postby Carli » Thu Apr 29, 2010 1:56 pm

yes.

i just copied from the demo
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: NewtonCustomJoints on linux64/32

Postby Julio Jerez » Fri Apr 30, 2010 2:21 am

Ok I have the demo.
When I run it I see a bunch of green monsters that look like dynosaurs. I can walk around and few thing move when I touch them.
I have not run wi th a debug library, but can you tell my what do I need to do to make it crash?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 4 guests