|
|
3.2 Inverse Kinematics on the
Scene Graph
Contents
3.2.1
Introduction
Acyclic (non-looping) trees, sometimes
called 'scene graphs,' have become a commonplace object in the computer
representation of 3D scenes because their structure reflects the connectivity
of many of the things we want to make models of. The 'tree' part makes it
easy to describe, for instance, the branching way that the crank of an
automobile engine nests into the crankcase root, and the way that the
connecting rod connects to the crank, and the piston to the connecting rod.
However, the 'acyclic' part means that there is nothing inherent in the
object structure of the acyclic tree that helps describe the way that the
piston fits back into the cylinder (a part of the crankcase.) As far as the
acyclic tree is concerned, the connecting rod and the piston can flap in the
wind.
This paper describes an approach to
closing the loop - the design and use of a Java Constraint class that encapsulates those portions of the
machine state and the methods required to solve inverse kinematics on the
scene graph.
3.2.2
Terminology
- kinematics - the branch of mechanics that studies the motion of a body or a
system of bodies without consideration given to its mass or the forces
acting on it. [Ref just about any dictionary]
Computer scientists, game designers and robotics researchers have
adopted the term inverse kinematics
to describe what they do when they specify ways to adjust the joints
between the mating parts to meet some position requirement on a part out
at the end of a chain - to ensure that the piston fits into the
cylinder, for example. 'Kinematics' because they are studying the way
parts move, and 'inverse' because the process tends to works backward up
the tree from the position requirement to the root.
Among mechanical engineers, this has been called just kinematics for centuries. On the
one hand, open or unconstrained motion just didn't have enough practical
interest to occupy an machine designer and didn't need its own word, but
on the other, real kinematics
('kinematics with constraints' or now 'inverse kinematics') was thought
to be a field appropriate for royalty, mathematicians, and philosophers.
Because I am an old mechanical engineer, I will refer to the study as
plain old kinematics.
- mechanism - an assembly of bodies linked together in a chain. [Ref 5.1.1].
- kinematic chain - a mechanism [Ref 5.1.1]
- degree of freedom (DOF) or
mobility - the number of independent parameters required to
completely specify the configuration or state of a mechanism or the
position of a part in space. [Ref 5.1.1]
- constraint - a
limitation on the degrees of freedom of a mechanism or part.
In a particularly revolting development, some computer scientists have
co-opted this term to describe a non-linear limit to the travel of a
joint. True, such nonlinearities are 'limitations,' but use of the term
in that context confounds the important discussion of the effect of
constraints on degrees of freedom.
- independent variable
- a mechanism state variable. The number of independent variables for a
mechanism is equal to the degrees of freedom.
- dependent variable -
a parameter that is determined by the state of the mechanism.
- determinate - describes a mechanism configuration in which the number of constraint equations equals the
number of dependent variables.
3.2.3
Scope
The Board of Directors of VMech.com is
interested in developing methods for building high-fidelity computer
simulations of physical processes. As an initial step toward that goal the
VMechanic is exploring the strengths and limitations of Java3D for building
models of mechanical systems. So he's interested in developing methods capable
of solving kinematic constraints with arbitrarily small error. In the general
case, the Board will want to be able to use the results as a basis for
detailed technical studies, so looking good on the screen isn't good enough.
To begin, the focus is on mechanisms with
low degrees of freedom.
Similarly, the scope will be limited to
determinate systems, that is systems for which the number of constraints
exactly equals the number of dependent variables.
Many classical mechanisms fit into this
scope - four-bar linkages are determinate mechanisms with a single degree of
freedom, reciprocating steam engines with a throttle valve lever are
determinate with two degrees of freedom, and a reciprocating automobile
engine with hundreds of parts (but with conventional valve train and
electronic ignition) is determinate with a single degree of freedom.
3.2.4 The Scene Graph
rotating lever
- sketch
- scene graph
one DOF, one independent var angle 'a'
no constraints, no dependent variable
=> determinate
simple crank
- sketch
- scene graph
one DOF, one independent var: angle 'a'
one constraint (y=0 at C), one dependent variable: angle 'b'
=> determinate
four-bar linkage
- sketch
- scene graph
one DOF, one independent var, angle 'a'
two constraints: displacements x,y at D
two independent variables angles 'b' and 'c'
=> determinate
3.2.5 Closing The Loop - Designing The Constraint Class
functional requirements for the Constraint
class
method for measuring the location of a point in a given reference frame
subclass Node
- add members
- Node MatingPart
- override, add methods
- get the Transform3D of the Mating Part with
respect to this's reference frame
- sub-gets (individual displacements,
rotations)
- accessors, mutators
3.2.6 Solving the Constraint - Behaviors
Using the Behavior class to
control a machine
subclass Interpolator
- add members
- Alpha
- Collection? of Constraint object
references
- Collection? of dependent TransformGroup object references
- override methods
- initialize()
- processStimulus()
- set independent variables with a call to super.processStimulus()
- solve for dependent variables
- set dependent TransformGroups
Candidate approaches to solving for
dependent variables (step 2.b.ii above)
- closed form solution
- poll Constraint objects to get current
positions set by 2.b.i
- solve trig or 2nd order algebraic equations
for dependent variables
- lookup table
- poll Constraint objects to get current
positions set by 2.b.i
- use prepared lookup table (with or without
interpolation) to get dependent variables
- learning lookup table
- use closed form solution and log solutions on
a lookup table until it's dense enough, then
- use lookup table (with or without
interpolation) to get dependent variables
- Newton-Raphson [Ref 5.3.1, page 379]
- set initial guess at dependent variables
- poll Constraint objects for position errors
- while (norm of constraint errors too large) {
- step through dependent TransformGroups,
incrementing each in turn, poll Constraint objects for changes in
position errors
- formulate the Jacobian
- invert it
- solve for changes to dependent variables to
drive errors to zero
- set dependent Transforms
- poll Constraint objects for position errors}
note: this use
of the while loop leaves the dependent Transforms set at the required
solution, so step 2.b.iii above is not required for the Newton-Raphson
method.
3.2.7
Results
Conclusions
|