Adding physics to a robot arm model

Hi, I have a robot arm CAD model that I want to use in a simple simulation game. I’ve been using Panda3D for about a week so bear with me here.

Essentially from Blender I’ve exported a rigged model with bones, a robot arm. I want the user to use the keyboard to control this robot arm so it can push around objects, eventually pick them up, and behave somewhat properly in the environment setting (another egg file) I’ve loaded. This means the arm can’t go through the floor, hit walls, or hit itself.

I need basic physics essentially!

Otherwise I’ve been doing quite well implementing the other functionality I need for this basic robot arm simulator.

Now I’m not sure which way to go. I’ve looked a bit into both the Bullet engine and the Collision stuff in Panda3D. And my main concern so far is that neither seems to work with the Actors class, and I’m not sure if Collisions give me reasonable physics. But I like the Actor class because it easily allows me to grab the bones and rotate them, i.e. move the robot arm.

Here is the code of my project so far: github.com/js117/Panda3Dtesting … _test_1.py

Pic of app so far that should help explain: github.com/js117/Panda3Dtesting … im_pic.PNG

(Feel free to download the repo and test it out, includes the models/egg files I’m using.)

Basically I’m lost in terms of what direction to go. Should I abandon the Actor class and use Collisions? But then I don’t know how to control my robot arm bones programmatically and cleanly like I’m doing right now. Is there a way to just ‘add Bullet physics’ to all my objects and have some basic semi-reasonable behavior? I don’t even need anything that realistic, just some gravity and basic forces when any part of the robot arm hits an object, with some objects (such as the floor, walls, and the robot arm itself) being immovable and preventing further motion when the robot arm hits them.

Hope I explained this clearly. I’ll be ready to update with any more info I can. Any sample code of similar projects would be appreciated as well :slight_smile:

Thanks in advance!

Bullet sure can help making an environment that responds. For things that should fall, roll, knock over, bounce it’s great. For grabbing and holding things - you might want to cheat and just attach on object to the arm then relay on friction.

The robot looks rigged so you could break it into parts, combine those parts using Bullet constrains and then manipulate it by applying torque. It can still be done by attaching collision solids to the bones/joints (or copying the rotation and position of joints in a task), if you do that you should probably set the robot to kinematic and make it stop manually when some part of it hits a wall, floor or some other static, unmovable object.

Hey wezu, thanks for your response. Yes those sound like good ideas, I looked at Bullet previously but couldn’t figure out how to piece together this sort of functionality. Totally OK with fudging the grabbing motion and using friction or whatever for the eventual hand grab (step 1 is just push objects and don’t go through walls).

My issue is that I don’t know where to get started in terms of code for this! :stuck_out_tongue:

I’d think this would be a simple code snippet that would already exist somewhere:

  • Load actor model
  • Control its joints (bones) programmatically
  • Exist in a physical environment with reasonable collisions and physical interactions with simple shapes, floor, etc

But I’ve only found bits and pieces, still trying to get something pieced together.