I have not used them, but here is one that is within your measurement range GP2Y0A02YK:
http://sharp-world.com/products/devi...gp2y0a02_e.pdf
One thing that isn't so good, is that you will get a false reading if you are closer than 8 inches.
I have not used them, but here is one that is within your measurement range GP2Y0A02YK:
http://sharp-world.com/products/devi...gp2y0a02_e.pdf
One thing that isn't so good, is that you will get a false reading if you are closer than 8 inches.
Today I took some cardboard boxes to my gymnasium race track. I arranged them in the middle of the floor about six feet from the walls.
The car did not behave as expected. It is futile to try to describe what it did. I shall video tape it (probably not for public consumption) and try to analyze what is happening.
The SRF05 flashing LEDs are constantly illuminated. That should be good.
My present code has only two 'regular' states.
1. Going forward being guided by the side looking SRF05. The forward pings are monitored for something close enough to merit turning hard left while still going forward.
2. Going backward and turning to the right because the front looking pinger sees something too close. The backward state is left by either timing out, or by the forward looking pinger saying that the obstruction is no longer there.
With the car on blocks and me manipulating a large piece of card board, the wheels move true to concept. In the gym was something else.
Interesting stuff, real time control code. I made my living in data communication hardware and software development. Nothing actually 'moved' in the common sense of the word.
Ken
I made this video of my car on my "race track"
As I speed up the car the behavior becomes less consistent.
Take a look see if you like. It's only a couple minutes long and the car does work correctly sometimes.
Ken
I want to use the interrupt system to make my Pulse Width Modulated pulses output at 50hz. I am hoping that will give me finer control of the wheel speed and maybe a quicker steering response.
I understand that I need to preset TMR1 with a number so that it rolls over every 20 ms. thereby triggering the interrupt. How do I figure out what that preset number should be and how do I set it using PBP?
Ken
Looking at the datasheet:
With a 4MHz clock, (TMR1H:TMR1L) increments every 1uS. To generate an interrupt every 20mS, you want it to count 20,000 - so preload (TMR1H:TMR1L) with 65535-20000 = 45535 or FFFFh-4E20h=B1DFh.6.7 Timer1 Interrupt
The Timer1 register pair (TMR1H:TMR1L) increments
to FFFFh and rolls over to 0000h. When Timer1 rolls
over, the Timer1 interrupt flag bit of the PIR1 register is
set. To enable the interrupt on rollover, you must set
these bits:
• TMR1ON bit of the T1CON register
• TMR1IE bit of the PIE1 register
• PEIE bit of the INTCON register
• GIE bit of the INTCON register
The interrupt is cleared by clearing the TMR1IF bit in
the Interrupt Service Routine.
I think a big part of my problem is peripheral vision (hearing) of the front
sensors. As the car sped up I had to increase the frontdanger threshold. Now if the car gets turned a little to the left while running down the straight
it 'sees' the cardboard and turns left thinking that it is coming to the
corner. Solutions?
The simple one is to place the cardboard further away from the side wall.
I could rewrite the code so that hard turning left only is allowed when close to the side wall. Trouble with that is if the car ever got free in a room it would crash straight into walls.
I could add left side SRF05's. That would make staying in the middle of the lane easier and minimize the effect of peripheral hearing.
What do you all think?
Ken
I have added a left looking SRF05. This gives the car great new autonomous potential. I shall stick to the first problem first. Disappear behind a card board wall and come out the other end at speed.
My first thought is to stick to the path half way between the solid wall and the card board wall using the right and left sensors for guidance. If I can keep the car pretty much following that line without oscillating then once the front echo says, "DANGER", the car will know that it must be approaching a corner.
Algorithm suggestions are welcome.
Ken
I wonder if something like this could be made to work for you?
http://www.picbasic.co.uk/forum/showthread.php?t=7393
or
http://www.picbasic.co.uk/forum/cont...gle-Modulation)
Dave
Always wear safety glasses while programming.
Bookmarks