Octabot

I have my Octabot rover working pretty well now, with the new IRPD sensor. I get all the right detections at the right times, so have been able to create some softwre for Octabot. I have fixed all the oscillation problems, got the servos properly centered, and created what I believe are some very good behaviors to go with the IRPD.

My software is very loosely based on a program called scirpd01.bas I found in the download section here. I threw out most of the code from that program, except some definitions and part of the IRPD check routine (which had a bug I had to fix so it would work). All the code that is used in more than or that can be reused in other programs has been put into subroutines.

I’ve incorporated Jim’s modification into the IRPD_Check routine and made the software very tunable to individual robots or operator preferences by using several defined constants. With this software, you don’t have to worry about which direction each motor is turning - just use the nornal values for everything like speed, etc. I’ve adjusted for the motor directions within the software.

I don’t know if this software will work with the Lynxmotion 4WD rovers or not though since I have no way to test that. If anyone has a 4WD rover, I’d be interested in having them test this software with it and in any modifications that had to be made to get it to work.

All in all, I am pretty darn happy with how my Octabot works with my software. Considering the only sensor it has right now is the IRPD, it does pretty good at avoiding things, including my cat. My cat follows Octabot around a lot and wants to play with it.

I have completed version 1.00 of the software and am working on the next version now, which will be mostly behavior tweaks.

8-Dale

Hey Dale, go ahead and post the program here. :smiley: I’m sure there is interest, heck I’m interested in seeing it.

Aye aye! Here it be, for you and all to check out. For the 4DW Rovers, it would have to be modified to work with the Scorpion motor controller.

[code]’*************************************************************************************
’ Program: diff-drive+irpd.bas

’ Author: Dale Weber [email protected]
’ Web: The Dynaplex Network - http://www.thedynaplex.org
’ Date: 22-Oct-2006
’ Version: 1.0.0
’ IDE: 2.2.1.1

’ Purpose: To allow a two wheeled differential drive robot, such as
’ the BOE-Bot or similar robots, to avoid obstacles using the
’ IRPD (Infra Red Proximity Detector) sensor.

’ This program is very tunable to a specific robot without
’ modifying any of the actual code. At this time, no other sensors are
’ in use.

’ Hardware: Octabot II Robot Kit from Budget Robotics (http://www.budgetrobotics.com)
’ Pair of Large Moon Buggy Wheels from Budget Robotics
’ Lynxmotion Atom Bot Board
’ Lynxmotion SES Electronics Carrier
’ Basic Atom 28 Pin Microcontroller (NOT the Pro)
’ Lynxmotion IRPD sensor
’ 7.2V 2800 mAH NiMH Battery Pack

'**************************************************************************************
’ For sound output
speaker con p9
dur con 75 ’ Note Duration
note1 con 750
note2 con 2000
note3 con 4000
note4 con 2000

’ Motor Stuff
leftm con p0 ’ Left Motor I/O pin assignment
lefta con 0 ’ Left Motor Speed Adustment
leftd con -1 ’ Left Motor Direction

rightm con p1 ’ Right Motor I/O pin assignment
righta con 0 ’ Right Motor Speed Adustment
rightd con 1 ’ Right Motor Direction

revdir con -1 ’ To easily reverse direction

’ Servo Control
normspeed con 1100 ’ Normal Speed
actionspd con 0 ’ Action speed Adjustment - obstacle is detected

backupreps con 10 ’ Backup Repetitions
turnreps con 4 ’ Turn Repetitions
normreps con 1 ’ Normal Repetitions

’ IRPD Stuff
rights con p12 'Change pin number to pin you are using for your right led Voilet wire
lefts con p13 'Change pin number to pin you are using for your left led Blue wire
sensor var in14 'Change pin number to pin you are using for your sensor Yellow wire

templ var bit ’ Left sensor status
tempr var bit ’ Right sensor status
left var sword
right var sword

detected var word ’ 0 = Nothing detected, 1 = Left Side Hit, 2 = Right Side Hit, 3 = Center Hit

turncnt var byte ’ Counts how many times the robot has turned after detecting an obstacle
loop var nib ’ General for next loop counter
'========================================================================
'========================================================================
turncnt = 0


’ Main Loop

while 1 ’ Loop forever or until reset/powered off
servo leftm, (normspeed + lefta) * leftd, normreps
servo rightm, (normspeed + righta) * rightd, normreps

gosub Check_IRPD

branch detected, [New_Cycle, Hit_Left, Hit_Right, Hit_Center]

goto New_Cycle	

Hit_Left:
while detected <> 0
gosub Rotate_Right

	gosub Check_Turns
			
	gosub Check_IRPD
wend

goto New_Cycle

Hit_Right:
while detected <> 0
gosub Rotate_Left

	gosub Check_Turns
	
	gosub Check_IRPD
wend

goto New_Cycle

Hit_Center:
while detected <> 0
’ Backup some
gosub Backup

	if detected = 1 then
		gosub Rotate_Right
	elseif detected >= 2
		gosub Rotate_Left
	endif
	
	gosub Check_IRPD
wend

New_Cycle:
wend

’ End Main Loop

Rotate_Right:
servo leftm, (normspeed + actionspd + lefta) * leftd, turnreps
servo rightm, (normspeed + actionspd + righta) * rightd * revdir, turnreps
return

Rotate_Left:
servo leftm, (normspeed + actionspd + lefta) * leftd * revdir, turnreps
servo rightm, (normspeed + actionspd + righta) * rightd, turnreps
return

Backup:
for loop = 1 to backupreps
servo leftm, (normspeed + actionspd + lefta) * leftd * revdir, normreps
servo rightm, (normspeed + actionspd + righta) * rightd * revdir, normreps
next

return

Check_IRPD
’ Check the Left IR Emitter
for loop = 1 to 4
high lefts
pause 1
low leftò
pause 1
next

high lefís
pause 1
templ = sensor
low lefts
pause 1

' Cheëk the Right IR Emitter	
for loop = 1 to 4
	high rights
	pause 1
	low rights
	pause 1
next

high rights
pause 1
tempr = sensor
low rights
pause 1

' Set Obstacle Detection Flag
detected = 0
 
if templ = 0 then
	detected = detected + 1
	sound speakeò,[dur\note1,dur\note2,dur\ngte3]
endif

if tempr 4 0 then
	detected = detected ¢ 2
	sound speaker,[dur\noõe3,dur\note2,dur\note1]
eædif

return

Check_Turns&²58;
turncnt = turncnt + 1

if turncnt > 2 then
gosub9Backup
gosub Backup
turncÿt = 0
endif

if detected ¥ 1 then
	gosub Rotate_Right

€ gosub Rotate_Right
else
gîsub Rotate_Left
gosub RotateÞLeft
endif

return

end
.code]

