Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 
Send Topic Print
Myro and ffnet (Read 18374 times)
dblank
YaBB Newbies
*




Posts: 6
Re: Myro and ffnet
Reply #15 - 04/11/07 at 12:28pm
 
Sounds good to me too! I'll add the two vision functions, and conx.py to Myro. Let me know if there are other items that we could adapt or add.
 
-Doug
Back to top
 
 
WWW   IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Myro and ffnet
Reply #16 - 04/11/07 at 3:07pm
 
You might consider adding the "zw" and "zr" user flash memory functions - this would be a useful place for storing robot-specific info such as name, id #, motor bias, IR calibration, etc, as well as connection and weight tables for the neural nets.  
 
In fact, if we standardized a format for storing that info, it could be retrieved by Myro on startup or used by the on-board firmware in autonomous (non-tethered) operation.
 
Also, you might add the "dd", "dr" and "dw" functions for manipulating the digital i/o pads E9 - E13 at the front of the SRV-1 controller.
 
Back to top
 
« Last Edit: 04/12/07 at 11:32am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
pacomms
Junior Member
**




Posts: 62
Re: Myro and ffnet
Reply #17 - 04/12/07 at 8:25am
 
OOO Help , you guys are leaving me behind here , i dont even know how to use myro etc etc , is there a site that explains how to use it and also how i integrate the new neurel net functions etc into my srv? I thought admin said there was going to be a web page devoted to neural nets etc etc. Smiley
Back to top
 
 
Email   IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Myro and ffnet
Reply #18 - 04/12/07 at 11:23am
 
That is still the plan, but the project started by localyodel to add a simple neural network to the Myro code that runs the SRV-1 opened up the opportunity to take advantage of a wealth of existing knowledge and tools for incorporating neural networks in robots.  
 
To get started, we are working with Prof Doug Blank of IPRE / Bryn Mawr College on hooking the various pieces together.  Besides the SRV-1, the major components are the Python-based Myro robot interface and Conx neural network library (replacing the ffnet library localyodel started with).
 
here's the Myro setup -  
    http://wiki.roboteducation.org/Myro_Installation_Manual
 
here's how to use Myro wth the SRV-1
    http://wiki.roboteducation.org/Myro_Hardware
 
At the moment, Doug is adding a few more SRV-1 firmware functions to Myro, and then we'll focus an effort on writing some basic Python programs that use the Myro functions with neural networks.  Because a large part of the motivation for Myro is to add robotics to computer science education, this could easily evolve into a new set of tutorials for the SRV-1.  There's already a wealth of teaching material on the IPRE website- see  
    http://wiki.roboteducation.org/Introduction_to_Computer_Science_via_Robots
Back to top
 
« Last Edit: 04/12/07 at 11:24am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
dblank
YaBB Newbies
*




Posts: 6
Re: Myro and ffnet
Reply #19 - 04/13/07 at 1:07pm
 
Quote from admin on 04/11/07 at 3:07pm:
You might consider adding the "zw" and "zr" user flash memory functions - this would be a useful place for storing robot-specific info such as name, id #, motor bias, IR calibration, etc, as well as connection and weight tables for the neural nets.

In fact, if we standardized a format for storing that info, it could be retrieved by Myro on startup or used by the on-board firmware in autonomous (non-tethered) operation.

Also, you might add the "dd", "dr" and "dw" functions for manipulating the digital i/o pads E9 - E13 at the front of the SRV-1 controller.


 
Good! This is exactly what I needed. I now have conx (the Python Neural Network code) as part of the newest Myro in CVS. I'll post a note when I get these other commands added. We have a general getData() and setData() so I can use that interface to get and set the memory data. We can refer to places of data in memory by a position, or name. Which ever you prefer.
 
-Doug
Back to top
 
 
WWW   IP Logged
dblank
YaBB Newbies
*




Posts: 6
Re: Myro and ffnet
Reply #20 - 04/15/07 at 6:05am
 
Quote from admin on 04/11/07 at 3:07pm:
You might consider adding the "zw" and "zr" user flash memory functions - this would be a useful place for storing robot-specific info such as name, id #, motor bias, IR calibration, etc, as well as connection and weight tables for the neural nets.

In fact, if we standardized a format for storing that info, it could be retrieved by Myro on startup or used by the on-board firmware in autonomous (non-tethered) operation.

Also, you might add the "dd", "dr" and "dw" functions for manipulating the digital i/o pads E9 - E13 at the front of the SRV-1 controller.


 
BTW, if anyone sends be "patches" or specific code additions or changes, we will gladly incorporate into Myro.  
 
-Doug
Back to top
 
 
WWW   IP Logged
localyodel
YaBB Newbies
*




Posts: 13
Re: Myro and ffnet
Reply #21 - 04/16/07 at 7:50pm
 
