luajit + bullet - Odd Problems

Post Reply
dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

luajit + bullet - Odd Problems

Post by dlannan » Thu Aug 09, 2018 4:34 am

Hi All, new to the forums. I have put together a luajit + bullet3 ffi setup and it seems to be working well.
I start the ServerSharedMemoryGui example, then run my luajit program and it interacts correctly (loading in urdfs and so on).
I then started to play around with the params for the client and I ran into this problem:

Code: Select all

Assert ..\..\examples\SharedMemory\PhysicsClientSharedMemory.cpp:481 (m_data->m_testBlock1->m_numServerCommands == m_dat
a->m_testBlock1->m_numProcessedServerCommands + 1)
This appears to be directly related to these calls Im doing:

Code: Select all

    self.client = gbullet.b3ConnectSharedMemory( 12348 )
    if gbullet.b3CanSubmitCommand(self.client) == 1 then
        local cmd = gbullet.b3InitPhysicsParamCommand(self.client)
        gbullet.b3PhysicsParamSetGravity(cmd, 1.0, 1.0, -9.8)
        gbullet.b3PhysicsParamSetTimeStep(cmd, 1.0/60.0);
        local status = gbullet.b3SubmitClientCommandAndWaitStatus(self.client, cmd);
    end
If I remove the gravity params call then it works (without gravity).
Am I missing anything here? Ive tried to make multiple commands and so forth, but I referrenced a few examples and the above should work? Is the sample server needing changes to its settings (its a straight build - no changes).

Any help would be greatly appreciated. If people want my ffi file (to use bullet3 with luajit) let me know, I'll post it. Its basically a couple of header files of the C API combined.

dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

Re: luajit + bullet - Odd Problems

Post by dlannan » Thu Aug 09, 2018 5:02 am

Sorry to solve my own problem. It looks like it was just a sync issue with setting up the connection to the server.
I put a delay in between the connect command and the next bullet command and it is working fine now.

dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

Re: luajit + bullet - Odd Problems

Post by dlannan » Mon Aug 13, 2018 1:23 pm

Sorry to keep this thread alive, but i have run into another problem trying to use the C API.

I am using the following functions, with the appropriate data in the parameters:

Code: Select all

    local cmd = gbullet.b3CreateVisualShapeCommandInit( self.client )
    local index = gbullet.b3CreateVisualShapeAddSphere( cmd, radius )
    gbullet.b3CreateVisualShapeSetChildTransform( cmd, index, pos, rot )
    gbullet.b3CreateVisualShapeSetRGBAColor( cmd, index, col )
    return gbullet.b3SubmitClientCommandAndWaitStatus(self.client, cmd);
And I was hoping to see a sphere appear int he SharedmemoryServer GUI. It didnt. The only physics objects I am seeing in the GUI, seems to be URDF loaded files. When I load a plane using URDF it looks fine.

Am I missing any other required commands (I have the client setup and physics world params setup already, as well as a step cycle working too) ?
It seems (according to google) these C API calls (the CreateVisualShape ones) are not being used anywhere! So finding assistance for them is difficult.
Any suggestions / ideas are welcome.
Also, if people want to try the luajit + bullet3 Windows version "ready to go" please visit here:
https://github.com/dlannan/luvit-bullet3/

Im updating the readme right now, to include how to run the package. Again, please note this is setup for Win10:x64 Debug build. You can build your own Linux or Mac OSX binaries and it should work, but I am not up to that stage of development yet (setting up multiple builds).

Cheers,
Dave

dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

Re: luajit + bullet - Odd Problems

Post by dlannan » Wed Aug 15, 2018 2:00 pm

I have been looking through the code, and it seems that the calls to creating the visual shapes are actually not doing very much. The only function that seems to create proper bullet objects are the urdf loading commands. Which is not that useful, since I want to be able to make physics objects to entities via code. Apparently I could build a urdf and then load that via code - not a very nice solution.

It seems that bullet3 isnt really ready for this sort of usage. Something that is really missing is just simple tests - are there any available? That would help greatly in how to use these functions (if they do work). Is the C API even ready for use? I see alot of posts along this discussion without any real feedback?

<edit>
So I decided to just start trying to use functions and see what happens. To make a visible physics object I needed a minimum of:
- Creation of a collision shape
- Creation of a visual shape (this seems weird, because in code it created a collision shape??)
- Creation of a multibody and assign the collision and the visual shape.
I have some very weird inertia problems, but its at least something. I have checked it into the github link above. Hopefully over the next couple of days I'll put together as simple vehicle and boat example in this toolkit using the C API.

dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

Re: luajit + bullet - Odd Problems

Post by dlannan » Fri Aug 17, 2018 1:30 pm

Continuing investigation into constraints these are definitely missing from the C API:
- eSphericalType
- ePlanarType
And these dont appear to be implemented:
- eRevoluteType
- ePrismaticType

The only ones with code (so dont try using the above ones!):
- eFixedType
- ePoint2PointType
- eGearType

Im putting together a simple axle at the moment. Hopefully I can use the Gear type or Point2Point type to solve the constraint.

dlannan
Posts: 6
Joined: Thu Aug 09, 2018 4:25 am

Re: luajit + bullet - Odd Problems

Post by dlannan » Sat Aug 18, 2018 2:00 pm

More improvements and the beginnings of an axle joint.
screenshot2.png
screenshot2.png (82.85 KiB) Viewed 55 times

Post Reply