How to build your first robot - Part II - navigation

About the led lights at the bottom
What are the yellow and red LED lights are for at the bottom? thank you. this one is awesome

LED skids
The red and yellow LEDs are used to slide on only. It might be cool to connect them to have them light up as the robot moves, nut they have no use other than as a slide.

LOL, I was really scratching

LOL, I was really scratching my head, like WTF? Yellow LED? There is no such?!?

Uh yes, as always robologist is right: Look here for inspiration: https://www.robotshop.com/letsmakerobots/node/2112

LOL ^ ^

I knew that too i was even fighting with a friend and was pretty sure it was used as a slide or a caster so it would not move like the robot on part 1 and look like it needs more balance but to be sure, I asked.

Gosh that was a pretty dumb question. ^ ^

Voltage

uhm frits…u used 6v as a power supply right?4 AA batteries? doesnt that fry the picaxe and srf05? what if i was to add 2 LEDs and 1 superbright LED…im kinda scared i might fry the board…

 

I use rechargables, they are

I use rechargables, they are not 1.5V, perhaps 1.2V, so it’s close to 5V, all is cool with Picaxe & SRF :slight_smile:

On LED’s I usually insert one 330 Ohm resistor… but apart from that I have no clue, I burn them all the time, or they are dim because I feed them too litle, don’t ask me about electronics :wink:

Fried pins

Frits-Is it possible to fry just the pins on a chip? I cant get pins 1-3 to work at all ive built a very similar robot to yours and used your exact code with slight modifications but i cant even get a servo to work on Digi out pins 1-3?

It may be possible, but I

It may be possible, but I have never done it. And I have always ben very rude to my chips. They never took any offence, as far as I knw, a Picaxe is very hard to fry!

I am pretty sure you will find the error somewhere else, check one thing at a time, make sure it works…

A little help with your code…

Hey Frits,

I am reworking your code here and noticed something I don’t understand… This is in the “Tester” chunk of the code.

gosub puls
if range < Danger and head > ForwardLeft and head < ForwardRight then
GOSUB AFTERTURN
gosub PHASEA2
end if

if range > ClearPathAhead and head > ForwardRight and head <= 225 then
GOSUB AFTERTURN
gosub PHASEA2
end if

if range > ClearPathAhead and head < ForwardLeft and head >= 75 then
GOSUB AFTERTURN
gosub PHASEA2
end if

it seems like no matter what the sonar is sending back, you are still heading back to the Driveahead subroutine (by way of afterturn). I.e. if range is < danger and the head is basically centered, you still go fwd. Or if you have “clearpathahead” and the head is to either side you still go fwd. After that you go back to phasea2 which makes sense, I just don’t get the fwd part. Did you include this just so you could add a “totalhalt” if you wanted? Explain this if you would.

You evil person!You are

You evil person!

You are asking me to justify / explain code I made one year ago!?

Heck. This take s a second reply.

Hey, Chris,Just a note

Hey, Chris,

Just a note before I answer your question:

Have you seen how the bot @ https://www.robotshop.com/letsmakerobots/node/5751 is navigating?

I think this is way more walter-style! Check the moves, the personality in the slowing down, reversing etc…

You are having such nice PWM-options, so even though I use servos, you should be able to copy what I did.

Also, I know it’s an omni wheeler that I made, but 2 wheels and a tail would be the same, code-wise, I only work with 2 “axles”.

That code is much smaller, more recent, the next thing… You just need 2 sensors - static - to make it work. And with your wide front, also one to clear the front… which is walters head!

With the old code you are on here, you would need to shake he’s head so violently, not nice!

 

https://www.robotshop.com/letsmakerobots/node/5751 to control the basics, and he’s head to add in with extra is what I’d go for!

The answer:Hey Chris, I have

The answer:

Hey Chris, I have looked at the code and your question.

Yes, aparently it is strange. Yes, perhaps it is a leftover from some debugging. And yes, sometimes I make strange code, because I think it is fun to make something that is not really logic at first sight, but when diving into it, it is pure logic. Sort of like easter eggs.

Weather this one is a bug, a debuging option, or an easter egg, I really cannot tell, as my brain only allows me to look at old stuff in a very limited time - it simply halts and start inventing new, so I cannot go deeper into it, sorry.

Have you seen the new omni-code? It is cool!

Hey Frits --I figured it out!!
I added some sharp sensors (in the “add extra stuff here” section and quickly found why you are looping back to the driveahead code… It seems that once the sharps were triggered (I was using them for side sensors) the robot would be stuck in a loop and just keep sliding the direction it was triggered!! The “goto driveahead” loopie-loop is to stop any turns from locking on. I added a gosub afterturn to my sharp sensor code and they worked great! So there you go. To be honest, yes I am working on some new autodrive code for walter but I am not cutting a pasting your stuff. I was just sorta “reverse engineering” it to see if what you did is any better than what I got. What I found is that we pretty much wrote the same code with just a few tiny differences. I’ll check out the other code you suggest – I am trying to write not only some very smooth code, but also trying to be a gentle as I can on my motor driver so I am going through as much drive code as I can to find all the good parts! --Thanks dude.

BTW…

Forget about Walter swinging his head… I played with the "top of the head" mounted sonar and quickly found it was WAY to high off the ground to be any good. I have pulled the SRF005 and relocated it to the underside of the chassis on a servo in the standard way. I added 2 sharps in the corners to catch walls parallel to travel and so far this seems to be a solid set-up.

Word

Word, I wonder what is going

Word, I wonder what is going to pop up from W’s head then?

I’ll donate you a laser pointer as replacement :)?

gosub puls error

Hi fritsl,

I’ve just download the ‘clean_navigation.bas’ file on this page. When i use ‘simulate’ on the editor programme it comes up with the error =

 

gosub puls
^

Error: Only 16 gosub commands allowed!

 

Is this something I’ve done or is it something that doesn’t affect the running of the program?

 

Also when I downloaded the program it came down as a .BAS.txt file so had to copy/paste into a new basic file.

 

You should set up your

You should set up your Picaxe to 256 gosubs or something. It is done in the Options or something :slight_smile:

(I am not on a PC with the editor installed here)

wow!

cool!!

In Fact, This Is My First Time Here…

I Gonna Build My First Robot.

But How Can I Control The Robot By Voice…ex( Go And Turn Right…)ty all

Good luck. That would
Good luck. That would require you to either spend a ton of cash on something that can do voice recognition or be very smart to make it yourself.

Check this builder
Here is someone with experience in voice recognition. Haven’t seen him around lately. But all of his projects are worthy of your attention.