Motor control for physics-based character movement

Started by
33 comments, last by Aken H Bosch 9 years, 6 months ago

I've been bashing my head on this, in one form or another, for about 2.5 years now. I would've asked here earlier, but had had too much of the IRC channel's "how to do X?" "do Y instead" garbage... but apparently the IRC channel has been officially disowned by the forums for a while now.

I want to do physics-based character animation, locomotion, etc.

What I have:

A home-brew physics engine that works, mostly. The one known issue is that collisions between certain kinds of convex primitives currently only generate a single contact point, when the contact region would be better represented by multiple contact points bounding an area.

A character consisting of rigid bodies, with skeletal joint constraints between them. The class is named Dood. I can tell each joint what torque I want it to apply, it will check to make sure it's within an allowed range, and then it will apply that torque across the joined bones.

What I don't have:

Control logic for those joint torques. I've experimented with a bunch of different things, but really I haven't got a clue how to proceed with this. I was able to come up with an analytic solution for the upper body, but only because I was able to sink all of the extra torque into the lower body. To extending this approach to work for the lower body as well would be nontrivial, to say the least. I'm completely stumped.

I've found a few papers on the subject, but I wasn't able to extract anything useful from them.

Possible "black box" formulation:

Inputs:

  • Anything and everything about the state of the Dood
  • (Maybe) info about objects the Dood is in contact with (or just his feet)
  • "Goal Description", possibly in the form of a desired linear and angular velocity (or net force and torque) on the left foot, the right foot, and the pelvis

Outputs:

  • Joint torques (3-component vectors) for all of the joints of the Dood's lower body: { left, right } x { hip, knee, ankle }

Little help?

Signature go here.
Advertisement

It's a bit difficult to guess your exact implementation, of course, but torques normally arise from a force and a moment arm, which is resolved to a force at the fulcrum plus a torque. If you have a hierarchical bone structure, that force at the fulcrum of a child would result in a torque and force on the parent joint. That sequence could be used to "pass" the force/torque to the root of the character.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Why not use a neural network based solution? I think this is one of the few cases were an AI solely based off neural networks wouldn't be one of the worst ideas ever. It could be quite functional

You can use motors that drive a specific orientation. As far as doing anything intelligent goes, well isn't this why studios pay a lot of money for software like Euphoria?

@Buckeye: If I understand you correctly, that's what I'm already doing for the upper body. Thing is, it can't be generalized for the whole body. At least one bone has to act as a sink, to allow the other bones to reach their desired orientations. Which means unless there's some very lucky coincidence, that sink bone won't be able to reach its own desired orientation.

@WireZapp: I tried, but neural nets hate me sad.png

Two problems:

  1. I don't have a set of "correct outputs" the system should produce for a given set of inputs, and I'm not sure such a set can even be constructed. At least, it would need to take into account what the Dood's state was not just in the most recent physics tick, but also in the one or two physics ticks prior. Or perhaps some cut-down version of that information, Idunno.
  2. I don't know how to select coefficients for a neural network that isn't feed-forward. Or one that is for that matter... the Wikipedia article on backpropagation wasn't very helpful. I see they've changed it a little since the last time I looked at it; it no longer contains the phrase "local induced field" (wat?), so I guess that's an improvement.

Also so far I've been too stubborn to use an existing NN library. That might change, Idunno.

@Randy Gaul: Motors that drive a specific orientation? Sounds like what I'm already doing for the upper body. Euphoria? No thanks, I'm trying to make something of my own. Or were you saying the knowledge required for that sort of awesomeness is not available to people without money to spend?

Signature go here.

Yeah I'm trying to say that intelligently driven motors are something studios have payed a lot of money for. That would imply that it's a pretty difficult thing to do! I wish I could provide more details about specifics, but I really don't know much about the implementation of such a thing.


I want to do physics-based character animation


I was able to sink all of the extra torque into the lower body


At least one bone has to act as a sink

You're apparently come up with a set of "physics" rules that differ from what is commonly understood to be application of "torque." You shouldn't end up with "extra" torque and have to "sink" it somewhere (not sure what those terms mean with regard to "real world" physics).

To speak in common terms, agreement needs to be reached for the meaning of words. How do you define "torque"? If you can express it in units (either SI or British, such as Newton-meters or ft-lbs) that would help a lot. Looking for some common terms to be able to help.

Also, describe why the lower body is (somehow) disconnected from the upper body. That may be the first thing you want to fix.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

I would suggest looking at Michiel Van De Panne's research -- he's worked on a lot of projects that demonstrate that you can achieve pretty nice control with fairly simple state machines + PD controllers. SIMBICON is a good place to start: http://www.cs.ubc.ca/~van/papers/Simbicon.htm

Higher-level stuff (when to transition from one control strategy to another) is another piece of the puzzle: http://www.cs.ubc.ca/~van/papers/2010-TOG-gbwc/index.html

Or if you like machine-learning type stuff, he has that too: http://www.cs.ubc.ca/~van/papers/2013-TOG-MuscleBasedBipeds/index.html


I want to do physics-based character animation... I was able to sink all of the extra torque into the lower body... At least one bone has to act as a sink


At least one bone has to act as a sink

You're apparently come up with a set of "physics" rules that differ from what is commonly understood to be application of "torque." You shouldn't end up with "extra" torque and have to "sink" it somewhere (not sure what those terms mean with regard to "real world" physics).

Actually Aken is trying to do a sensible thing smile.png One problem with controlling a human character is that you want the control to be accurate without being stiff.

For example - think about those jointed desk lamps with springs in each joint. They manage to convert a jointed system that would (without the springs) need quite a lot of effort to just stop it collapsing, into one where it supports itself and just needs gentle inputs to then adjust. What the springs do is (approximately) compensate for the vertical linear gravitational force (i.e. acceleration of -g) of the lamp end by "converting" it into a single torque that is applied to the base (some people might like to call this a foot), and thus "sunk" into the environment. So long as the foot doesn't overturn, of course.

You might want to read up on inverse dynamics.


Actually Aken is trying to do a sensible thing

I didn't say it wasn't sensible - resolving forces and torques through a hierarchical structure is, indeed, a reasonable approach (and can approximate the "real" world.) I said he's using terms to describe his problem that (at present) only he understands the meaning of.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement