# Using LabView to make Robot track the trailer

Our team was working on autonomous mode yesterday and we are trying to make the robot track the trailer. We can detect left/right and fwd/rev movement of the image and we can turn the robot left/right and move it fwd/rev to track the image. Sounds like we are done, right?

Well, here is where we are having trouble “conceptualizing” how you move both l/r and f/r at the same time. BTW, we are testing with two motors driving two rear wheels.

For example, let’s say we have acquired the target image. Then it moves away and to the right. We will detect both the l/r movement and the f/r movement. Currently we track l/r until we center the target into the deadband, then we track f/r until we center the target into the deadband. Once both axis are in the deadband, we have the target where we want it.

The question, is there a way to combine both the l/r tracking and the f/r tracking to accomplish both at the same time?

I’m not quite understanding your question–are you asking how to track both axes or how to make the robot turn while going in forward or reverse?

Our image tracking algorithim gives us two outputs, how much the image is off of center and how much larger/smaller the image is.

For example

So when the image moves slightly to the right, we would send a +.2 to both motors to make it move slightly to the right.

If the image becomes smaller (moving slightly away) we would send a +.2 to one motor and a -.2 to another motor to move the robot towards the target.

My question, if the robot move slightly to the right and slightly further away in one motion, what signal would we send to the motors to move the robot both forward and to the right in one motion?

And, how do I calculate that mathematically.

One thing to note is that the robot speed will be the average speed of the two sides. The relative difference between the speeds of the two sides will determine the turning radius and direction. See if you can use this information to help solve your problem.

For some types of robots, you can compute the forward vector to get the range, and the steer vector for lining up, and simply combine them together. Add the lefts together and the rights.

Specifically, for skid steered robots, this will get you pretty close.

I understand your problem… and THINK I have the general idea for a solution. If its to the left of your deadband and far away then it would set the motors to:

+1
-1

(go foreword)

+1 - .2 = (.8)
-1

(go foreword and turn to the left)

Reversed for the right.* IDK!* Just me thinking…

Thanks everyone who has replied. You have given us some ideas to work with. We will test them out and post our best solution.

The simple answer is “just add the two values together for each side”.

In your example this will send .4 to one motor and 0 to the other, which will give to a rotation with forward motion.

You may need to clip the final sums to prevent them from exceeding 1.0, but it really is that easy.

Well,

We develop one method for the robot integrate F-R and L-R in 2006.
Here on Brazil, we calls by Curva.c .

The method is basic, but you need a Gyro and Encoder to make this.
The concept is that for your bot go FWD and REV, the velocity of both sides of the robot have be the same.

FWD: +Velocity_LS = +Velocity_RS
REV: -Velocity_LS = - Velocity_RS

To integrate FWD with Left, for example, you need to make:

LEFT: +Velocity_LS <+Velocity_RS

and FWD with Right:

RIGHT: +Velocity_LS >+Velocity_RS

You need to use the follow equation:

Velocity_LS / R_LS* = Velocity_RS / R_RS*

*R_LS and R_RS is respectively Radius of the Circle that Left Side describes and Radius of the Circle that Right Side describes

You have four variables and three you know: R_LS, R_RS and Velocity_LS or Velocity_RS. You can find the last variable and control your motor.

The main problem: you need to use PID to make this, and, I don’t know how to use PID with these field.

I hope that you can understood me. Is complicated explain algorithm in english:D

The simple answer is “just add the two values together for each side”.

In your example this will send .4 to one motor and 0 to the other, which will give to a rotation with forward motion.

You may need to clip the final sums to prevent them from exceeding 1.0, but it really is that easy.

I thought about this but was concerned about the loss of accuarcy as you approach full speed in one direction due to the clipping. Maybe it’s not that big of a deal, something for our programmers to test today ;>

Sloteera:

I hope that you can understood me. Is complicated explain algorithm in english

Excellent job of explaining the algorithm, I totally understood what you were saying. I would hate to see how I would have done trying to explain something in your language I appreciate your time and effort!

This is exactly the approach we used, in our code posted at http://forums.usfirst.org/showthread.php?t=11298