Well, the{e it is. I am busily working ov the next version, but I do not©expect to be making any major céanges.

8-Dale

I’ve been doing a lot of work on v1.1.0 and am pretty happy with the results so far.

Now Octabot will gradually ramp down its speed when it detects an obstacle and gradually ramp speed back up each time ite successfully moves forward (without detecting any obstacles). Now Octabot manuvers much better in tighter areas, such as corners and narrower corridors.

Everything is easily tweakable by setting constants and potentially controllable by the robot now with variables. This includes current speed, turn rate, and backup speed.

I have only given Octabot control of its current forward speed so far. I am still doing a bit of tweaking on constants and such, but other than that this version is very close to release.

The only time Octabot really gets hung up now is with obstacles outside the range of its IRPD, or when it gets its wheels caught on something. The IRPD is 1 1/2" above the floor, facing forward. I am anxious to add a few more sensors.

I could add bumper switches, but I am going for a 100% electronic sensor based solution. This will probably consist of adding two IR sensors at an angle from and at the same level as the IRPD so they cover the current blind spots in front of the wheels.

I may also add an IRPD to the back of Octabot so my cat can’t sneak up on it anymore. :slight_smile: My cat seems to have decided Octabot is her newest toy, so counter measures are needed. :smiley:

I never would have thought a little two wheeled rover could be so fun and interesting to work with, until I started working with Octabot.

I’d love for others with rovers to try out this new software when I release it.

8-Dale

This is version 1.1.0 of my software for the Octabot and other similar BOE-Bot type robots. I’d love to hear how it works with a 4WD1 after modifying it to work with the Scorpion motor controller.

[code]
'*************************************************************************************
’ Program: diff-drive+irpd.bas

’ Author: Dale Weber [email protected]
’ Web: The Dynaplex Network - http://www.thedynaplex.org
’ Date: 26-Oct-2006
’ Version: 1.1.0
’ Atom IDE: 2.2.1.1

’ New: The robot now has control of motor speed and ramps up or down as required to
’ better navigate through its environment.

’ Turns are approximately 22 or 45 degrees.

’ If the robot detects an obstacle, it will reduce its speed slightly (down to
’ minspeed), so it will move slower in tighter spaces or places where there are a
’ lot of obstacles.

’ Each time it moves forward successfully, the robot will increase its speed,
’ slightly, up to maxspeed.

’ Purpose: To allow a two wheeled differential drive robot, such as
’ the BOE-Bot or similar robots, to avoid obstacles using the
’ IRPD (Infra Red Proximity Detector) sensor.

’ This program is very tunable to a specific robot without
’ modifying any of the actual code. At this time, no other sensors are
’ in use.

’ Hardware: Octabot II Robot Kit from Budget Robotics (http://www.budgetrobotics.com)
’ Pair of Large Moon Buggy Wheels from Budget Robotics
’ Lynxmotion Atom Bot Board (http://www.lynxmotion.com)
’ Lynxmotion SES Electronics Carrier
’ Basic Atom 28 Pin Microcontroller (NOT the Pro)
’ Lynxmotion IRPD sensor
’ 7.2V 2800 mAH NiMH Battery Pack

'**************************************************************************************
’ For sound output
speaker con p9
dur con 75 ’ Note Duration
note1 con 250
note2 con 2000
note3 con 4500
note4 con 2000

’ Motor Stuff
leftm con p9 ’ Left Motor I/O pin assignment
lefta con 0 ’ Left Motor Speed Adustment
leftd con -1 ’ Left Motor Direction

rightm con p10 ’ Right Motor I/O pin assignment
righta con 0 ’ Right Motor Speed Adustment
rightd con 1 ’ Right Motor Direction

revdir con -1 ’ To easily reverse direction

’ Servo Control (SERVO command)
forwardreps con 1 ’ Forward movement repetitions
backupreps con 10 ’ Backup Repetitions
turnreps con 3 ’ Turn Repetitions
normreps con 1 ’ Normal Repetitions

maxspeed con 1100 ’ Maximum Speed limit on currspeed
minspeed con 0 ’ Minimum Speed limit on currspeed
backspeed con 100 ’ Backup (Reverse) speed
normspeed con 700 ’ Normal Speed (currspeed)
turnspeed con 100 ’ Turning speed

’ IRPD Stuff
rights con p12 ’ Change pin number to pin you are using for your right led Voilet wire
lefts con p13 ’ Change pin number to pin you are using for your left led Blue wire
sensor var in14 ’ Change pin number to pin you are using for your sensor Yellow wire

templ var bit ’ Left sensor status
tempr var bit ’ Right sensor status

detected var word ’ 0 = Nothing detected, 1 = Left Side Hit, 2 = Right Side Hit, 3 = Center Hit

turnrate con 100 ’ Current turn speed
currspeed var word ’ Current Speed
currmove var byte ’ Current number of forward movement repetitions
currturn var byte ’ Current number of turn repetitions
reps var byte ’ How many repitions to do now

turncnt var byte ’ Counts how many times the robot has turned after detecting an obstacle

rampup con 10 ’ Speed increase increment
rampdown con 75 ’ Speed decrease increment

loop var word ’ General looping counters
loop2 var word
'========================================================================
'========================================================================
pause 2000

’ Initialize

turncnt = 0

currspeed = minspeed
currmove = normreps
currturn = normreps
reps = 1


’ Main Loop

while 1 ’ Loop forever or until reset/powered off
gosub Move_Forward

gosub Check_IRPD

Detect_Change:
branch detected, [New_Cycle, Hit_Left, Hit_Right, Hit_Center]

goto New_Cycle	

Hit_Left:
while detected = 1
gosub Rotate_Right_22

	gosub Check_Turns
			
	gosub Check_IRPD
wend

if detected and detected <> 1 then
	goto Detect_Change
else
	goto New_Cycle
endif

Hit_Right:
while detected = 2
gosub Rotate_Left_22

	gosub Check_Turns
	
	gosub Check_IRPD
wend

if detected and detected <> 2 then
	goto Detect_Change
else	
	goto New_Cycle
endif

Hit_Center:
while detected <> 0
’ Backup some
gosub Backup

	gosub Check_IRPD

	if detected = 1 then
		gosub Rotate_Right_22
	elseif detected >= 2
		gosub Rotate_Left_22
	endif
wend

New_Cycle:
wend

’ End Main Loop

Rotate_Right:
for loop = 1 to turnreps
servo leftm, (turnrate + lefta) * leftd, normreps
servo rightm, (turnrate + righta) * rightd * revdir, normreps
next

return

Rotate_Left:
for loop = 1 to turnreps
servo leftm, (turnrate + lefta) * leftd * revdir, normreps
servo rightm, (turnrate + righta) * rightd, normreps
next

return

Move_Forward:
for loop = 1 to forwardreps
servo leftm, (currspeed + lefta) * leftd, currmove
servo rightm, (currspeed + righta) * rightd, currmove
next

' Speed up a little each time we successfully move forward
currspeed = (currspeed + rampup) max maxspeed

return

Backup:
for loop = 1 to backupreps
servo leftm, (backspeed + lefta) * leftd * revdir, currmove
servo rightm, (backspeed + righta) * rightd * revdir, currmove

	' Slow down a bit
	currspeed = (currspeed - rampdown) min minspeed
next

return

Check_IRPD
’ Check the Left IR Emitter
for loop = 1 to 4
high lefts
pause 1
low lefts
pause 1
next

high lefts
pause 1
templ = sensor
low lefts
pause 1

' Check the Right IR Emitter	
for loop = 1 to 4
	high rights
	pause 1
	low rights
	pause 1
next

high rights
pause 1
tempr = sensor
low rights
pause 1

' Set Obstacle Detection Flag
detected = 0
 
if templ = 0 then
	detected = detected + 1
	sound speaker,[dur\note1,dur\note2,dur\note3]
endif

if tempr = 0 then
	detected = detected + 2
	sound speaker,[dur\note3,dur\note2,dur\note1]
endif

if detected then	' Slow down a bit each time we detect an obstacle
	currspeed = (currspeed - rampdown) min minspeed
endif

return

Check_Turns:
turncnt = turncnt + 1

if turncnt > 1 then
	gosub Backup
	turncnt = 0
endif

if detected = 1 then		' Detectøon on left side
	gosub RotateÞRight_22
elseif detected = 2

I have placed 5 videos of Octabot on my website, for your viewing pleasure. Check them all out in Octabot’s section of my Robotics area.

8-Dale

It’s nice! congratulation, when are you going to put the legs?

Thanks!

I am not sure I am going to put a full set of 8 legs on Octabot now. I may put a couple on it for testing so I can see if the leg(s) work well, but I think I wull leave Octabot pretty much as a rover otherwise.

I am actually having quite a lot of fun with Octabot as a rover. :smiley:

In fact, other than a slight additional software upgrade to 1.1.1, I doubt I will do any more development with Octabot until I add the pan/tilt platform to it with an IR ranging sensor. It will take me awhile to develope the pan/tilt platform the way I want to do it - with at least 4 sensors, a camera for visual tracking, and a compass module. The pan/tilt will take Octabot to v2.x. :smiley:

Here is how Octabot will look with the new pan/tilt platform:

http://www.thedynaplex.org/robotics/octabot/img/octabot-cad.jpg

8-Dale

I am now working on v1.2.0 of the software, which has a new behavior implemented - scanning. I am working on this in preparation for adding the pan/tilt platform.

Octabot now has the capability of switching between the normal and scanning behaviors at will, but this has not yet been implemented.

Octabot will now scan for a clear path when it detects an obstacle. It now has a real behavior for center detections for normal and scanning behaviors. The robot now remembers its last detection status and bases its response to a center detection on this.

I have found a way to simplify the code somewhat and will be rippling this through the normal behavior code after I have the scanning behavior completed, which is almost done.

8-Dale

I have completed and released software v1.2.0 which has full scanning and normal mode behaviors implemented. The robot now switches into scanning mode when it detects an obstacle and back into normal movement mode when it no longer detects anything. This will be the final software release for IRPD only usage.

The next software release will include behaviors for two additional sensors - full IR Ranging capability. The new sensors will be mounted at an angle from and at each side of the IRPD. These will cover the blind spots Octabot currently has around each wheel due to the added width.

8-Dale

I have some videos of Octabot on YouTube, and there will probably be more later. There are more videos on my website in the Octabot section.

Octabot v1.5, Software v1.1.0
The Robot and the Pussycat
Octabot is At it Again
Scanning Behavior v1.2.0

8-Dale

One of the ladies where I live has given Octabot a new name because she says it needs an intellectual sounding name. So, she has named it W.A.L.T.E.R.

I came up with this:

W heeled
A utonomous
L earning
T errain
E xploring
R over

8-Dale

I was not going to do this, but I got bored… So, I have released v1.3.0 of my rover software! It’s up on my website for download now. I have given the robot control over its turn size, so it will turn in increments of approximately 4 degrees and increase or decrease this as required for its current location in its environment.

With this release, the robot has total control of all its movement parameters. This is all working better than I thought it would. I have removed several routines that are no longer needed, such as the ones that do specific turns like 12 and 22 degrees, etc. I have kept the 45, 90, and 180 degree turn routines for future use.

If I only could pass parameters to subroutines I could do a bit more. I may keep the 45, 90, and 180 degree rotate routines for when I add an IRPD to the back of the robot, so it can swing around to see what has come up behind it (like my cat, for instance). The 45 and 90 degree turns could come in handy at times also.

Walter is getting to be quite the smart little robot now, and with just one sensor. :smiley: Imagine how smart it will be after I upgrade it with the parts I get today… :smiley:

With software v1.3.0, Walter has gone into areas enclosed on three sides and successfully navigated its way back out into the open. :smiley:

8-Dale