Robot animation

Hello, Everyone,
In the OpenGL, we can model a robot with the primitive-make functions, and when we need to move a articular link, we just use the glTranslatef(...)or glRotatef(...) to achieve the result, the links "builded on" the previous moving link act in the some way; I wonder in the OCC are there any similar classes to utilize the some function? Up to this moment I use the gp_Trsf and BRepBuilderAPI_Transform to translate and rotate the object, and dealing with the robot case, I want to know is there any convenient way to achieve this goal?


Kirk W. Fraser's picture

Hi Sparse,

I'm very new to Ubuntu, OpenGL, and now Open Cascade and my purpose is mainly to do robot animation for a robot controller. So I've learned something just by reading your post. Can you hook me up more?


CloneX's picture

You should be able to use a set of nested TopoDS_Compound objects to create the motion hierarchy you need. For example if you have a foot attached to a lower leg which is attached to an upper leg you can create each piece as a TopoDS_Shape, then hook them together as compound objects:
[[foot, lower leg], upper leg]
where [ , ] delineates a compound shape. Applying translation/rotation to a given compound shape should affect all nested shapes as well.

I haven't actually done this myself so no guarantees but it's something to try. Let us all know if it works!


billyyuzhihua's picture

Hello Chris,
Thank you for your advice. As you suggested, this is a good way to think but not to implement it. First of all, in my simulation, there are six joints to rotate about their own axes, and the rotating things are arbitrarily. I donot know which joint rotates first or there will be some joints moving in the same time. If acting as your way, the composing and decomposing the TopoDS_Shape will be done in every single time. Maybe I just misunderstand your methods.
In my first post, I want to know is there any method in occ that would act as glPushMatrix() and glPopMatrix() in the openGL? I think if there is, my problem is solved.