views:

716

answers:

9

Anyone know the formula used to control the movement of a simple tank-like vehicle?

To 'steer' it, you need to alter the force applied the left and right "wheels". Eg. 1 unit of force on both wheels makes it go forward. -1 units of force on both wheels makes it go backwards. Apply more force to one wheel than the other and it turns.

How would you calculate the amount of force needed on both wheels to turn the tank a certain number of degrees either way?

Or am I thinking about this in the wrong way?

edit: As William Keller mentioned I missed out the speed of the tank. Assume 1 unit of force on both wheels moves the tank forward at 1 unit per second.

For anyone who's interested, I just found this thread on gamedev.net: http://66.102.9.104/search?q=cache:wSn5t58ACJwJ:www.gamedev.net/community/forums/topic.asp%3Ftopic_id%3D407491+tank+track+radius+velocity&hl=en&ct=clnk&cd=1&gl=za&client=firefox-a

Another thread: http://www.physicsforums.com/showthread.php?t=220317

It turns out the key to finding the formula was just knowing the correct terminology ("skid steer") :P

+1  A: 

Well, keep in mind that you're also talking about duration here. You need to find out the forces taking in to account the speed at which the tank turns at (1, -1).

I.E., if the tank takes one second to spin 360˚ at (1, -1), and you want to spin 180˚ in one second, (.5, -.5) would do the trick. If you wanted to spin the same amount in half a second, then (1, -1) would work.

This is all further complicated if you use abs(lrate) != abs(rrate), in which case you'll probably need to break out a pencil!

William Keller
+4  A: 

You're thinking about it the wrong way. The thing is, differing amounts of force on the tracks will not turn the tank a certain number of degrees. Rather, differing force will alter the RATE of turn.

The relationship between the force and the turn rate will vary depending on the mechanics of the tank. The wider the tank the slower it turns. The faster the tank the faster it turns.

P.S. Some more thoughts on this: I don't think a physics-based answer is possible without basing it off a real-world tank. Several of the answers address the physics of the turn but there is the implicit assumption in all of them that the system has infinite power. Can the tank really operate at 1, -1? And can it reach that velocity instantly--acceleration applies to turns, also.

Finally, treads have length as well as width. That means you are going to get some sideways slippage of the treads in any turning situation, the faster the turn the more such slippage will be required. That is going to burn up energy in a sharp turn, even if the engine has the power to do a 1, -1 turn it wouldn't turn as fast as that would indicate because of friction losses.

Loren Pechtel
A: 

It has been a while since I did any physics but I would have thought that the apposing forces of the two tracks moving in opposite directions results in a torque about the center of mass of the tank.

It is this torque that results in the angular momentum of the tank which is just another way of saying the tank starts to rotation.

jussij
I think he understands this much!
William Keller
A: 

It's not a matter of force - it depends on the difference in velocity between the 2 sides, and how long that difference holds (also the tank's width, but that's just a constant parameter).

Basically, you should calculate it along these lines:

  • The velocity ratio between the 2 sides is the same as the radius ratio.
  • The tank's width is the actual difference between the 2 rasiuses (sp?).
  • Using those 2 numbers, find the actual values for the radius.
  • Multiply the velocity of one of the sides by the time it was moving to get the distance it traveled.
  • Calculate what part of a full circle it traveled by dividing that into that circle's perimeter.
A: 

I'd say you're thinking about it in the wrong way.

Increasing the difference in speed between the two treads doesn't cause degrees of turn - they, combined with time (distance at different speed) cause degrees of turn.

The more of a difference in tread speed, the less time needed to achieve X degrees of turn.

So, in order to come up with a formula, you'll have to make a few assumptions. Either turn at a fixed rate, and use time as your variable for turning X degrees, or set a fixed amount of time to complete a turn, and use the track speed difference as your variable.

Dominic Eidson
+2  A: 
Change in angle (in radians/sec) = (l-r)/(radius between treads)
Velocity = l+r

For the dtheta, imagine you had a wooden pole between your two hands, and you want to calculate how much it rotates depending on how hard and which way your hands are pressing - you want to figure out:

how much surface distance on the pole you cover per sec -> how many rotations/sec that is -> how many radians/sec (i.e. mult by 2pi)

Paul Betts
Wow. That looks deceptively simple. I'd like to accept this as the official answer but I have to test it first.
ilitirit
velocity is (l+r)/2 i think
lajos
I could be wrong, but I'm at least in the ballpark
Paul Betts
+1  A: 

Here's how I would attack the tank problem.

The center of the tank will probably be moving by the average speed of the right and left tracks. At the same time, the tank will be rotating clockwise around it's center by ([left track speed] * -[right track speed]) / [width].

This should give you speed and a direction vector.

Disclaimer: I have not tested this...

lajos
A: 

You could look at it by saying : each track describes a circle. In the case where one track is turning (lets say the left) and the other isn't, then the facing will be dependant on how long and how far the left tracks turn for.

This distance will be the speed of the tracks x time.

Now draw a triangle with this distance, and the wheelbase pencilled in, plus some sin and cos equations & approximations, and you might get an approximate equation like :

facing change = distance travelled by tracks / wheelbase

Then you could incorporate some accelleration to be more realistic: More physics...

The speed isn't constant - it accellerates (and decellerates).

ie over a period of time the speed increases from 0, to 0.1 ... 0.2 ... 0.3 up to a limit.

Of course, as the speed changes, the rate of change of the facing changes too - a bit more realistic than the speed (and thus rate of change of the facing) being entirely constant.

In other words, instead of controlling the speed, the player controls the change in speed. This would make the speed go from 0 ... 0.02 ... 0.06 ... 0.1 etc. as the player pushes the controller. Similarly for decelleration, but a bit more rapidly probably.

hope this helps.

julz
A: 

I think everyone should also take note of the fact that tanks can turn on a Zero-radius circle: by applying the same speed on each track but on opposite directions, tanks can turn on a dime.

Jon Limjap