UKHeliBob:

If each wheel is going at the same speed then why would you add the speeds together to give a figure that is twice the speed ? What you might decide to do is to calculate average the speed of the two wheels.

Incidentally, don't you need to use the circumference of the wheel in your speed calculation unless all you are interested in is relative speed under various conditions.

I'm a bit confused about energy being added into the system from another motor so the speed should double if using 2 identical motors?? Let's say, in the case of a motorcycle, if each wheel is powered by an identical motor, then... if one motor is running and it gives the robot a forward speed of 10m/s, when the second motor is activated such that it also turns 10m/s in the same direction, then wouldn't the motorcycle go forwards at 20m/s??

I am omitting the inclusion of the calculation of the wheel diameter for now, as i think it should be possible to obtain the speed of the robot using the encoders only and then control the speed of the robot with PWM only? These are Hall encoders, incremental and magnetic type, attached at the end shaft of each DC geared motor.

TomGeorge:

Hi,

You need to use speed of each wheel with a sign for forward and backward rotation.

If + speed is forward, -speed is backwards, then when you **add** them and divide by two, you average speed will be correct.

For example

- If both wheels are going forward at say +10, then your average speed is

(10 + 10 )/2 = +10.

- If one wheel is rotating forward at +10 and the other backward -10, as in a spin, zero speed.

(10 + (-10))/2 = 0.

3 ) If one wheel is rotating forward at +10 and the other stationary at 0.

(10 + 0)/2 = 5.

That would be right as the centre of your robot, between the wheels is travelling in a circle.

And any combination in between should give you your average speed.

You need to get direction as well as speed from your wheels.

One way is if your encoders are Quadrature Encoder then they will give direction indication.

**OR**

Look at the direction **control** to each motor, that will tell you if you are rotating forward or back.

I hope that makes sense..

Tom...

That was helpful, but in my implementation, i am thinking of simplifying the process by only considering the output pulses from one encoder only. I have quadrature encoders on both DC geared motors but i will use only one encoder signal output. But i'm not sure what you mean by direction control to each motor... how would i be able to extract this data? Maybe if i write a speed function to convert the pulses or average pulses from each motor to PWM?