Sunday, August 2, 2009

Any simple sample source code to program sumo robot?

i am new to robot .Now my project is to program a sumo robot with four line sensors and four opponent sensors, using c programming language with pic 18f452.My problem is that line sensors and object sensors are read in by sepearate routines and cannot be read together.how can i do that?

Any simple sample source code to program sumo robot?
I am not sure exactly what you mean by your problem -- that the instructor requires you to read these inputs with seperate routines, or that the hardware is preventing you from reading them with one routine.





If the instructor wants you to read the sensors using different routines but all of the sensor output bits are on a single port, all you need to do is have two different routines which each read the port and mask some of the bits off using the logical AND function.





If the problem is that you want a single routine to read the values from different ports, I would have one routine which reads the line sensors, and have that routine called from within the routine that reads the opponent sensors. The opponent-sensor routine first checks for lines by calling the line-sensor routine, stores the results, then checks the opponent-sensors, and finally combines the line-sensor results with the opponent-sensor results before returning the function value.





Here is a page with some C routines for a PIC based sumo robot, this might help:


http://coledd.com/electronics/pic/code/





This page also has some C source code for reading object sensors (such as would be used to sense the oponent) on a PIC:


http://www.picant.com/c2c/examples.html


Near the end you will see links for "Delta Force Mini Sumo Robot" and "Line Follower Robot" by 56krf@wa4dsy.net, these may be very helpful to you.


No comments:

Post a Comment