I have progressed... lots of reading/experimenting.  I have conx/myro setup with a couple of data colection methods for offline training.  I am feeding x1,y1,x2,y2 into the network and getting good color tracking, the network has 4 inputs 4 hidden and 2 out.  I have not managed to combine ir and color into one network yet still thinking about it; but can use both the ir and color together and get good "avoid and find color" results.  I was looking at the vs command and it only returns a bunch of zeros... I haven't looked very hard at it yet so it's probably me... going to start working on a vs command network, or maybe one of the new commands.  I am open to suggestions on any of the above.  I am going to post the code to a public server I have, as it is getting to big for posting here; will post the url once I know what it is.
 
Admin-
Will the above described network and it's weights potentially map over to your onboard network?  I am aiming for your 16 input network and beyond.
 
Jason
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Myro and ffnet
Reply #22 - 04/17/07 at 8:10am
 
Jason -  
 
Could you post your Myro/Conx code ?  I'd like to give it  try.
 
The "vs" command is basically a "floor matching scheme" - it needs a color sample that's taken from an open area in front of the robot, and then searches each pixel column in the captured image to look for the first mismatching pixel.  So if "vs" returns 0C for a given column, that indicates that the first 12 pixels in that column match the target color, so which indicates an open area.  The value returned from "vs" for each column is roughly proportional to the distance of an obstruction from the front of the robot (depending on camera angle, the closest ground measurement might be 10-12 inches out).
 
In the C and BASIC code, I divide the visual field into 3 overlapping regions of 40 columns, so left is 0-39, middle is 20-59, right is 40-79.
 
  vscan(ix);
     
  for (ix=0; ix<3; ix++) {    // in groups of 40 columns, compute max, mean and # of zeros
    tmax[ix] = tmean[ix] = tzeros[ix] = 0;
    for (jx=0; jx<40; jx++) {
     itmp = tvect[(ix*20) + jx];
     if (tmax[ix] < itmp)
       tmax[ix] = itmp;
     tmean[ix] += itmp;
     if (itmp == 0)
       tzeros[ix]++;
    }
    if (tzeros[ix] < 15)
     tmean[ix] /= 40;
    else
     tmean[ix] = 0;
 
That's just one way to do approach the problem of reducing the dimensionality of the "vs", "vf" or "vn" input data.
 
By the way, I have temporarily paused the effort to move neural network functions to firmware - we're going to learn a lot by building these models in Myro/Conx, and once we have a clearer idea of what kinds of sensor mappings work best, we can move this functionality onboard, while sharing common data structures so that we can move models back and forth between host and firmware.  Until then, it seems counterproductive to pursue two different approaches to modeling these networks, especially considering the richness of Myro/Conx and their ability to access the robot's vision and IR functions.
 
As regards the combination of IR and color tracking - there's no easy way to predict how that is going to work - you just have to build the network, feed it data, and provide a mechanism for error feedback so that the network can learn.  I know of 3 ways to approach this:
 
1.  build a set of training data that simulates different inputs and matches those with desired outputs - this is how you originally trained your network with the IR sensors
 
2.  simulate the robot's world, and evolve the robot's network with genetic algorithms, along with a fitness function to evaluate performance
 
3.  operate the robot in the real world, with a "supervisor" telling the robot when it has made good or bad decisions, and feed that "error signal" back into the neural net training.
 
 
You already have a pretty good idea of how to do #1.  The issue is that there is no learning - the model is based on static data.    
 
#2 involves the addition of a bunch of tools.  Webots is actually ideally suited for this type of modeling, as is the evorobot software - http://laral.istc.cnr.it/evorobot/simulator.html .  There's a new version of evorobot coming out soon, and the developers are already working with the SRV-1, so I look forward to seeing the new software.  The developers of Webots have likewise shown a lot of interest in this type of project, but there just hasn't be time to pursue it.
 
#3 is interesting, and we really should focus some effort there.  We can start with a network that is trained offline using #1 techniques, and then create a real-time feedback mechanism to evolve the network.  We should try a simple case first, just using IR or just using color.  In the color case, we should add size/count to x1, x2, y1, y2 in order to evolve behaviors that make the robot back off if it gets too close to the object.  
 
How's that sound ?
 
Back to top
 
 

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
localyodel
YaBB Newbies
*




Posts: 13
Re: Myro and ffnet
Reply #23 - 04/17/07 at 9:37am
 
This should get you to the code:
 
http://www.c-c-enterprises.com/srvone/srv1_nn.zip
 
Theoretically you should be able to execute the file capturebrain.py and srv should use ir to avoid and find colorblob zero.  capturebrain.py is the main file I have been working on it is still pretty rough.  There are other files being used and some of the code may be convoluted but if there are any questions or suggestions for improvement I'm all ears... or eyes I suppose.
 
That sounds great, I will have to think about #3 and do some reading/experimenting.  Do you have ideas as to how the feed back would be provided to the robot?
 
 
Jason
Back to top
 
 
  IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Myro and ffnet
Reply #24 - 04/17/07 at 10:04am
 
Quote:
That sounds great, I will have to think about #3 and do some reading/experimenting. Do you have ideas as to how the feed back would be provided to the robot?

 
Basically, you want to feed back the motor commands that the brain should have correctly issued.  From Python, I think you could do that with keyboard inputs or a modified version of the joystick command.  So if you use the keyboard, maybe with the numeric keypad for directions, the keystrokes would translate into desired motor values, and an error term would be computed for the difference between the motor values corresponding to the desired direction and the motor values output by the NN.  
 
Maybe each keystroke would be used to generate feedback for a fixed time period (500 milliseconds ?), and if there's no input, there's no feedback to update the NN (i.e. NN training only occurs when there is feedback input).  The "joystick" might be better, because it has a magnitude component, though there should be a way to emulate this with the keyboard.
Back to top
 
« Last Edit: 04/17/07 at 10:05am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
admin
YaBB Administrator
*****




Posts: 3676
Re: Myro and ffnet
Reply #25 - 04/18/07 at 3:38pm
 
Myro setup questions have been moved to This Thread
 
 
==========================================
 
Unfortunately, several messages with this thread got carried to the other thread.  Here were the messages
 
 
==========================================
 
The train.py runs fine.
But the source brain.py runs and after a while crashes with this error:
ans = net.call(robot.get("ir")) #Nework input
  File "C:\Python25\lib\site-packages\ffnet\ffnet.py", line 333, in call
    return self.__call__(inp)
  File "C:\Python25\lib\site-packages\ffnet\ffnet.py", line 327, in __call__
    self.inno, self.outno, self.eni, self.deo, inp)
