0
$\begingroup$

In our engineering science lesson, my class has been tasked with programming the Formula Allcode buggy to run a pre-specified circuit with smooth turns.

The issue we are having is that we do not know how to do this whatsoever.

Most of us are doing this in scratch, but to explain the code a little...

there is a function called SetMotors that allows us to set the speed of the wheels as a percentage. We don't know what its maximum speed is and we don't know how to make the buggy turn at a specific angle, nor how to straighten it out at a specific time.

The circuit has a lot of smooth corners so using the functions Left and Right are out as they simply pivot the vehicle, rather than allow it to turn while moving. It's supposed to be a race!

Hopefully I've given you enough information, but I'll be glad to clarify on things as needed.

$\endgroup$
  • 1
    $\begingroup$ Do you have access to any input from sensors ? Otherwise you will have drifting issues and it is going to be hard to follow a path. Another hint, you can do macro function in scratch, i.e. group a set of instruction and re-use this set, that might prove useful to have readable code. $\endgroup$ – N. Staub Dec 4 '17 at 13:15
  • $\begingroup$ Yes, the bot has a built in accelerometer, but it looks complicated to use. It can measure it through three axis. $\endgroup$ – Angelucifer Dec 16 '17 at 13:50
0
$\begingroup$

I would suggest that you attempt to determine the values empirically. Create a start/finish line of fixed distance (1 meter, 5 meters, etc.), then time how long it takes the vehicle to cross it. Be sure to have the vehicle cross the starting line already at top speed or else you'll add the time it takes to accelerate and that will screw up your measurements.

Once you have a top speed, you can then measure the wheel base (distance between tire axial centers) and the wheel radii and use differential drive equations to calculate how to achieve a particular turning radius.

A note from experience: centrifugal forces may cause tire slip when cornering at high speed ("drifting"), but you won't be able to measure how far you drift. I would highly recommend you thoroughly test your cornering capabilities first and lower your cornering speeds accordingly. Professional drivers will slow down right before cornering, then begin to accelerate about halfway through the turn for this reason.

So, where wheel speeds of (50-5)% and (50+5)% might get you the desired wheel speed difference to make a turn, the forward speed could be faster if you did (100-10)% and (100)% instead. You still get a net 10% speed difference, so the turning radius would be the same. However, cornering at a net 95% speed might cause wheel slip. Consider lowering the net speed to something like (80-5)% and (80+5)% instead, etc. Again, test, test, test. The more testing you do up front, the better you will be able to perform come race day.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.