# Why Tri? A stupid way to build a robot.

March 3, 2011

This is a robot built mostly to explore how you can steer with a combination of differential rear steering and a single servo controlled front wheel. This is a stupid way to steer. Why try it? I expect I'll learn a few things. Maybe you will too.

- Video 1: RC Turning Test
- Video 2: Motor Driver Test
- Video 3: Spin Turn Test
- Video 4: Turning Mode Test
- Video 5: Adaptive Steering Test
- Video 6: Why Tri Sound 'n Fury!

You can also see Why Tri's robot page.

*Update 2011-05-03*

I have created a little LED and piezo module to trick out Why Tri for some light and sound effects. I call it, "SoundnFury".

See video #6 for a demonstration.

*Update 2011-05-02*

While I was away from home, I worked on some new adaptive steering code for Why Tri. I finally got a chance to test and refine it.

Check video # 5.

*Update 2011-04-13*

So much progress since the last post.

Why Tri's chassis is now largely complete. No more ghetto cardboard threads for him. Custom cut acrylic decks and hand formed servo mount. Stylin!

Now that I have my Plexi Bender 800 working, there'll be no stopping me.

In this rear view shot, you can see where the uBotino robot controller mounts between the two batteries.

The programming is coming along well too. I posted two videos (#3 and #4) showing some turning tests.

More to come...

I've done a fair amount of work on Why Tri recently. I'm getting his new chassis in shape.

The top deck is made of plexiglass (or acrylic, or something... I had it lying around). I cut it on my compound mitre saw, which worked remarkably well considering it has a big wood-cutting blade in it. I did break the back-right corner, but as long as you move the saw down slowly, it cuts thin plexi really well. I was surprised.

The bottom deck is made of cardboard. This will eventually be replaced, but it works for now.

The motors are hot-glued in (of course).

The front wheel is a Pololu wheel designed for an encoder, which I don't have. It is also designed for a Pololu D-shaped motor shaft, so I had to drill it out to fit my axle.

Above you can see the front wheel mount, which is the culmination of accumulated knowledge from several people. The axle is made from an old antenna, thanks to advice from Frits that goes back to the earliest days of LMR. The brass tubing spacer were I learned to cut from Chris the Carpenter in his now infamous tip on how to cut small brass tube. The mount itself is constructed of PolyMorph, which I first learned about on this site. This great tip from OddBot explains how to turn PolyMorph into sheets and brackets and useful things that don't look like half melted globs. It's just a simple collection of things I learned, but isn't that part of what makes LMR so great?

You can see the mount under construction in the picture below.

I completed assembly of the uBotino controller board, and got it hooked up with a basic sketch to test the motor driver.

The second video shows the test drive. More to come soon!

*Update 2011-03-04:*

I built a prototype using cardboard as the frame. I even used cardboard for the front wheel bracket, which worked about as well as you might imagine. ; j

However, the first tests prove out the theory below, at least for the spin turn (front wheel at 90 degrees) and one wheel turn (front wheel at 60 degrees). Once I get my ubotino board installed, we'll test out the common center point turns.

I uploaded a video shot late last night showing the tests.

*Original Post:*

I while ago, I posted my experiments on How not to Steer. In that post, I built a quick test platform using RC control to steer a pair of front wheels with a servo, while powering the platform with a pair of motor driven rear wheels. It was my first experience trying to steer with the front wheel, rather than with differential drive. I learned a lot through the experience, and we generated some interesting replies to the post.

Now the other day, my son decided he wanted to build a robot. He had very particular ideas about it.

- It should be shaped like a triangle.
- It should steer with the front wheel.

I have a ubotino board from Ro-Bot-X, just waiting for some parts to arrive, so I decided to use that. The board includes an h-bridge motor driver for two motors, so I will have two PWM-enabled rear wheels, and I will use a servo to steer a single front wheel, as shown below.

Now you may well ask, why use a front-wheel steering servo when I have two rear wheels that I could use for differential steering? A roller ball allowing turning in any direction in place of the front wheel would work just fine.

Why? Because that's how my son really wants it to work. Also because, I will probably learn some things by trying this out. That's why I'm calling this robot 'Why Tri'.

If I simply try to use the servo to steer, without adjusting the relative speed of the two rear wheels, I'll have to overcome a lot of drag. Or more likely, as I learned in my 'How not to Steer' experiment, the front wheel might not have enough friction to prevent the rear wheels from overpowering it and pushing the robot straight forward. I need to vary the speed of the two wheels in proportion to make the turn smooth. I also need to match the angle of the front wheel so that it offers the least resistance to the turn.

This led me to some interesting calculations.

If I try to spin the robot by turning one wheel forward and the other wheel backward at the same speed, the front wheel needs to be turned 90 degrees. This way it will be tangential to the circular path traced by the front wheel.

Notice that with the two rear wheels spinning in opposite directions (at exactly the same speed), the front wheel will trace a circle with the center point directly between the two rear wheels. If the speeds aren't matched, the center point moves along the axix between the two wheels, and the angle the front wheel needs to be at would be something other than 90 degrees, or it will drag a bit.

Now consider, if I turn only one wheel, and leave the other rear wheel off, the center of the circle changes to a point at the center of the rear wheel that is not moving.

In the picture above, the right wheel is not turning, while the left wheel turns the robot to the right. The center point of the turn is the right wheel. The circle shows the path traced by the left wheel. The same circular path is traced by the front wheel. In order for the front wheel not to drag, it must be turned tangential to the circle, which is 60 degrees. This is because Why Tri is built on an equilateral triangle. Each corner of the triangle is 60 degrees. The front wheel is turned 90 degrees relative to the line connecting the front wheel to the right (non-turning) wheel, which is the center-point of the circle.

So that's nice. Now I can easily handle two common manuevers: spinning and turning with one wheel. However, it would be nice to be able to turn with the front wheel at a variety of angles, so I can make sharper or wider turns.

Now the problem becomes interesting. How do I know the relative speeds I need to turn the two rear wheels to match any arbitrary angle of the front wheel? I decided to tackle the problem from a... different angle (pun intended).

I want to make the relative speeds of the rear wheels such that the slower wheel traces one circle, and the faster wheel traces a larger circle *with the same center point.* That last bit is important.

To make what I call a common center point turn, I need to calculate two things:

- The relative speeds of the two rear wheels
- The angle of the front wheel

As you can see in the picture above, the inner wheel (which is turning more slowly) traces a circle with the radius **r**. The outer wheel traces a larger circle, with a radius of **r** + the distance between the two rear wheels. Let's say this distance is 5 (pick your favorite unit), so the outer circle has a radius **R** = **r** + 5.

Notice that the front wheel will also trace a circle with a common center point. This circle will have a radius between **R** and **r**.

Calculating the relative speeds of the rear wheels

The formula for the circumference of a circle is 2*pi*r (where r is the radius). So using R and r, we get the circumference of the outer circle (Co) and the circumference of the inner circle (Ci).

- Ci = 2*pi*r
- Co = 2*pi*R

Now it is easy to get the relative speeds, because the rear wheels must each turn fast enough to trace their own circle over the same duration of time. That is, they need to if I want them to maintain circular paths with a common center. There's a simple ratio of Ci/Co.

Combinging and solving the two equations for Ci, I get:

- Ci = Co * (r / R)

Since R = r + 5, this becomes:

- Ci = Co * (r / (r + 5))

So for example, if I want **r** to be 2.5 (again, pick your favorite unit, it's all relative), then R = 7.5 and Ci becomes:

- Ci = Co * 0.3333 (or Co / 3)

I can use PWM to make the inner wheel spin at a set ratio to the faster outer wheel.

Great, but what angle do I need the front wheel to be at? More math is required.

Calculating the front wheel angle

I can get the angle formed by the mid-line of the robot's triangle and the radius of the circle traced by the front wheel. In the picture above, this is marked **Af**. The angle I need the front wheel to be at is simply 90 - **Af**. The hieght of my equilateral triangle is 4.33.

The tangent (tan) of the angle Af is found by dividing the length of the opposite side by the length of the adjacent side. Calculate the arctan of this ratio to get the angle.

- Af = arctan( (r + 2.5) / 4.33 )

So in our example where **r** = 2.5, this gives us:

- Af = arctan( (2.5 + 2.5) / 4.33 ) = 41 degrees (rounded)

Rather than have a microprocessor calculate the needed speeds and angles for any possible turn, it is easier to pre-calculate several turn radii and program for those.

Notice that for an inner wheel turn radius of zero, the inner wheel speed is 0 (stopped) and the front wheel angle is 60 degrees. This is exactly the result I calculated by geometry in the third picture above.

Also notice that for very large radii, the front wheel angle begins to approach 0, and the relative speed of the inner wheel approaches a 1:1 ratio with the outer wheel. In other words, the robot is going in almost a straight line.

Practially speaking I would just select a few of the speeds/angles from the table above and program in a left and right hand version of each.

One more practical consideration is the turning servo itself. Some servos don't turn a full 180 degrees. If the servo I use has this limitation, I can cheat its position so that it can turn 90 degrees to the body of the robot to one side, and will have less than 90 degrees freedom to the other side. Since I can spin either left of right with the wheel turned 90 degrees, it doesn't matter which direction the wheel is turned.

Anyway, thanks for reading. Sorry for all the math. I'll keep you posted when the bot gets built. Please feel free to comment.

*Update 2011-04-08:*

## I have the robot prototyped

I have the robot prototyped with a cardboard chassis. It turns OK, but not great with the front wheel when both rear motors run at the same speed. I need to get a few parts in before I can populate the ubotino board and get the PWM programmed the way I want.

## Are two drive wheels required?

The tortoises, built by William Grey Walter, drove the front steering wheel. Walter Jr., aka little buddy, aka Gilligan, will also be using the same setup. I believe it would simplify the math required.

## First, thanks for the

First, thanks for the reference to William Grey Walter's work on early robotics. It made for interesting reading.

Secondly, yes, indeed. It would be more simple to have the steering motor in front also act as the drive motor. However, I'm going to proceed with this experiment and see where it takes me. I know going in that this is not the best way to build a robot (hence the name of the post), but I've already come up with some interesting thoughts around navigation using circles as a basis for turn computation. It's a concept I've been thinking about for a while now.

Basically, you can consider every maneuver in terms of a circle. A spin, and turn on one wheel, one wheel turning faster than the other. Even a straight line could be considered traveling in a circle with an infinite radius.

2