Let's Make Robots!

Wall Following RC car using 16F887

Here are two videos of my hobby level radio control car following the wall around a room.  This car uses channel 3 of the radio control system to toggle between RC control and autonomous control.

http://video.yahoo.com/watch/7184507/18716445

http://video.yahoo.com/watch/7169550/18673820

The idea is to hook middle school kids (USA grades 7th and 8th.  ages 11 - 14) into Science, Technology, Engineering and Math.  This offers the speed and excitement of RC car
 racing, the trial and error of RC race car design plus the clear thinking and discipline of computer programming.

 
 THE COMPETITION:  A car race.

 Build an oval race track on a polished wooden gymnasium floor defined on the inside by
 cardboard boxes large enough to echo back a SRF05 sonar proximity detector's signal.

 The race is to lap the track, say, six times;  three by radio control;  three by autonomous control.  Either time trials or multiple cars at the same time.  If the race has multiple cars on the track at one time, some more work must be done on the car to avoid collision.

  I will design and build a PIC kit that attaches to almost any RC car that has Electronic Speed Control (ESC) driving the wheels and a servo driven steering mechanism.  It will use the car's 7+ volt battery, knocked down to 5 volts by the ESC.  There must be a third channel on the RC system to tell the car who is boss.

 I need to borrow, steal, or design a microcontroller programming language that forces the students to think about the signals from the front and side facing sonars and create the corresponding commands to the wheels and the steering.  Presently the 16F887 compiler runs on a WINDOWS PC and communicates to the car via special hardware connected to the USB port.  (Available from MicroChip Inc.)

----------The post below seems to be way ahead of me----------

Author: bendjamin
| Title: I made some similar robots a

I made some similar robots a while ago.  I'll try and post a video of them.  They are designed to race around a track, in other words they are doing wall avoiding so when you make a track with walls on the inside and outside they will go around and around.  I made the robots myself, they are differential steering with a body made from laser cut polycarbonate.  I used the sharp IR rangefinders for navigation and have four on each robot, two forward facing and two side facing. They also have four bumber switches, one pair in front and the other at the rear.

| Link: http://letsmakerobots.com/node/696#comment-43464

What do you all think?

 Ken

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

"Tuning the distance parameter like in your video is a recurring task in most navigation algorithms. No amount of planning, designing, modelling of simulating can do that for you. That single number has to be determined in field tests."

I know nothing of navigation algorithms.  I know nothing of control theory.  I do know that velocity is a differential.  It would seem that the micro has to calculate velocity as part of the robo feed back loop.  Any suggestions for PIC and code?  My guess is my 16F887 is sufficient, but I need C with libraries just to help me be organized.

Your suggestions please.

Ken

Tenacious thread this one. Good on you Ken!

I cannot offer you help with your specific language, but I can always brainstorm with you about the generic concepts. You are right in saying that velocity is a differential (of position or distance in time). But are your sensors giving you distance and time? Or is your encoder directly giving you speed?

I may also have suggested that the "danger threshold" for "distance to obstacle" can be speed dependent. The faster you go, the earlier you need to start braking and/or turning. But before I start rambling, you had better state which specific department you need help in.

Talking Speed is the problem....

I need help figuring how to control a robocar at speed. Simply said:

The MODEL level car has proportional control. I preset the max velocity with a POT. I need a robo system that can figure out when to turn given the speed and the distance of oncoming obstacles.

The TOY level cars have only bang-bang controls. Their tires are plastic. They slide and skid. The 1/12 scale car is slow enough for simple sonar distance threshold control. Boring!! The 1/10 scale car is a big fast colorful device: spectacular and fun! With size and speed comes momentum. I need to get better control of the steering (current drivers instead of DPDT relays?) and an algorithm to implement that control.

Any ideas?

Ken

No success at speed....

I took the car to an old gymnasium this morning. I had adjusted the "frontfree" distance from four feet to five feet.
That's the proximity response from the front sonars which triggers the code to turn sharply left.
I left the potentiometer at the speed that was too fast for my garage. In the gym it negotiated the corners fine, but could not hug the wall.

