*** ZERO_2 Control program *** For QL running in QPCII emulator v5.7 ============================================= Notes ----- WINDOW width, depth, @ x, y in pixels BORDER [channel,] size [, colour] CSIZE [channel,]- width, height width size height size· 0 6 pixels 0 10 pixels 1 8 pixels 1 20 pixels 2 12 pixels 3 16 pixels The QPC display driver assumes that all characters are 5 pixels wide by 9 pixels high X Y @x @y 0 cmnd 417, 38, 85,218 'at bottom 1, 417,170, 85, 46 'same as help_win 2, 417,170, 85, 46 'same as help_win 3 zchan serial port to robot seria1 4 memchan For saving to memory file 5 6 full_win, 512,256, 0, 0 7 title_win,388, 24, 60, 4 'program name 8 robot_win, 68, 38, 10,215 'bottom left 9 step_win, 66, 14, 85, 30 'top left 10 inf_win, 227, 14,152, 30 'top middle 11 list_win, 68,184, 10, 30 'at LHS 12 drg_win, 417,170, 85, 46 'window 2 13 help_win, 417,170, 85, 46 'window 2 14 mind_win, 68, 14,381, 30 'top right 15 Log ============================================= New --- ============================================= *** INITIALISATION *** init_globals coldinit zinit 'USER - initialise robot --------------------------------------------- *** ERROR RECOVERY *** oops 'USER ErrorMsg(errortxt$,errorval) --------------------------------------------- *** SYSTEM *** QUIT 'USER - quit program, closing memory files help 'USER waitNoKey fn_wait_key$(msg$) strip_spaces$ ( word$ ) 'strip leading spaces alert 'USER - PC sound buzz 'USER - PC sound noRobot 'USER - run program with no robot doRobot 'USER - connect to robot drawR 'USER draw robot USER nodrawR 'USER don't draw robot noindex 'USER - autoplay :index off, border Mind window white doindex 'USER - autoplay :index on, border Mind window red --------------------------------------------- *** PROCESSING LINK *** processing_link (cmnd$,cmnd_code,cmnd_value) (link robot control procedures to other processes) --------------------------------------------- *** SKILLS *** A ( angle ) 'USER set param_A D ( distance ) 'USER set param_D sline 'USER search for line A,D line_search_swing ( ang ) fline r =dist 'USER follow line for D or to end flineEnd r =dist 'USER follow line to end flineq r =dist 'USER follow line quickly for D or to end --------------------------------------------- *** ROBOT-SENSE *** senseline 'USER (long form of sl) sl 'USER sense line, z is sensor D2,D1,D0 --------------------------------------------- *** ROBOT-CONTROL *** robot_whereabouts (cmnd_code, cmnd_value) waitZrdy 'wait '>' emptyZchan 'emptyy serial input buffer * ROBOT MIND * zz 'USER - stop robot s (cmnd_value) 'USER - speed play 'USER head (heading) 'USER home 'USER - go home unwind 'USER ihome 'USER - initialise home position to current sb(cmnd_value) 'USER - not implemented jc 'USER - joystick control msg (msg$) 'USER - send msg$ to Arduino toX 'USER - set X goal toY 'USER - set Y goal goXY 'USER - go to X,Y goals toHere 'USER - get current location and goXY atName 'USER - get a name to be printed on map doatName ( cmnd$ ) goname 'USER dogoname ( cmnd$ ) * ROBOT BODY * FD 'USER - millimetres BK 'USER - millimetres RT 'USER - degrees LT 'USER - degrees fr (cmnd_value) 'USER fl (cmnd_value) 'USER br (cmnd_value) 'USER bl (cmnd_value) 'USER peninit 'USER - for old Zero2 pd 'USER - pen down pu 'USER - pen up lr <0.1> 'USER - right LED ll <0.1> 'USER - left LED lo 'USER - LEDs off ls <0-3> 'USER - LEDs hl <0.1> 'USER - horn high tone hh <0,1> 'USER - horn high tone ho 'USER - horn off hn <0-3> 'USER - horn tones wt 'USER - 50ths second hoot 'USER flsh 'USER flht 'USER --------------------------------------------- *** SHORT-TERM-MEMORY *** learn 'USER nolearn 'USER forget 'USER remember_move (cmnd$) rlist 'USER ralter 'USER rfix 'USER rsave 'USER compact 'USER - join repeated commands * SHORT-TERM MEMORY TESTING * replay 'USER - select step range to play bplay 'USER - select step range to reverse play do_steps ( direction ) play_steps ( direction, step_dir, first_step, last_step ) rstep 'USER unlearn 'USER jump 'USER - '!' insert a jump to another Act doPling --------------------------------------------- *** LONG-TERM-MEMORY *** mind 'USER - '/' insert a change to another Mind doMind mlist 'USER list_cmnds (title_msg$, cmnd_list$) exec_cmnd (cmnd_string$) get_cmnd_num ( cmnd$, ) get_cmnd_val ( cmnd$, ) get_cmnd_name ( cmnd$ ) exec_reverse_cmnd (cmnd_string$) mnames 'USER - list names in current Mind (in memory) mexec 'USER - execute an Act in current Mind exec_Act (cmnd_num) get_Act_start ( cmnd_num ) get_Act_length (cmnd_num ) mget 'USER - copy the commands in an Act to short term memory GetAct 'USER - '^' command, insert an upload Act command doGetAct (name$) get_cmnd_list$ (name$) mclear 'USER - clear current Mind get_mind (name$) getMinds 'build Minds$ from Zminds file Minds 'USER - list Minds Mmake 'USER - create a mind file and update file Zminds Mind1 'USER - change mind to Mind1 Mhanoi 'USER - change mind to MHanoi --------------------------------------------- *** DISPLAY PROCESING *** init_windows display_moves (cmnd$) learning_screens (state) help_scrn help_scrn_1 help_scrn_1a help_scrn_2 help_scrn_2a help_scrn_2b help_scrn_0 help_scrn_3 help_scrn_3a help_scrn_4 names 'USER - print place names on map nonames 'USER - no names on map imap 'USER - redraw with robot at centre smap 'USER - scale map cmap 'USER - clean map drg_scrn draw_move (cmnd_code, cmnd_value) print_robot_position draw_robot --------------------------------------------- *** DEBUG *** h - load mind Hanoi, exec_Act "hanoi" =============================================