CS274: Computer Animation and Simulation Lecture V Higher Level Motion Control CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Higher Level Motion Control We often wish to specify higher level goals rather than joint angles and translations (Semi-)autonomous creatures reduce animator load and improve interactive applications CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Control Algorithms Control algorithms translate high level objectives into motor controls and joint angles Useful for motions like walking created by several coordinated muscle actions We maintain balance, speed, etc. by continually making small adjustments based on the situation Try to mimic what works naturally!!! CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Control Algorithms Simplified control loop User Control Simulation Frame Use feedback to maintain: balance velocity (speed and direction) etc. CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Control Laws How do we determine control laws? By hand Biomechanics data Optimization Motions like walking, running, etc. can be broken into smaller sections that are easier to analyze CS274 Spring 01 Lecture 5 Copyright © Mark Meyer State Machines Separate the motion into several simple states Simple states allow us to generate laws by hand State transitions are triggered by events Example: fall forward until foot hits the ground CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Events Often simple binary sensors CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Running State Machine CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Flight Stage Active Leg swing leg forward straighten knee Passive Leg mirror active hip angle bend knee CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Heel Contact Stage Active Leg pitch/balance control with hip extend ankle knee acts like a spring (thrust in next stage) Passive Leg mirror active hip angle bend knee CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Secondary Control Laws To add realism waist keeps body upright neck facing desired direction shoulder mirrors hip angle elbow angle is a function of shoulder angle CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Low Level Control How do we get the knee to “hold” or “extend”? Again, mimic the muscle actions at a joint Similar to a damped spring These muscle motors are known as actuators CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Actuators Actuators make the joint move to a desired pose Angular spring τ k ( d ) kv (d ) Linear spring f k (Ld L ) kv ( Ld L ) Also known as proportional derivative controllers CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Walk Cycle No flight phase in a walk cycle CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Walk Cycle Walk cycle timeline Double support Left support Left stance Right swing CS274 Spring 01 Lecture 5 Double support Right support Left swing Right stance Copyright © Mark Meyer Results Olympic Running CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Results Vaulting, Cycling and Running CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Results Combining controllers and retargetting CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Self-taught creatures? Sensor-Actuator networks: Using the same basic tools Try to find the right coefficients to maximize speed, or efficiency, or any energy. Your humanoid learns to run on his own! Slow, though… CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Self Taught Creatures Creatures that can learn to move on their own Consists of sensor-actuator networks sensors tell the character about the environment actuators allow the character to flex its muscles As the character moves, it remembers muscle movements that create “good” motion maximize speed, accuracy, efficiency, etc. t2 E 1 Eactuators 2 Emotion dt t1 measures energy used CS274 Spring 01 Lecture 5 measures motion quality Copyright © Mark Meyer Spacetime Constraints Solve for the forces required to reach constraints Animator specifies: What the character has to do (constraints) initial, intermediate, final positions, velocities, etc. How the motion should be performed (metric) jump this high, this much force at impact The character’s physical structure mass, joints, etc. What the physical resources are constraints on the muscles CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Spacetime Constraints Given the constraints Animator specified constraints Muscle and joint constraints Physical laws And the metric to optimize How to perform the action Solve the constrained optimization for the force curves over the entire time of the motion CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Behavioral/Procedural Animation Specify behaviors that the actor should follow Complexity emerges from multiple interactions Separation Avoid crowding CS274 Spring 01 Lecture 5 Alignment Match velocity Cohesion Match centroid Copyright © Mark Meyer Behaviors Seek/Flee Adjust for a radial velocity Arrival Seek and decelerate near target Other variants: pursuit, evasion, offset pursuit CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Behaviors Obstacle Avoidance Keep the cylinder in front clear CS274 Spring 01 Lecture 5 Wander Smooth random motion Copyright © Mark Meyer Behaviors Path Following Follow a small tube CS274 Spring 01 Lecture 5 Wall Following Path follow + Obstacle Avoidance Copyright © Mark Meyer Behavioral/Procedural Animation CS274 Spring 01 Lecture 5 Useful for crowd animations Copyright © Mark Meyer Cognitive Modeling Use AI to allow for planning and learning CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Putting It All Together Behavior + Learning + Motor Control Schooling CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Putting It All Together Behavior + Learning + Motor Control Preying CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Putting It All Together Behavior + Learning + Motor Control Cousto World CS274 Spring 01 Lecture 5 Copyright © Mark Meyer