Go to Post work? I can't remember when the last time i did that was... - Carolyn Duncan [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-04-2010, 20:25
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
FRC Neural Network Project

Link to the project: https://sourceforge.net/projects/frcnn/

This is the 'completed' form of a Neural Network that team 1977's programming team was throwing around in 2009. If you would like to contribute to the development, please PM me with your source forge account name so I can give you SVN access

Miscellaneous notes
* Controls the robot's drive
* Currently only supports 2 motors, the code to allow for 4 motors and up will be added at some point
* Unsure if fitness algorithm works or not, must be tested(but team 1977 can't because our 2009 robot is disassembled)
* Genetic Algorithms(what's used on the connections, by far the largest section of code) generally take 500-5,000 generations to fully optimize
* The drive function(Motor_Control() in the code) doesn't include the setting of the motors, this is specific to the teams robot(which jaguars/victors are connected where).
* Requires camera for the fitness function
* Camera code needs to be added
* Curently for the 2009 game. The reason for this is that the 2009 game was conceptually easier to write a fitness function for, and thus easier to build a neural network for. If you can think of a fitness function for Breakaway, please tell.
* The robot currently tries to drive away and avoid opposing robots. This can be made opposite(robot trying to go after opponents robots)
* Released under GPL


Again, this is Open Sourced, so if you would like to contribute, PM me with what your accounts name is.
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static
  #2   Spotlight this post!  
Unread 23-04-2010, 20:52
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: FRC Neural Network Project

lol this has me confused Do you have an example of how one would use this?
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
  #3   Spotlight this post!  
Unread 23-04-2010, 21:00
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
Re: FRC Neural Network Project

In essence, call Motor_Control()


but there's going to have to be some modifications before it'll work with a given teams robot. To be specific, where it says set motor value here in the function Motor_Call, that is replaced by code sending Motor_Left and Motor_Right to their corresponding jaguars(whichever ones those are). Also, you have to add the camera tracking code into the function camera_track, but you must add a little bit of code to determine the angle(Y, vertical, or phi, whichever one you prefer) and send it back (That angle is the one that the tilt servo is set to). Once those modifications are done, just call Motor_Control() when you want to run the Neural Net.


It could be used as a self-optimizing autonomous drive routine or really anything that involves driving.


Direct link to the file: http://frcnn.svn.sourceforge.net/vie...n/NN_robot.cpp
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static

Last edited by bobwrit : 23-04-2010 at 22:01. Reason: added direct link to source file
  #4   Spotlight this post!  
Unread 23-04-2010, 23:16
gblake's Avatar
gblake gblake is offline
6th Gear Developer; Mentor
AKA: Blake Ross
no team (6th Gear)
Team Role: Mentor
 
Join Date: May 2006
Rookie Year: 2006
Location: Virginia
Posts: 1,939
gblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond reputegblake has a reputation beyond repute
Re: FRC Neural Network Project

Bob - No surprise in what I am going to suggest - Can we marry this up with the 5th Gear simulator and let each of 6 neural networks (with 6 different fitness functions) learn to each control one simulated robot? - Obviously, connecting the two sets of code is feasible given enough time and money. I'm asking if you think it would be easy enough and rewarding enough to want to actually do it.

Blake
__________________
Blake Ross, For emailing me, in the verizon.net domain, I am blake
VRC Team Mentor, FTC volunteer, 5th Gear Developer, Husband, Father, Triangle Fraternity Alumnus (ky 76), U Ky BSEE, Tau Beta Pi, Eta Kappa Nu, Kentucky Colonel
Words/phrases I avoid: basis, mitigate, leveraging, transitioning, impact (instead of affect/effect), facilitate, programmatic, problematic, issue (instead of problem), latency (instead of delay), dependency (instead of prerequisite), connectivity, usage & utilize (instead of use), downed, functionality, functional, power on, descore, alumni (instead of alumnus/alumna), the enterprise, methodology, nomenclature, form factor (instead of size or shape), competency, modality, provided(with), provision(ing), irregardless/irrespective, signage, colorized, pulsating, ideate
  #5   Spotlight this post!  
Unread 23-04-2010, 23:32
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
Re: FRC Neural Network Project

I wouldn't know quite how easily it would port, mainly because I haven't dealt with .net all that much. It would be easier almost to write a fitness function for 5th Gear than it would for the main FRC bot. How useful it would be would depend on how much of the actual robot is simulated within 5th gear.
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static
  #6   Spotlight this post!  
Unread 24-04-2010, 10:58
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is offline
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
Re: FRC Neural Network Project

Just wondering, wouldn't it make a bit more sense to use dynamic memory and float arrays instead of a bunch of named floats? It would have greatly reduced the amount of code that needed to be copy-pasted and changed...and I noticed you make a rnd(min,max) function, but use rand()%max the entire time in the code?
__________________


GSR Dean's List Finalist 2011
  #7   Spotlight this post!  
Unread 30-04-2010, 21:59
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: FRC Neural Network Project

I'm really not sure what this is.
Is it a complete solution to an autonomous 'bot?
Is it a hardware abstraction to make perception and control easier to implement?
Is it implemented within the current FRC framework?
Why is it called a "neural network"? Is it for controlling of multiple robots from one AI?
What are the benefits of using it over simply using the WPI libraries directly?
__________________
-- Marshal Horn
  #8   Spotlight this post!  
Unread 30-04-2010, 23:03
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
Re: FRC Neural Network Project

Quote:
Just wondering, wouldn't it make a bit more sense to use dynamic memory and float arrays instead of a bunch of named floats? It would have greatly reduced the amount of code that needed to be copy-pasted and changed...and I noticed you make a rnd(min,max) function, but use rand()%max the entire time in the code?
It may. I'm pretty sure there are more efficiant ways of coding it. I used the way that I was most comfortable with. rnd() is called within the initialization function to provide a random decimal(when running it for the first time).

Quote:
I'm really not sure what this is.
Is it a complete solution to an autonomous 'bot?
Is it a hardware abstraction to make perception and control easier to implement?
Is it implemented within the current FRC framework?
Why is it called a "neural network"? Is it for controlling of multiple robots from one AI?
What are the benefits of using it over simply using the WPI libraries directly?
1. Not complete, but a move in that direction. It allows for the robot to learn and drive itself according to a method of evaluating the fitness of certain options. Depending on how that algorithm is done, determines the efficiency and what the goals are(to a reasonable point. aka: must be able to be defined quantitatively
2. Depends on your definition of hardware. It isn't traditional hardware abstraction in the sense that it isn't using silicon/pcb/ic/doped circuits, but you could classify it as abstracting the brain.
3. Not really. Right now, yes the code implements some things within the WPILib, but as far as being placed into a specific template, and getting the vision code down(not added yet), that still remains to be done(I don't have WPILib or WindrRver or any of the example code on my laptop right now)
4. Imagine how a brain functions. There is a network of neurons interconnected with synapses, and there are electrical pulses firing along these. A Neural Network emulates this design. There are a collection of neurons(some type of variable, usually floats) and their connections/weights(also usually floats). The neurons store the value of the net sum of their inputs. Their inputs are the connections times the value of the neuron that is closer to the initial neurons. In this NN specifically, there are 2 inital inputs(motor values) these 2 initial neurons then have their values summed across 18 intermediate neurons, also having their values multiplied by the respective connection or weight. That value times the weight( part of the 'thought' if you wish) is stored in the intermediate neurons. This process is repeated for the last 'layer' which is back to 2 output neurons. These 2 output neurons are the values that you set to the motors. A good article on how NN's work is http://www.ai-junkie.com/ann/evolved/nnt1.html
5. This allows for a increase in autonomy, as well as having the robot be able to optimize how it drives(across multiple matches, due to the saving of the weights into a file).

I hope that answered your questions, and not increased your confussion
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static
  #9   Spotlight this post!  
Unread 02-05-2010, 14:05
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: FRC Neural Network Project

Okay, I think I got it.
A Neural Network is a method of summing and thresholding the values from multiple inputs to determine degree of truth. It's a bit like fuzzy logic.

In other words, the neural network is the "planning" part of an autonomous robot. (Perceive, Plan, Control)
Or you could use it for the P and D of IPDE (Identify, Predict, Decide, Execute).
__________________
-- Marshal Horn

Last edited by kamocat : 02-05-2010 at 14:08.
  #10   Spotlight this post!  
Unread 03-05-2010, 00:26
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: FRC Neural Network Project

Of the 22 neurons, how many are in each layer?
And how many layers do you have(input, hidden?, output)?

I would like to take a stab at rewriting the network, and maybe a fitness function, but without the layers information i don't know how many neurons to allocate.

Also, is the same network that was used on your 2009 bot, or is this rewritten code?
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
  #11   Spotlight this post!  
Unread 03-05-2010, 11:24
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: FRC Neural Network Project

I did some neural net stuff a while back, and used a framework called "ECJ" to do the evolution part of the problem. It controls population dynamics / breeding / tournaments / etc. It was reasonably easy to use, and reasonably well documented. Even made using multiple machines easy!
  #12   Spotlight this post!  
Unread 03-05-2010, 14:48
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
Re: FRC Neural Network Project

Quote:
Originally Posted by biojae View Post
Of the 22 neurons, how many are in each layer?
And how many layers do you have(input, hidden?, output)?

I would like to take a stab at rewriting the network, and maybe a fitness function, but without the layers information i don't know how many neurons to allocate.

Also, is the same network that was used on your 2009 bot, or is this rewritten code?
There are 2 input, 18 hidden, and 2 output. It's relatively rewritten(I had to rewrite the code, because it disappeared somewhere :/). It's one of the options that we were thinking of for 2009, but never implemented it in competition.
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static
  #13   Spotlight this post!  
Unread 03-05-2010, 15:02
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: FRC Neural Network Project

Quote:
Originally Posted by bobwrit View Post
There are 2 input, 18 hidden, and 2 output. It's relatively rewritten(I had to rewrite the code, because it disappeared somewhere :/). It's one of the options that we were thinking of for 2009, but never implemented it in competition.
What are the inputs to the 2 input neurons? (Distance to target? and angle?)
Do the 2 output neurons go to the left and right drive motors?
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
  #14   Spotlight this post!  
Unread 03-05-2010, 15:04
bobwrit's Avatar
bobwrit bobwrit is offline
//No Comment
AKA: ...
FRC #1977 (Loveland High Robotics)
Team Role: Alumni
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Somewhere
Posts: 298
bobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nicebobwrit is just really nice
Re: FRC Neural Network Project

both are left and right motors(left and right motors as input, left and right motors as output)
__________________

FRC Team 1977 Alumni

Has Attended:2008 Colorado regional
2009 Colorado Kickoff
2009 Colorado Regional
2010 Colorado Kickoff
2010 Colorado Regional




The most exciting phrase to hear in science, the one that heralds new discoveries, is not "Eureka!"(I found it!), but rather, "Hmm.... That's funny" ---Isaac Asimov
Chance favors the prepared mind ---Louis Pasteur
And you can tell me, that I can't make a diffrence because I'm just one, but one is all it takes to start it. And you can tell me, that I can't change the world because I'm too young, but I wont stand here and be your target. ---FM Static
  #15   Spotlight this post!  
Unread 03-05-2010, 15:16
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: FRC Neural Network Project

Quote:
Originally Posted by bobwrit View Post
both are left and right motors(left and right motors as input, left and right motors as output)
and where are the inputs calculated?
Are they a function of previous calculated values?
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pic: Neural Network Concept bobwrit Extra Discussion 5 04-08-2009 10:55
Will we see Artificial Neural Networks in FRC in 2010? manderson5192 Java 11 22-07-2009 15:30
Issue Mass Compiling FRC Robot Project Larry Lewis FRC Control System 2 19-02-2009 23:06
LebView Error -- Error 1055 occured at Property Node in FRC Create Project.vi->FRC Wi RMS11 Programming 8 08-12-2008 18:20
Neural Control of Robot Arm Leo M Math and Science 2 29-03-2004 13:46


All times are GMT -5. The time now is 12:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi