Simple animations using primitives


I am building a 4-legged robot and I wish to make a control application that shows a simplified version of the robot on screen doing the same movements as the actual robot. I’m thinking as simple as possible; the legs should be drawn as lines, the joints as small spheres or cylinders, the body as a circle and perhaps the surface plane as a grid.

I like the idea of using python and I’m therefore checking out the Panda3D engine. It does seem to be possible to create the model with code using primitives, allthough it doesn’t seem as straight forward as I would have liked. Any tips on the easiest way of achieving this?

Alternatively I guess I could create a 3D model (using some other program) and load it into the application. I understand that Panda3D provides some sort of functionality regarding skeletal movement, so perhaps this options would be easier/better in the long run, instead of “reinventing the wheel” using primitives. Again any tips on how to achieve this?

Sorry if my questions seem silly, but despite having years of programming experience I currently have zero knowledge about this engine. So first of all I need to decide whether the engine is suitable at all for my needs, and if that is the case then which of the two mentioned approaches would be the best.

All input is very welcome…

First of all, I do think that (simple) 3D models are likely to be rather easier to work with in Panda than generating your own primitives.

As to actual approach, presuming that you use 3D models, I see two options that are likely to be fairly straightforward:

  1. Skeletal animation: Attach a simple rig to your model, export, and procedurally animate in Panda using the “controlJoint” method. This is perhaps the more complicated of the two–especially if you’re not yet familiar with rigging models. For more information, look at this manual page, and the “Looking and Gripping” sample program.

  2. Piecewise hierarchical animation: Model each piece of the robot separately, then connect them to each other in a node hierarchy, such that moving a “parent” part naturally moves its children as well. This is perhaps the simpler of the two, but might be the more complex to set up, as it calls for correctly positioning (and perhaps scaling) the various pieces manually. The following pages might be a good place to start: The Scene Graph and Scene Graph Manipulations–among other things, they describe, I believe, the node hierarchy and how to connect nodes within that hierarchy.