Page 1 of 1

Self driving RC car

Posted: Sun Dec 04, 2016 12:42 pm
by MartinP
This is an autonomous vehicle, a small RC car.
I build this for (winning) a competition called robot folkrace, which looks like this:

And the rules (in English): ... SRC_en.pdf

My progress so far:
Bought a small 1/24 scale RC from China. A bounch of sensors and of course a bunch of Maple Minis (so far i killed two of them).
Designed a circuit and PCB in Kicad, along with the sensor array.
I bought a cheap stepper motor driver from China, it's not the best design Ive seen but it allows for a lot more current than a regular L298N.
It looks like this without the shell of the car:

It does actually drive pretty well using minimum viable code:

This saturday I worked more with the code, reusing a FSM (finite state machine) I use with my minisumos (a different kind of robot), and a PID-controller. It runs pretty good. Lets say it crashes into the wall just to show that the FSM is working :D Still a long way to go.

It seems to run perfectly fine even though the use of several doubles (which btw are 8 byte each on the Maple Mini). The sensors are polled every 30 ms, which may seem slow and I will try a shorter interval between the polls.

What needs to be done:
* Tuning the PID
* Serial protocol for Bluetooth communication, to make the PID tuning easier.
* EEPROM read/write/update. I put an EEPROM chip on the board which the Maple Mini communicates with on the I2C bus.
* Higher capacity battery.

What could be done:
* Custom wheels and tires. For lower CG and better traction.

Thats all for now.

Re: Self driving RC car

Posted: Sun Dec 04, 2016 7:00 pm
by zoomx

Which sensors are you using?

Re: Self driving RC car

Posted: Sun Dec 04, 2016 11:05 pm
by MartinP
I use Sharp gp2y0e02b

Re: Self driving RC car

Posted: Tue Dec 06, 2016 7:29 pm
by MartinP
Did some more work on the steering this afternoon.

The Maple can handle a lot of computing! I included a secondary PID to adjust the speed, along with filters for all 7 sensors.
Adjusted the gains for the steering PID, it's finally satisfactory.
In the video the robot runs for 2 minutes and some seconds, I counted to 37 laps. Thats 10 more than sunday.

Next big step is to get the speed PID running good. Then comes object avoidance. Still a long way to go.

Re: Self driving RC car

Posted: Tue Dec 06, 2016 8:06 pm
by RogerClark
how did you destroy the Maple minis?

Is it spikes on the power supply from the motor?

Re: Self driving RC car

Posted: Tue Dec 06, 2016 8:28 pm
by MartinP
One let the smoke out when I plugged in the USB cable (I might had a bit too much current draw on the onboard regulator). I'm not sure what happened to the other one, it's just dead.

Re: Self driving RC car

Posted: Tue Dec 06, 2016 9:53 pm
by RogerClark
Its best not to use the onboard regulator to run too many other things, as often the regulators are not good quality.

I know a lot of people have blown up the regulator on other STM32 boards (like the Blue Pill board), but those boards have very cheap components and the USB connectors often break as well.

Some of the Maple mini's on eBay and AliExpress are factory rejects from the original manufacturer (who is called "Baite")
I think if you buy direct from Baite's store on AliExpress the boards are usually OK as they are not rejects that someone else has tried to fix and then resell.

Re: Self driving RC car

Posted: Wed Dec 07, 2016 8:06 pm
by MartinP
Thanks Roger. Yes it could be that I got some factory rejects because I didn't order them from the Baite store. I'll keep that in mind.