I may need to recalibrate the steering, but more likely I need to restructure the wall hugging code.

Here's a link to the code I am presently running. The only difference between the toy car code and the model car code is the servo and DC motor driving commands. For the model code I use the HPWM PicBasic command. For the toy level I command certain pins to be HIGH or LOW.

http://www.employees.org/~kjones/HPI2_left_SyRen02.htm

Ken

I think the model level car is getting close to understandable.  Not so the toy.  This video shows one under control, not the other.

http://www.youtube.com/watch?v=Emsf46WpctI

One more step for the model level - get it up more to speed.  This needs a bigger room.  I've got that, but it needs cleaning.  The toy level needs my understanding of the servo that drives the steering.  Presently the can does not easily go straight, just left or right.  I will clean up and post my code.

Ken

I just posted

http://www.youtube.com/watch?v=oQqVkef0DTs

It is not good.  This has been frustrating.  You can hear the car spin its wheels on the cement floor.  I've not been able to get it to follow the wall.  It turns too far when making what should be small adjustments.  Could be my code.  I'll share it if you want.

On the plus side this car cost $50 retail.  It is light and very rebust - as you can see.  All my solderless kit easily fit underneath the plastic shell with holes for the sonar sensors.

It does seem that the model level car with the POT to adjust the speed is the way to go.

Ken

The videos help a lot. Let me ask you something. How well does that car manage the turns on the track you are using if you are controlling it yourself via RC? The reason I ask is, the track area seems small in comparison to the car. If you can't manage to drive the car successfully yourself under your track conditions, then maybe you need a bigger track.

Slowing the speed way down may help too, if you can find a way to do it.

By all means, post your code. I'm not a PIC programmer so I may not be able to help too much, but maybe someone else on the site can.

The model level car is too expensive for middle school use.  As fritsl warned me way back, it seems to be too fast for my level of software and SF05 sonar sensing.  I have found a commercially available electronic speed control that has no 'smarts', but that's $50 added cost to the package. 

The 1/10 size gives me more room under the plastic car body for my solderless protokit plus an extra 4 AA battery package.  This $50 toy car comes with a rechargable 7.2 volt battery.  There is still a mystery.  How can the PIC detect that the RC transmitter is turned on?  I do not know enough about radio receiver electronics to decode the car's original printed circuit card. If I could figure that out I could toggle between PIC control and RC control.  Presently turning on the transmitter with the trigger in a particular position stops the car in its tracks, but does not toggle to RC control.

I hope to have a good video soon.

Ken

 

I am making a robotic car from a MJX R/C NISSAN Fairlady.  It contains R002-RX REV01 electronics.
 
I would like my microprocessor (a Microchip 16F887) to detect when the transmitter has been turned on.  With this knowledge it can toggle between microchip control and radio control.
 
I have been looking unsuccessfully for a signal on your R002-RX which activates when the transmitter is turned on.  Does anyone in the forum know anything about this R/C receiver electronics card?
 
Ken

Smile need some new ideas..  Sorry for the repeat, I am still learning.....


Do you all have some creative ideas for things to do with this little car? Right now it follows a wall counter clockwise looking down at a leisurely pace. High speed introduces response time problems. Two sonar proximity sensors can be placed looking anywhere from the car and a pot. controls the top forward speed.  Actually three sonars are available.  Sonars cost ~ $29 each.  PIC's cost $2.20.  Amazing!

I can show you all the code if you like. It is crude, but it works.  PICBASIC PRO.

A thought!  My car, when standing still, can detect motion.  How about a relay race? Pass the baton merely by arriving. I want something simple but exciting.  Something with easy to conceptualize parameters that can be readily changed in PICBASIC.  I would like for the kids to see the code as LOGO, but I have no access to that language.

The LEDs on the sonars are almost steadily illuminated.  The ping rate is many many per second.  Yet the car seems to react slowly.  I do not know why.

Ken