Jump to content
shadowrecon

AI robot project - HELP WANTED!

Recommended Posts

Okay so the last few years i've spent programming in Delphi and pascal, learned a lot but also have always loved electronics. Ive recently found a way o combine both my love fore programming and the love of electronics by building a robot. I named him wall-e, the plan is to have a robot that will learn his surroundings and be able to map rooms and identify objects with various analog sensors that will create the digital data.

 

What im looking for from the community are ideals about but not limited to: movement, room mapping with distance sensor, object detection using different real world sensors (anything is optional just through out the ideal and ill think about adding the sensor for that bit of data). I believe the knowledge we have built with scar could be pushed further if we actually focus on making real life task robotic. What if task for consumer bought robots were open source and widely available? basically like app based smart phones but a app based robot, which could easily run on a Android processor.

 

To close my little tangent, i would like to really get feed back on how many people would be interested and what ideals they could bring to the table as i plan to create a kickstart page for the project and get the details set in place.

Link to comment
Share on other sites

So far the little guy is almost built hardware wise minus his 3 axis claw that im waiting to receive. The sensors i have managed to attach so far are, 180 degree turret distance sensor, which can rotate 180 degrees and detect the distance between the sensor and object using ultrasonic ranging.

example is showen below how to turn timings into distance.

 

	float microsecondsToInches(long microseconds)
{
	// According to Parallax's datasheet for the PING))), there are
	// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
	// second).  This gives the distance traveled by the ping, outbound
	// and return, so we divide by 2 to get the distance of the obstacle.
	// See: [url]http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf[/url]
	return ((float)microseconds) / 74 / 2;
}

float microsecondsToCentimeters(long microseconds)
{
	// The speed of sound is 340 m/s or 29 microseconds per centimeter.
	// The ping travels out and back, so to find the distance of the
	// object we take half of the distance travelled.
	return ((float)microseconds) / 29 / 2;
}

 

Ive also added a temp sensor to compensate for temperature coefficients when trying to measure long distances with an ultra sonic distance sensor. Now i need to start determining how i am going to drive this robot forward is he going to check for obstacles every few seconds, drive blind from a starting point, or map the room from one position and keep an active location ideal.

Link to comment
Share on other sites

Lol, thanks lord, i need some programmers who can program in "C" or "C++". Since ive started this back in December ive redesigned the robot quit a few times but right now the little guy looks pretty cool but doesnt do a whole lot. Ill upload some pictures soon!

 

if anyone has anyideas on how to go about doing object recognition shoot them at me no response is wrong.

 

Parts im waiting on:

* 1mp video camera

* < .5 m accurate GPS chip

* 3.2in touch screen lcd

* litium 3 cell charging circuit/ protective circuit

* high tourqe 360 degree servos (6kg/cm ea)

 

 

Also ive setup a git repo for the code for this project and if anyon would like access to view and optomize code that would be greatly appericated.

Link to comment
Share on other sites

As mentioned OpenCV is a great library built for such purposes. Object recognition in general will be VERY hard to achieve. You need a giant bundle of data to achieve even close to useful general object recognition. And you need fast hardware - Generally no small embedded device should be used for such purpose, unless you want it to go really slow.. Pass the image-stream, and other crucial data over WiFi to your computer to "crush them numbers".. It seems as the some sort of learning process is needed if you want proper object detection. This process can take a LONG time.

 

Method often used to extract data is eg: SIFT, SURF, HOG, Corners, thresholding, blob extraction, edges, contour (hierarchy).. Depending on what you want to recognize there are a gazillion other stuff which can be used in less generalized cases..

 

