Using the RobotSimulator example as an external library

Post Reply
motionplanner
Posts: 2
Joined: Wed Apr 22, 2020 5:30 am

Using the RobotSimulator example as an external library

Post by motionplanner »

Hello,

I have a C++ based library for benchmarking algorithms for robotic locomotion algorithms , and I’d like to use Bullet to simulate robots for it. My library is built using CMake in Linux.

The b3RobotSimulatorClientAPI class defined in the examples directory would suit my needs perfectly, but I’m having trouble building it and linking to it within my project.

It’d be great if somebody could provide me some pointers on how to build this example as a library that I could include while building my project (essentially, I’d like to include this example’s header file in one of my scripts and get access to all the API methods).

Thanks in advance!
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Using the RobotSimulator example as an external library

Post by drleviathan »

The b3RobotSimulatorClientAPI.h code is part of the examples and, unless otherwise noted, falls under the zlib license according to the LICENSE.txt file in the root of the Bullet source repository.

IANAL but I think this means, if your code is compatible with zlib you can just copy b3RobotSimulatorClientAPI code into your library. Add the zlib license text to the top of the files, and then modify to your heart's content. You don't even need to call it b3RobotSimulatorClientAPI.

If your code is not compatible with zlib, then you would cut a fresh library that is under the zlib license. Put the b3RobotSimulatorClientAPI code in it to start, with license text, and modify as needed.
motionplanner
Posts: 2
Joined: Wed Apr 22, 2020 5:30 am

Re: Using the RobotSimulator example as an external library

Post by motionplanner »

Thanks, I tried copying the b3RobotSimulatorClientAPI code - unfortunately, while compiling, there is a linking error with libBulletExampleBrowserLib.so, which is built only inside the bullet repository. Copy pasting the shared object file into my library doesn't work, as it always ends up in a segfault. I'm wondering if there is a cleaner way of doing this.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Using the RobotSimulator example as an external library

Post by drleviathan »

What you're bumping into, I believe, are the trials and tribulations of building C++ projects and libraries. The example code is all there and available but you have to move it around and change it (within the constraints of the license, which are relatively loose) and write cmake modules to compile and link it. It is a broad general topic.

There is much robot simulation going on with BulletPython these days. The python API is really just a wrapper around some C-API which, I think, is a wrapper around C++ bullet proper. Dunno much about your project but I figured I would mention it: you might consider spinning up your robot simulations in python.
Post Reply