Boe-bot for The Chair Challenge II

Find out my new project here.

Hope it respect all parameters in the challenge:

"The Chair Challenge!"

Requirements:

  1. Robot can be placed in any position and place operator prefers before start
  2. Robot must then spin around it´s own center at least 10 times before step 3. (so we know it is actually navigating on it´s own)
  3. Now the robot should try to drive around each of the 4 legs of a chair, like the orange arrow

 

  • Result:
  1. Robot was placed at the chair left side, in it direction.
  2. The robot spins 10 times over itself before start the task.
  3. The robot drives around each of the 4 legs, like the orange arrow.

  • Picts:

  • Code:

"The Chair Challenge!"

Requirements:

  1. Robot can be placed in any position and place operator prefers before start
  2. Robot must then spin around it´s own center at least 10 times before step 3. (so we know it is actually navigating on it´s own)
  3. Now the robot should try to drive around each of the 4 legs of a chair, like the orange arrow

 

  • Result:
  1. Robot was placed at the chair left side, in it direction.
  2. The robot spins 10 times over itself before start the task.
  3. The robot drives around each of the 4 legs, like the orange arrow.

  • Code:

'(I know it is not that cute.. it may be simplified, but i was afraid of gaping time to finish the task, since I'm with school projects in hands.. maybe I tune it up later)

' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM6}

'---------- VARS ----------'
pulseCount VAR Byte
irdetectleft VAR Bit
irdetectrigth VAR Bit
fase VAR Byte
'---------- TEST ----------'


'---------- START ----------'
GOSUB Spin '5 Spins on it own center
GOSUB Spin '5 Spins on it own center
fase = 0
'--------- MAIN CODE ---------'
DO
FREQOUT 8,1,39500 'activate IR
irdetectleft=IN9
FREQOUT 2,1,39500 'activate IR
irdetectrigth = IN0
'-- states machine --'
SELECT fase 'find beguin position
CASE 0
IF (irdetectleft=0) AND (irdetectrigth=0) THEN
fase = fase + 1
LOW 1
ELSEIF (irdetectrigth=0)THEN
GOSUB Slow_Spin
HIGH 1
ELSE
GOSUB Soft_Spin
ENDIF

CASE 1 'turn around the first chair leg
GOSUB Slow_Around_Leg
HIGH 1
GOSUB Forward
GOSUB Around_Leg_Large
GOSUB Forward
GOSUB Slow_Around_Leg
GOSUB Slow_Around_Leg
GOSUB Slow_Around_Leg
LOW 1
fase = fase + 1

CASE 2 'find and sping on the 2nd leg
IF (irdetectleft=0) AND (irdetectrigth=0) THEN
GOSUB Slow_Around_Leg
HIGH 1
GOSUB Forward
GOSUB Around_Leg
'GOSUB Forward
LOW 1
fase = fase + 1
ELSEIF (irdetectrigth=0)THEN
HIGH 1
GOSUB Slow_Forward
ELSE
HIGH 1
GOSUB Slow_Forward
ENDIF

CASE 3 'find and sping on the 3rd leg
IF (irdetectleft=0) AND (irdetectrigth=0) THEN
GOSUB Slow_Around_Leg
HIGH 1
GOSUB Forward
GOSUB Around_Leg
GOSUB Forward
GOSUB Slow_Around_Leg
LOW 1
fase = fase + 1
ELSEIF (irdetectrigth=0)THEN
GOSUB Slow_Forward
ELSE
GOSUB Slow_Forward
ENDIF

CASE 4 'find and sping on the 4th leg
IF (irdetectleft=0) AND (irdetectrigth=0) THEN
GOSUB Slow_Around_Leg
HIGH 1
GOSUB Forward
GOSUB Around_Leg_Large
GOSUB Slow_Around_Leg
GOSUB Slow_Around_Leg
GOSUB Slow_Around_Leg
GOSUB Forward
LOW 1
fase = fase + 1
ELSEIF (irdetectrigth=0)THEN
HIGH 1
GOSUB Slow_Forward
ELSE
HIGH 1
GOSUB Slow_Forward
ENDIF


CASE ELSE 'stop at end of task
DO
GOSUB Stay
LOOP
ENDSELECT
LOOP
'---------- SPIN ----------'
Spin:
FOR pulseCount = 0 TO 255
PULSOUT 13,850
PULSOUT 12,850
PAUSE 45
NEXT
RETURN
Soft_Spin:
FOR pulseCount = 0 TO 10
PULSOUT 13,770
PULSOUT 12, 770
PAUSE 45
NEXT
RETURN
Slow_Spin:
FOR pulseCount = 0 TO 5
PULSOUT 13,755
PULSOUT 12,755
PAUSE 45
NEXT
RETURN
'---------- BASIC ----------'
Stay:
FOR pulseCount = 0 TO 255
PULSOUT 13,750
PULSOUT 12,750
PAUSE 45
NEXT
RETURN
Forward:
FOR pulseCount = 0 TO 40
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Slow_Forward:
FOR pulseCount = 0 TO 50
PULSOUT 13, 740
PULSOUT 12, 760
PAUSE 20
NEXT
RETURN
'---------- LEGS ----------'
Around_Leg:
FOR pulseCount = 0 TO 110
PULSOUT 13,735
PULSOUT 12, 850
PAUSE 40
NEXT
RETURN
Around_Leg_Large:
FOR pulseCount = 0 TO 150
PULSOUT 13,735
PULSOUT 12, 850
PAUSE 40
NEXT
RETURN
Slow_Around_Leg:
FOR pulseCount = 0 TO 10
PULSOUT 13,735
PULSOUT 12, 850
PAUSE 40
NEXT
RETURN

 