Object learning ("data mining") can be done in a few ways, a quick way might be to use Google Images -> Search category (IE: "soda can") -> Go trough a bunch of images, and store there object data, this data can easily be extracted with IE: Corner detection (it's quite solid), and something like HOG. Discard images/data that has little similarity to other images in same category.

You can if you want to have a more controlled result, select a hundred images your self (for each category/object to "learn")...

Link to comment
Share on other sites

Yeah thanks slacky, ur not slacking at all hehe. But yeah I remember the Soda can, and i think it was contours is what i was talking about, not totally sure though. Look at all those ways though haha.

 

Arduino, or some of the things from uh Makershed. might be able to help you too. Rasberry Pi, etc.

maybe? Arduino Shield Robot Kits | Maker Shed

Idk lol.

 

Should be able to find something with enough speed to fit ur needs.

Link to comment
Share on other sites

Guys all of this info is great!

 

I have not settled on a development board just yet, but i believe im going to do all this with a 8bit avr with 32kb of programmable flash and 4kb sram to control the wheels and object avoidance system. Then for the bring im looking toward a pic 32bit processor with 128kb of flash and 16 kb sram. These processors will be connected and have the ability to transfer data between the two.

 

What is going to make this interesting is the lack of on board programmable memory and sram. The processors im using do not have schedulers like a 32bit or 64bit computer. So i have created/incorporated an abstracted class that controls the flow of functions. basically i schedule the functions as the program runs and i can control how often the functions are run and at what time they start. ive started work on a watch dog function similar to the windows watch dog that makes sure no function is taking to long and if it is the watchdog function will have the ability to restart the avr/pic processor.

 

I know these limited processors seem fairly week compared to the machines we use to search the web but i believe we can do alot. The Apollo 11 moon lander was a 16bit processor with only 12kb of flash memory, i believe what im trying to do with the arv/arduino chips could easily be done with the proper approach. If i do outsource the processing to a desktop computer or the internet i could greatly increase the power these chips have.

 

for instance ive started on the motor controller class, im using 8 bit byte to store 8 pieces of information, the high bit 7 contains motor 1's direction 0 for forward 1 for reverse, bit 6 contains the direction of motor 2, bit 5 is the enable for motor 1 (if this isnt 1 / enabled then motor 1 will not move) bit 4 is motor 2 enabled bit, bit 4 - 0 haven't been used yet. but as you can see with only 1 byte of data i have stored multiple pieces of data and still have room to work. im trying to incorporate as much bit-wise operations as possible because they are some of the fastest functions you can preform of data.

 

next after the motor class im building the sonar class which is going to calculate the average distance in front of the robot going from 0 degrees far left to 180 degrees far right. I plan to incorporate a delta and multiple samples per second before averaging the distance. or i may average the distance between certain angles like 0-30 30-60 60-90 90-120 120-150 150-180 and the greatest distance in the direction of travel to the destination point will be used as the direction the robot needs to calculate to move to.

 

i am trying to make this as minimal as possible while retaining a non programmatic pattern in the movement. Since the clock of the arduino 328p is at 16mhz that's 16 million cycles per second which means 8 bits of data x 16 million is the throughput of the processor. keeping all the data down to 8 bits returned per class will keep ea class efficient and fast.

 

on side note, yesterday i went to the lab at school and designed a new frame, this one is a little bigger than before 5" x 9" which will allow plenty of room for components, and since it is made from one solid piece of steel its strong and reliable.

Link to comment
Share on other sites

shadowrecon, I would not think for a second that you, or anybody will be able to pull of some sort of object-recognition on an Arduino... There are a buckload of boards that offer much better hardware, they don't even need to be opensource.. Use your arduino as a controller board, and a "sensor-board", (which it should be used as) hook it up via USB to a stronger board/micro computer running a minimal OS. Some small devices which can be used for number-crushing:

Dev boards: OrigenBoard, WandBoard, CubieBoard.. (All featuring multicore CPUs ~4 cores, and decent GPUs) | cost around 100$.

Single board computer that also can be used is the MK908 device, featuring 2GB DDR3 RAM, and a decent QuadCore CPU @ 1.6-1.8GHz | Cost around 100$.

 

A single board computer with a minimal linux distro will allow you to use a language you are more found of to communicate with your Arduino, and prototyping can be done directly from your computer.. EG: Object Pascal.

 

On a side note: You can even use your smartphone and get much better results, but then the battery will be a bit limited (unless you have an identical battery/backup and connect am in Parallel) - but them hours you get might be enough...

 

---

I would love to know what you mean by object recognition when you are considering doing everything on a Arduino. How on earth do you plan to fit all the needed code on such a limited device..?

Edited by slacky
Link to comment
Share on other sites

shadowrecon, I would not think for a second that you, or anybody will be able to pull of some sort of object-recognition on an Arduino... but no object recognition. There are a buckload of boards that offer much better hardware, they don't even need to be opensource.. Use your arduino as a controller board, and a "sensor-board", (which it should be used as) hook it up via USB to a stronger board/micro computer running a minimal OS. Some small devices which can be used for number-crushing:

Dev boards: OrigenBoard, WandBoard, CubieBoard.. (All featuring multicore CPUs ~4 cores, and decent GPUs) | cost around 100$.

Single board computer that also can be used is the MK908 device, featuring 2GB DDR3 RAM, and a decent QuadCore CPU @ 1.6-1.8GHz | Cost around 100$.

 

A single board computer with a minimal linux distro will allow you to use a language you are more found of to communicate with your Arduino, and prototyping can be done directly from your computer.. EG: Object Pascal.

 

On a side note: You can even use your smartphone and get much better results, but then the battery will be a bit limited (unless you have an identical battery/backup and connect am in Parallel) - but them hours you get might be enough...

 

---

I would love to know what you mean by object recognition when you are considering doing everything on a Arduino. How on earth do you plan to fit all the needed code on such a limited device..?

 

The point is not to use a super computer the size of mars to figure out what an object is, slacky you are like most other americans that believe you need a bigger gun to do damage when really you just need to work smarter not harder...

 

 

attack plan -

 

step 1: build robot frame, and apply sensors (0.3mp camera, distance sensors, color sensors, bumper sensors, GPS module, accelerometer, gyro, and wireless transceivers 2.4ghz)

step 2: design wireless data platform that will communicate with the arduino (200-400 feet effective range plenty for inside my house) This platform will receive and send data from and to the robot, it will use wolframalphas website to search for data, resistivity, colors, pictures ect. I plan to offload alot of the math to either google.com or the network hub arduino, the one processing the website data and relaying it to the robot arduino.

 

 

Slacky i believe you are way under estimating the power of the arduino. Ive built many projects based on the arduino for school and play, and ive yet to find a problem to difficult for the arduino to process. Now if you treat it like a 32bit desktop your right, ram and memory runs out fast, but if you use every bit of every byte there's more than enough storage. bit-wise operators and bit-wise math. Also i plan on using a 32bit chipkit uno which is a pic but is compatible with the arduino to process the higher level decision making.

 

 

Object recognition is also along ways a way. I have alot of other systems to build in the mean time, check out my motor header file for driving. its very memory efficient

 

 #define MOTOR_1_EA 9
#define MOTOR_1_0 8
#define MOTOR_1_1 11

#define MOTOR_2_EB 10
#define MOTOR_2_0 12
#define MOTOR_2_1 13 

class motor {
 public:
   byte data;
     // bitRead(data, 7) holds the current direction of motor 1
     // bitRead(data, 6) holds the current direction of motor 2
     // bitRead(data, 5) holds the status of EA
     // bitRead(data, 4) holds the status of EB
     // bitRead(data, 3) 
     // bitRead(data, 2)
     // bitRead(data, 1)
     // bitRead(data, 0)

   void create()
   {
     DDRB = B00111111; // set pins 8-13 as output ATmeg328 only!!!
     setDir(2);
   }

   void setDir(byte dir){
         switch (dir){
               case 0: // forward 
                 bitWrite(data, 7, 1);
                 bitWrite(data, 6, 1);
                 bitWrite(data, 5, 1);
                 bitWrite(data, 4, 1);
                 break;
               case 1: // reverse
                 bitWrite(data, 7, 0);
                 bitWrite(data, 6, 0);
                 bitWrite(data, 5, 1);
                 bitWrite(data, 4, 1);
                 break;
               case 2: // stop
                 bitWrite(data, 7, 0);
                 bitWrite(data, 6, 0);
                 bitWrite(data, 5, 0);
                 bitWrite(data, 4, 0);
                 break; 
               case 3: // left fast
                 bitWrite(data, 7, 1); // motor 1
                 bitWrite(data, 6, 0); // motor 2
                 bitWrite(data, 5, 1); // motor 1 EA
                 bitWrite(data, 4, 1); // motor 2 EB
                 break;
               case 4: // right fast
                 bitWrite(data, 7, 0);
                 bitWrite(data, 6, 1);
                 bitWrite(data, 5, 1);
                 bitWrite(data, 4, 1);
                 break;  
               case 5: // left slow pivot
                 bitWrite(data, 7, 1);
                 bitWrite(data, 6, 0);
                 bitWrite(data, 5, 1);
                 bitWrite(data, 4, 0);
                 break;
               case 6: // right slow pivot
                 bitWrite(data, 7, 0);
                 bitWrite(data, 6, 1);
                 bitWrite(data, 5, 0);
                 bitWrite(data, 4, 1);
                 break;  
               default:  
                 bitWrite(data, 7, 0);
                 bitWrite(data, 6, 0);
                 bitWrite(data, 5, 0);
                 bitWrite(data, 4, 0);
                 break;
           };
   }

   byte getDir(){
     byte result;
     // result data structure
     // bit 7 is the direction of motor 1
     // bit 6 is the direction of motor 2
     // bit 5 
     // bit 4
     // bit 3
     // bit 2
     // bit 1
     // bit 0

     if (bitRead(data, 5) == 1)
       if (bitRead(data, 7) == 1){
          bitWrite(result, 7, 1);
       } else {
          bitWrite(result, 7, 0);
       }

     if (bitRead(data, 4) == 1)
       if (bitRead(data, 6) == 1){
          bitWrite(result, 6, 1);
       } else {
          bitWrite(result, 6, 0);
       }

     return result;
   }

   void run(){
     digitalWrite(MOTOR_1_EA, bitRead(data, 5));
     digitalWrite(MOTOR_1_0, bitRead(data, 7));
     digitalWrite(MOTOR_1_1, !bitRead(data, 7));

     digitalWrite(MOTOR_2_EB, bitRead(data, 4));
     digitalWrite(MOTOR_2_0, bitRead(data, 6));
     digitalWrite(MOTOR_2_1, !bitRead(data, 6));
   }
};

Edited by shadowrecon
Link to comment
Share on other sites

Yup, but remember to look on google for other's endeavors into these areas. Heck you could port a library for this if u wanted to, to whatever low level language or optimal thing you wanna do.

But I know from scratch is cool too. And specially for u Shadow, I've seen u do it before, so I'm confident you'll do good regardless.

 

 

You might wanna try out, some1 elses robot first, just to see what they did, and how fast there's was. Or just lookup on youtube or something

robot object detection - YouTube

 

tons of videos

might be good to get u acquainted with robots more too, if u aren't already

Link to comment
Share on other sites

yes of-course, i guess i missed that point somewhere in the reading. The arduino could process that kind of data but like you said it would be setting there all day thinking of what to do next. The difference from what your saying and im trying to do is i plan on having no 32 bit computer (before i hook to the internet) to process data. The hub will be another 8bit arduino connected to the network through a Ethernet shield, which will allow me to request and host data for the world to see from just a 8bit arduino. Does that make since. Im trying to build a product that is not only smart but cost effective, i can pick up arduino chips for under $4 bucks a piece i dont need the fancy development board just the chip.

 

I need some ideas for prototyping some of the functions and routines have any ideas on what you think some of the first things the robot should check? or how he should order thoughts as to not become self destructive?

Link to comment
Share on other sites

Well, it depends how many things the robot can do at once. Is this going to be multi threaded? If so, you could dedicate a thread to each sense (ears, eyes, etc.), etc.

 

Categorizing is great. What functions does the robot need to do all the time versus only sometimes.

 

E.g.

 

Eyes,

- Sub threads:

Infrared

Corner detection

Color detection

 

Senses,

Movement

Coordination

 

You can split tasks to separate workers, and etc.

 

Might be limited to the specs of the machine you are using... Just make sure the way the Main loop is, its really fast, and might even wanna employ Timers, or fail safes, and etc. You probably thought of all this already. I'm kinda just stating the obvious as usual. But anyway, i try lol.

Link to comment
Share on other sites

I will have no true multitasking ability because im using a 8bit and 32 bit processor. i have already implemented a task system that runs certain task at certain times very similar to how threads can be simulated in scar with timers but the way ive set it up i can assign priority levels to the task and modify them if need be by another function before they are processed. Basically this is a scheduler based task management system.

 

 

Aside from that, ive starched the original frame and sensor setup and bought a "Rover Tank Spy" for a steal of $45 and im going to re engineer the system to communicate to a program on the computer through a ad-hoc network and there will probably be another network that will relay sensor data back to the computer. This is necessary and there is no other way around.

Because i got the robot at basically a steal im just going to add onto the already well built infrastructure. The Rover Tank Spy was built to be controlled from a ipad, i phone or other smart device the app was made for. But what i want to do is send and receive data over the wifi network which will not be hard since someone has already wrote a python library to do the work. My problem is i have no idea what im doing when it comes to python is there anyone willing to help port this python library over to c/c++?

 

Rover Python Files Rover.zip

 

So the new plan is to use a already designed platform to develop from. I will leave the robots current circuitry alone and add my sensors creating another standalone circuitry for the sensor network i will add. I may remove the wires from the motors and create a 4 bit data stream the arduino can read. also creating a encryption method so i could send 16 unique commands 4 of which would control the motors from the arduino after the commands were processed but the other 12 commands could be used to transfer data from the computer to the arduino/robot but they could not be used to send data back to the computer since the motor wires are only output. To feed the computer with data we need to setup another network to send and receive data. to do this i will attach a 2.5ghz transceiver to the robot and antoher one at a arduino which will serve as a hub to gather the data and finally transmit over the usb to the computer for the application to process and do it all over again.

I know this sounds crazy and goofy and im probably on the wrong forum to be asking questions like this as most of you have no electronic experience and believe me when i say DIY electronics are far different and less reliable than desktop computers. The info i proposed today is all very possible and real with only a little bit of work. I am sorry i have yet to add any pictures to the post but by next Sunday i should have something to take a picture of. I am waiting on parts and everything else.

Link to comment
Share on other sites

most of you have no electronic experience

 

Yup Lol. Give it a couple years and i will eventually get into electronics. Just have too much school work, and learning to do right now. Biology, Psychology, Economics, English. My philosophy of daily life includes learning though, so whether in a couple years or longer, I will touch that subject eventually. I've learned some basic basics already.

 

For Python there's probably a program or way to port it. Slacky, Freddy, might be able to say something about that.

It couldn't be that hard. If it is, GL man lol.

 

 

Even if this is the wrong forum. You got friends here man. We'll support you all the way. Don't you forget me lol. Sutton too.

You can use the Robot avatar you have as the logo or w/e. Or design, Lol.

Edited by LordJashin
Link to comment
Share on other sites

shadowrecon, I took a 5 min peak at the rover-module. It's easy to port to C, but honestly.. There is little to nothing special in that module. He is just using regular sockets to communicate, nothing special at all. And if you know C, that modules is so basic that anyone with C-knowledge should be able to port it. Should you run in to trouble, then you can ask.

 

There is no Python to C program available. That would be really hard to achieve as Python is dynamic language (no types, everything is just objects).

 

I prefer to use Python to communicate with my Arduino Due (and my Uno), it simplifies a lot.

Edited by slacky
Link to comment
Share on other sites

I understand slacky its not too difficult (it is for someone without even a python complier...) but it is something im not willing to learn at this moment as im trying to understand NEMA GPS strings, yeah not the difficult in a text book, but in raw data is another story.

 

If it isnt difficult why couldnt you port it over for me slacky? let me guess slacking? lol j/k.

 

 

Side note i picked up a Roomba IROBOT today at a local thrift shop for under $60 and it works! Im working on writing a interface for it as it has a serial control port, found a article ive been reading and its pretty straight forward send a byte receive a byte kind of data transfer using standard I2C protocols. The roomba will still do much of the algorithm crunching while the arduino receives requested feedback from any of the sensors available on the roomba while acting as a romote telling the roomba to move forward 200 mm turn right ect. Its a bit more complex but thats because IROBOT designed the roobas as circles (great idea) and they actually drive in arcs somewhat. Luckily i dont have to derive the individual functions for the turning radius for right and left as the article i found / tutorial has them already. The only problem is the tutorial was not intended for arduinos and compatibility went out the window from the first line so now im just trying to dig through and find the commands i need.

 

I should have the other robot i order soon which is the one i need the python library ported for. Also that happens to be one of the only library's i have found any where on the internet.

 

Anyways the only thing im missing now is the time to put all of this hardware i have managed to collect together.

 

As i said at the beginning anyone have any ideas?

 

- - - Updated - - -

 

@Lord_Jashin

I will not port a library before i learn the language ever again! lol. You remember SPS right??

 

- - - Updated - - -

 

WP_20140204_010.jpg

WP_20131228_001.jpg

WP_20140111_001.jpg

WP_20140113_004.jpg

WP_20140204_002.jpg

WP_20140204_003.jpg

WP_20140204_009.jpg

Link to comment
Share on other sites

Lol nice pictures. Yeah SPS porting was atrocious. The first picture looks like a monster or something lol jk

You have a really bad habit of using "lol" in a sentence ridiculously often:p

 

 

shadowrecon, I truly doubt anyone is going to do your work for you, so you better start porting, and rather ask for advice or help whenever.. The alternative is to write a similar module your self, or find something else which is already written in C. Tho I would really advice you to use, and take the time to learn the VERY SIMPLE (to learn) Python language in this project. Python has shit for just about everything, a giant standard library, and a massive community, has a very simple and elegant syntax, and easily extendable with C, Obj.Pascal or Fortran.

Edited by slacky
Link to comment
Share on other sites

Yeah slacky i think learning pascal would be cool i just have enough im trying to learn so ive just put that project to he side and moved on to the IRobot Roomba, since it has a built in access port using simple serial commands and they are fairly well document commands so i should have no problem taking full control of the IRobots systems.

 

I know the pictures dont look great but those are the 3 ive built so far and im sure they will change so much more over the next few months.

Link to comment
Share on other sites

Well after many designs and a lot of money later im starting to get some progress done with the development of the entire ideal. Ive ended up using a linux based development board. it has python, opencv and much more just got to learn my way around python and Linux. Heres a link to a album https://www.facebook.com/media/set/?set=a.10201700820146597.1073741826.1362925785&type=1&l=77f0a1250d

WP_20140308_001.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...