Is my math wrong?


#1

Hi All,

I’m doing some calculations to get the mBot to make turns based on an angle. Right now, I’m using the formula:

(((Diameter of wheel * Pi) / 360) * angle * 1.75) / Cm Per Second

In English, I’m calculating the circumference of the wheel, dividing it by 360 to get the distance required to turn one degree and then multiplying that times the angle. I thought that should give the correct distance, but to get the robot to actually make the turn, I’m having to use a scaling factor of 1.75.

I’ll concede that after several 18+ hour days (like the last three weeks), my brain might just be getting a little fried so I’d appreciate any insight as to why the scaling factor is needed. I haven’t found anything in the Makeblock libraries that indicates a need, but when the mBot rubber meets the road I seem to have to use it.

Thanks in advance!


#2

Your math looks correct.

Did you measure the cm per second while turning, or in straight line travel? You would do better with ‘time to complete a revolution’ and just leave the distances out of it.


#3

@chuckmcknight,

Everything looks correct to this point, however I think that your scaling factor may have something to do with the speed setting. Don’t forget, Distance = Time * Speed. Unfortunately, I don’t think there is any information for you about this for the mBot. I’ll take a look at this over the weekend and get back to you with the results (hopefully it is linear).

Mike


#4

Ah ha! Nothing like getting some sleep and letting my brain work on it overnight. The scale factor is the ratio between the wheel base and the wheel diameter so the correct formula is:

(((WheelDiameterInCm * 𝛑) / 360) * AngleInDegrees) * (WheelBaseInCm / WheelDiameterInCm)

This seems to produce a consistently correct result on the robot.

@Gort, yes, I’d measured linear and turning distances to get the timing for CmPerSec. :slightly_smiling:

And now on to the last three programs for the book!


#5

Ahh yes, the front if the vehicle draws a larger arc, doesn’t it.

The old formula resulted in time to drive given arc, in seconds but you weren’t measuring the correct diameter. It is not the diameter of the wheel turning, it is the diameter of the circle drawn by the front of the vehicle.

It is one of the reasons to leave out the distances, wouldn’t it be simpler to just say "3 seconds drive time per 360 degress. "

I like it, but you must realize that torque variation and battery level will change the results in any case with analog motors.

A notched wheel sensor in a photo interruptor could be used to calculate actual speeds, but would increase the complexity of the project, especially for a book. Just spitballing here.


#6

Using just the timing method definitely works and I should likely have gone down that route initially. I think I went down the other path because I’ve written too many simulations in the past where that would be the calculation I’d employ. Then again, maybe sleep isn’t just a poor substitute for lots of caffeine. :slightly_smiling:


#7

Why don’t you just use a compass?


#8

I had considered using a compass, but I don’t want to push any additional cost on the kids taking the class right now. Plus, it’s a good exercise for them to have to think through the problem. :slightly_smiling:


#9