Showing posts with label swift language. Show all posts
Showing posts with label swift language. Show all posts

Sunday, May 15, 2016

Buddybot gets Obstacle Avoidance

BuddyBot, the first robot programmed in the Swift programming language with SwiftyBones, just got some more upgrades.  The first being a second MaxSonar_EZ2 range finder so it can decide which way to turn when it detects an object in front of it.  The rest of the upgrades were cosmetic like a new top tray that holds the breadboard in place, two new indicator LEDs so it now has three and a new start button.   You can see the earlier posts on BuddyBot here:


The first robot programed in Swift with SwiftyBones
BuddyBot - The Swift robot gets its first upgrades

If you are interested in making your own BuddyBot or if you just want to see what parts were used you can see this post:  BuddyBot update and Parts List

Here are some new pictures of BuddyBot





When I added the second MaxSonar_EZ2 range finder I put one on the left side and one on the right side.  This allows BuddyBot to determine if the left or right side is closer to the object in front of it and then determine which way to turn based on which side is closer.  It is a very basic system, which could use some more logic, but it is definitely a start.  You can see several videos of BuddyBot with the new obstacle avoidance system below.










  
One thing with the MaxSonar_EZ2 range finder, or any small sonar sensor like this one, is when the robot approaches an object at too large of an angle, the sonar sensor will not register the object.  With this in mind, I think I will want to add an infrared obstacle avoidance sensor to assist the MaxSonar range finders.  The IR sensor I am thinking about using is this one.  I currently have one of these so I am thinking about giving it a try next weekend.  What I will do is when the IR sensor detects an object then I will use the sonar range finders to determine which way to move.

I am also thinking about using a sonar sensor to determine if BuddyBot is near a ledge or step.  I am thinking that if I use a sonar sensor, facing down, in BuddyBot’s nose then I can determine if it is at a ledge or a stairway.  I could take the range when the BuddyBot first starts and if the range increases significantly then it has approached a ledge.


I did not make any changes to the SwiftBones library for this upgrade however I did make significant changes to the BuddyBot code.  You can see the changes on BuddyBot’s GitHub page.

Sunday, May 8, 2016

BuddyBot - The Swift robot gets its first upgrades

BuddyBot, the robot programmed in the Swift programming language just got its first upgrades.  The first thing you may notice is I printed out a couple of new trays to hold the components so it looks better.  Secondly I added a MaxSonar_EZ2 range finder so it can detect obstacles in front of it and turn.  Right now it simply turns right when it gets close to an obstacle. 

Here is the new BuddyBot


The following video shows my daughters playing with BuddyBot.


I created a new github page for the BuddyBot code.   

I also just added a component library to the SwiftyBoneslibrary and I used some of those components to build this version of BuddyBot.  You can read about the component library on the wiki page.


I think the next upgrade is going to be a second MaxSonar sensor.  Rather than having one sensor in the center I am thinking about putting two sensors on the front, one on the right and one on the left, so BuddyBot can make decisions on which way to turn rather than always turning right.  This means I will need to print out a new tray that will hold two sensors.