It complete the requirementes asked in "The Chair Challenge II"

  • Actuators / output devices: 2 servos, led's
  • Control method: autonomous
  • CPU: Basic Stamp 2
  • Power source: 4 AA batteries
  • Programming language: Basic
  • Sensors / input devices: IR
  • Target environment: indoor

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/boe-bot-for-the-chair-challenge-ii

pretty sweet robot you got
pretty sweet robot you got there

Very nice, I’m impressed.

Very nice, I’m impressed. And with a Basic Stamp, too. Technically it only spun around 8 times, not 10, but personally I think it’s clear, especially with the posted code, that you’re actually navigating and not just following a pre-stored path.

I’m surprised and impressed that you were able to do it without wheel encoders or some other way to keep track of where you are. Maybe I should have tried harder with mine :slight_smile:

Dan

Yeah, baby! Must give this a

Yeah, baby! Must give this a closer look when I get the time (pretty soon)!!

/ Fritsl

thanks Sovereign
thanks Sovereign

Thanks for your coment, its

Thanks for your coment, its really positive to hear feedback… specialy when its a good one… hehe

(bad ones are welcome too, i’m always ready to learn with my errors)

 

Yeah… now that u tell i notice that it does only finish the 9º spin but at detection mode already… well sory for that, because of basic stamp only alow me to play with number o cycles, and time per cycle, it depends a bit the speed of servos for the batterys state.

Anyway, i think everyone can see that it uses IR to detect when to to next stage, or stay in that stage trying to find the chair legs to procede :slight_smile:

Code is a bit ugly, but BS doesn’t alow us to much more, since not even can use arguments in the sub-rutines calls.

But its true that can be made with the same algoritme in a easy code if i got time for that.

Anyway… i don’t wanna be specialized in BS, since i’m just migrating to Arduino, and the only reason i used Boe-bot for this is that Arduino structure was not ready for the job yeath. (hope have time to work on it soon =] )

hehe… got a time to finish

hehe… got a time to finish it, now i can go back to my school project over the intel 8051 :slight_smile:

by the way… have anyone worked with this one before? i’m geting crazy with assembly.

I haven’t worked with it,
I haven’t worked with it, but I have a databook on it somewhere and I have often thought of starting to work with it. After all, assembler is fun! What processor from the 8051 family are you using and what development board?

This looks very

This looks very impressive!

Very well done!

I wonder if anyone else out there will match or participate :slight_smile:

/ Fritsl

Thanks, i done my best

Thanks, i done my best considerign the microcontroler and the sensores i was able to use.

I’m still w8ting the Ultrasounds to arrive my house :slight_smile:

Good job!

Good job TigPT, to me it looks like you totally aced the chair challange. Could you upload one more picture that shows where you mounted the sensors? I can’t see any on the pictures so far and neither on the video.

 


We don’t stop playing because we grow old, we grow old because we stop playing.

i can take more fotos, but

i can take more fotos, but in the first foto, the IR led is inside of black can, and the reciver is just behind it.

the resistores are to limite the corrent to the sensors.

Brilliant!
Brilliant!

Thanks for your comment
Thanks for your comment Bryan47

CONGRATIOLATIONS!

You have won the challenge with honor!!

I am very impressed, and I can only say congratulations, well done, A+!

I will contact you for your address so I can mail you the price!

WM

Thanks for the compliments.

Thanks for the compliments,

when i recive them, i will make some robot with this servo controler and this servos to everyone learn how to use it, as i will…

Thanks everyone, and good luck to the next challenge.

If anyone have questions about this robot, just do it, and i will try answer the best i can.

PAUSE QUESTION

good work! i am still trying to do the challenge using picaxe… still struggling on the code. lol. I also have a bs2 and the book said that the servo needs a 20ms pause. why did you use pause 45 and 40 on other part?

One lifetime is too short to learn everything.

20msis the minimu, but if

20msis the minimu, but if you pause more time, you will get the wells spining for more time. (If you pause 2 much, they will stop)

Never more used BS2 since this robot, now i’m only using arduino. (bad that don’t have time to robots lately)

Thanks. for the info. Have
Thanks. for the info. Have you used picaxe. What do you think is better. Im using picaxe now and bs2 is starting to gather dust. How about the cost? Good work on the challenge!

Minimum?
I’ve pulsed RC servos at 13 ms intervals and gotten better torque and seemingly quicker response out of them. I think I heard some RC speed controls will not operate well with a higher pulse rate though, but do not have specifics on which one had the problem.