robots

Lego mindstorms is the basic simple starting kit for building robots. many people tho are part of bot ball probably owned this kit.

Lego NXT is Lego's new robot controller. its designed to support 4 sensors that are more similar to the ones used in botball than the previous mindstorms kit. it also uses 4 servomotors with is more capable than the previous mindstorms kit.

www.legoeducation.com  is a great place for buying kits for educational purposes.

Some source codes for the robots: Botball: // Botball utility routines // (c) D.P.Miller, 2002, KISS Institute for Practical Robotics // (c) Randy Sargent, 2003, KISS Institute for Practical Robotics // // Routines to wait for the light to turn on in Botball, and to // stop the robot after the contest. /* Using the routines in this library, you should insert the following two lines at the beginning of your "main": wait_for_light(2); // Light sensor in channel 2 shut_down_in(89.0); // Shut down the robot in 89 seconds Be sure to only call "shut_down_in" once. The expected for "wait_for_light" is: 1) Turn on start light and call this function 2) Press start button 3) Turn off start light 4) press stop button At this point the routine will either give a happy message, play a constant buzz sound and wait for the light to come back on (whereupon the function returns) OR it will give a sad message with a recommendation, play a klaxon tone sequence and hang -- forcing the HB to be reset. */ void wait_for_light(int light_port_) { int l_on_, l_off_, l_mid_, t; /* print statements may look funny but are spaced for LCD*/ printf ("Cal. with sensoron port #%d\n", light_port_); sleep(2.); printf("Cal: press startwhen light on\n"); while(!start_button()); l_on_=analog(light_port_); /*sensor value when light is on*/ beep(); printf("Cal: light on value is=%d\n", l_on_); sleep(1.); beep(); printf("Cal: press stop when light off\n"); while(!stop_button()); l_off_=analog(light_port_); /*sensor value when light is off*/ beep(); printf("Cal: light off value is=%d\n", l_off_); sleep(1.); beep(); if((l_off_-l_on_)>=15){ /*bright = small values */ l_mid_=(l_on_+l_off_)/2; printf("Good CalibrationDiff=%d Waiting\n",(l_off_-l_on_)); while(analog(light_port_)>l_mid_) tone(440.,0.1); } else{ if(l_off_<128){ printf("Bad Calibration Add Shielding!!\n"); while(1) /*never terminate */ for(t=100; t<10000; t=t+200) tone((float)t,0.05); } else{ printf("Bad Calibration Aim sensor!!\n"); while(1) /*never terminate */ for(t=10000; t>200; t=t-200) tone((float)t,0.05); } } }
// // Function: shut_down_in(float: delay) // // This function will start a background process which sleeps for "delay", // then stops the motors and kills all other processes. // // This function cannot work if another process continually calls // "hog_processor", since the background task will never gain control. // // This function may not work if more than 1000 processes have been // created between the original call to "shut_down_in" and when the delay // is finished. // int Bb_Game_Over=0; /* global flag*/ int _shut_down_pid; void shut_down_in(float delay) { Bb_Game_Over= 0; printf("shut_down_in%f\n", delay); _shut_down_pid= start_process(_shut_down_task(delay)); } void _shut_down_task(float delay) { int i,j; sleep(delay); hog_processor(); ao(); Bb_Game_Over= 1; printf("Game over"); i= 0; for (j= 256; j <= 1024; j+=256) { hog_processor(); ao(); while (i < j) { kill_process(_shut_down_pid+(++i)); kill_process(_shut_down_pid-i); } } printf(".\n"); } Table: /* table.ic This program runs the table lights for Botball 2003. (C) 2003 KIPR, Dave Miller */ #define ON_LIGHT digital(7) #define OFF_LIGHT digital(15) void turn_on() {fd(0);fd(1);fd(2);fd(3);} void sleep_count(int starting, int length){ int i; for(i=starting; i<(starting+length);i++){ printf("%d seconds left\n", 90-i); sleep(1.0); } } void main() { int i; int gutter_side=0; while(1){ /*printf("D7-ON D15-OFF Start for Paper\n"); while(!start_button()){ if(ON_LIGHT){fd(0);fd(1);fd(2);fd(3);} if(OFF_LIGHT) ao(); } beep(); printf("Selecting Paper to Remove...\n"); sleep(1.); gutter_side=(int)(seconds()*10.0)%2; if(gutter_side) printf("Remove Paper on Gutter Side\n"); else*/ printf("Ready for Game Push Start\n"); while(!start_button()); //wait for start button for(i=4;i>0;i--){ printf("starting in %d...\n",i); beep(); sleep(1.0); } turn_on(); sleep_count(0,5); //sleep(5.0); //lights on for 5 secs ao(); sleep_count(5,55);//lights off for 55 secs turn_on(); sleep_count(60,25);//lights on for 25 secs printf("flashing last 5\n"); flash(5.0); //lights flash for 5 secs ao(); printf("Game Over!!!\n"); beep(); beep(); beep(); sleep(2.0); } } void flash(float ftime) { int i; while(ftime > 1.0){ turn_on(); sleep(ftime/10.0); ftime=ftime-ftime/10.0; ao(); sleep(ftime/10.0); ftime=ftime-ftime/10.0; } for(i=0;i<5;i++){ turn_on(); sleep(0.1); ao(); sleep(0.1); } ao(); }
made with wc3made with nvumade with gimp
Members | Pictures | RobotsHome