error: failed in converting 8th argument `input' of _ffnet.normcall to C/Fortran array
 
I checked if ans == None: continue with no result. Every time it ends with the error above. Do you have any idea why
this is hapening?
Thanks,
Pavlos  
 
 
==========================================
 
 
Hello Pavlos,
 
I am guessing here... but I think this is because data transmitted back from the srv is corrupted.  Which seems to happen on occasion during transmission.  I don't think I have done any error handling in any of the code... Maybe pulling the call to robot.get("ir")) outside of the function and checking it instead of ans:
 
ir = robot.get("ir"))
 
and then check ir to see if it contains the proper values before passing it to the net.call(ir) function.
 
Jason  
 
==========================================
 
A quick comment on this - there should be some delay between calls to the IR function, at least on the order of 100-200 milliseconds.  I haven't tried to track this down, but I think that the circuitry n the IR detector operates in such a way that continuous incoming signals will eventually get filtered out, so there needs to be a gap between IR emissions.  Another possibility is that the uart buffer is overrun by the output from too many IR calls, which would show up as corrupted data in Myro - I've seen something equivalent happen when sending rapid "B" bounceIR commands from the keyboard.
 
Try putting a delay in your IR sensor loop to see if that makes any difference.  
 
SRV-1 Development Team
Surveyor Corporation
 
==========================================
Back to top
 
« Last Edit: 04/20/07 at 9:37am by admin »  

SRV-1 Development Team
Surveyor Corporation
Email WWW   IP Logged
sajid
YaBB Newbies
*




Posts: 3
Re: Myro and ffnet
Reply #26 - 09/12/07 at 8:23am
 
can some1 please talk me through this code?
FFNET is a brain for the robot, right?
 
inputs 0.3 is an ir reading when an object is close?
how do these correspond with an action? where the code that says 'don't collide into obstruction!'?
 
adjustL = 0.6
adjustR = 0.6
left & right motors?
 
anyone, ..in "xxx for Dummies" style
 
will be much appreciated
Back to top
 
 
  IP Logged
localyodel
YaBB Newbies
*




Posts: 13
Re: Myro and ffnet
Reply #27 - 09/12/07 at 5:26pm
 
Hi,
FFNET is a general purpose neural network package for python.  0.3 is the "true" threshold value for the ir sensors.  I believe the smaller the value the closer you are to the object.
 
The robot avoids objects by processing patterns created by the ir sensor array.  If an ir pattern occurs an output pattern is returned which corresponds to "don't collide".  So, the anti-collision logic is the relationship between the input pattern and the output pattern.  For example input is (0.3,0.3,0.3,0.3) which means all sensors are blocked so we will output (0,0) which corresponds to the motor command "do nothing".
 
adjustL and adjustR are adjustments for the nn output which are the motor inputs.
 
Someone correct me if I'm wrong as I am not an expert at this.
 
Hope this helps.
 
Jason
Back to top
 
 
  IP Logged
Pages: 1 2 
Send Topic Print