Changeset 890
- Timestamp:
- 09/14/10 01:40:17 (3 years ago)
- Location:
- trunk/tools/MotorControl
- Files:
-
- 1 removed
- 4 modified
-
CompileAndTransferMotorControlToNXT.bat (modified) (2 diffs)
-
CompileMotorControlHere.bat (modified) (1 diff)
-
MotorControl21.rxe (deleted)
-
MotorControl22.nxc (modified) (33 diffs)
-
TransferMotorControlBinaryToNXT.bat (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/MotorControl/CompileAndTransferMotorControlToNXT.bat
r776 r890 31 31 32 32 echo. 33 echo This program compiles and downloads MotorControl2 1.nxc33 echo This program compiles and downloads MotorControl22.nxc 34 34 echo to the NXT brick. Please connect a single NXT brick 35 35 echo via a USB cable and turn it on. 36 echo Make sure Firmware 1.2 6(or higher) is installed on the NXT.36 echo Make sure Firmware 1.28 (or higher) is installed on the NXT. 37 37 echo After a successful download the NXT will beep once... 38 38 echo. … … 44 44 echo. 45 45 46 nbc -d -S=usb -v=126 MotorControl2 1.nxc46 nbc -d -S=usb -v=126 MotorControl22.nxc 47 47 48 48 -
trunk/tools/MotorControl/CompileMotorControlHere.bat
r777 r890 31 31 echo Compiling... 32 32 33 nbc -v=126 -o=MotorControl2 1.rxe MotorControl21.nxc33 nbc -v=126 -o=MotorControl22.rxe MotorControl22.nxc 34 34 35 35 -
trunk/tools/MotorControl/MotorControl22.nxc
r889 r890 7 7 % this case, MATLAB) to carry on with execution... 8 8 % 9 % See also: http://www.mindstorms.rwth-aachen.de/trac/wiki/MotorControl 10 % 11 % CHANGELOG: 12 % 13 % * Version 2.2, 2010/09/14 14 % First released with toolbox version 4.04 15 % - Commented dead code in case compiler optimization doesn't find it 16 % - No real code changes 17 % - Version to be recompiled with newer NBC/NXC compiler versions, 18 % as some multi-threading / optimization bugs were fixed. 19 % - Not recommending FW version 1.26 anymore 20 % - Updated version numbers 21 % 22 % * Version 2.1, 2009/08/31 23 % First released with toolbox version 4.01 24 % - Considered to be stable and working 25 % - Very occasional freezes with FW 1.26 during 26 % massive production use, see also: 27 % http://www.mindstorms.rwth-aachen.de/trac/ticket/51 28 % 9 29 % 10 30 % Signature 11 31 % Author: Linus Atorf (see AUTHORS) 12 % Date: 20 09/08/2113 % Copyright: 2007-20 09, RWTH Aachen University32 % Date: 2010/09/14 33 % Copyright: 2007-2010, RWTH Aachen University 14 34 % 15 35 % … … 34 54 // important to be before includes, 35 55 // since they might be used inside the includes! 36 #define PROGRAM_VERSION "2. 1"56 #define PROGRAM_VERSION "2.2" 37 57 38 58 #define INBOX 1 … … 117 137 tmp = StrCat("MotorControl ", PROGRAM_VERSION); 118 138 TextOut(0,LCD_LINE1, tmp, true); 119 TextOut(0,LCD_LINE2, "for FW 1.2 6-1.28", false);139 TextOut(0,LCD_LINE2, "for FW 1.28-1.29", false); 120 140 121 141 TextOut(3,LCD_LINE4, "(C) RWTH Aachen", false); … … 124 144 TextOut(4,LCD_LINE7, "Press ORANGE to", false); 125 145 TextOut(4,LCD_LINE8, "stop all motors", false); 126 127 146 147 128 148 #ifdef ENABLEDEBUGGING_LCD_SLOW_ANTIBUG 129 149 TextOut(0, LCD_LINE8, "SLOW ANTIBUG ON ", true); 130 150 #endif// - - - - - - - 131 151 132 152 }//end void 133 153 … … 147 167 148 168 taskArunning = true; 149 169 150 170 bool stoppedByDirectCmd; 151 171 stoppedByDirectCmd = RunMotorA(OUT_A, motorParamsA.power, motorParamsA.tacholimit, motorParamsA.speedreg, motorParamsA.holdbrake, motorParamsA.smoothstart); 152 172 153 173 // if we exited from external NXTMotor.Stop command, we might've overwritten 154 174 // the power value before exiting the main controller loop, so restore defined … … 161 181 }//end if 162 182 }//end if 163 183 164 184 taskArunning = false; 165 185 166 186 //Release(movingA); 167 187 //TextOut(0,LCD_LINE6, "Task A stopped"); … … 208 228 TextOut(0,LCD_LINE7, tmp); 209 229 #endif 210 211 230 231 212 232 taskBrunning = false; 213 233 //Release(movingB); … … 224 244 bool stoppedByDirectCmd; 225 245 stoppedByDirectCmd = RunMotorC(OUT_C, motorParamsC.power, motorParamsC.tacholimit, motorParamsC.speedreg, motorParamsC.holdbrake, motorParamsC.smoothstart); 226 246 227 247 // if we exited from external NXTMotor.Stop command, we might've overwritten 228 248 // the power value before exiting the main controller loop, so restore defined … … 235 255 }//end if 236 256 }//end if 237 257 238 258 taskCrunning = false; 239 259 … … 248 268 taskSyncRunning = true; 249 269 #endif 250 270 251 271 bool stoppedByDirectCmd; 252 272 … … 303 323 //Release(movingC); 304 324 }//end if 305 325 306 326 #ifdef ENABLEDEBUGGING_SHOWTASKS 307 327 taskSyncRunning = false; … … 336 356 337 357 338 358 /* 339 359 task dummyA() { 340 360 int i = 0; … … 386 406 }//end while 387 407 }//end task 388 408 */ 389 409 390 410 … … 396 416 // main task 397 417 398 418 /* 399 419 task TESTmain() { 400 420 … … 428 448 ResetErrorCorrectionAndBlockCount(OUT_B); 429 449 ResetErrorCorrectionAndBlockCount(OUT_C); 430 450 431 451 432 452 Wait(1100); … … 450 470 motorParamsB.holdbrake = false; 451 471 motorParamsB.smoothstart = true; 452 472 453 473 motorParamsC.power = 100; 454 474 motorParamsC.tacholimit = 1000; … … 460 480 start MoveB; 461 481 start MoveC; 462 482 463 483 //Wait(4000); 464 484 … … 467 487 468 488 469 489 470 490 471 491 472 492 }//end task 473 493 */ 474 494 475 495 … … 493 513 byte port1; 494 514 byte port2; 495 515 496 516 const byte bit1 = 1; 497 517 const byte bit2 = 2; 498 518 const byte bit3 = 4; 499 519 500 520 501 521 string tmp = ""; … … 562 582 switch (packetType) { 563 583 case PROTO_CONTROLLED_MOTORCMD: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 564 584 565 585 // parse... 566 586 tmp = SubStr(in, 1, 1); // pos 1 … … 575 595 tmp = SubStr(in, 11, 1); // pos 11 576 596 modebits = StrToNum(tmp); 577 597 578 598 579 599 // process... … … 677 697 break; 678 698 case PROTO_RESET_ERROR_CORRECTION: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 679 699 680 700 tmp = SubStr(in, 1, 1); // pos 1 681 701 port = StrToNum(tmp); 682 702 683 703 if (port <= 2) { 684 704 ResetErrorCorrectionAndBlockCount(port); … … 700 720 break; 701 721 case PROTO_ISMOTORREADY: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 702 722 703 723 tmp = SubStr(in, 1, 1); // pos 1 704 724 port = StrToNum(tmp); 705 725 706 726 // send answer string: portnum, then if ready or not 707 727 if (IsMotorReady(port)) { … … 711 731 }//end if 712 732 SendMessage(OUTBOX, tmp); 713 733 714 734 break; 715 735 case PROTO_CLASSIC_MOTORCMD: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 716 736 717 737 // parse... 718 738 tmp = SubStr(in, 1, 1); // pos 1 … … 744 764 745 765 if (port <= 2) { 746 766 747 767 // if no current tacholimit and no new one, allow speed change 748 768 if ((MotorTachoLimit(port) == 0) && (angle == 0)) { … … 803 823 TaskBusySignal(); 804 824 }//end if 805 825 806 826 }//end if 807 827 808 828 }//end if 809 810 829 830 811 831 break; 812 832 }//end switch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 813 814 833 834 815 835 // reset message !!!! 816 836 in = ""; … … 827 847 PlayTone(440, 500); 828 848 Wait(100); 829 849 830 850 // release all motors again 831 851 MotorOff(OUT_A); 832 852 MotorOff(OUT_B); 833 853 MotorOff(OUT_C); 834 854 835 855 TextOut(5,LCD_LINE7, "EMERGENCY STOP ", false); 836 856 TextOut(2,LCD_LINE8, "Restart program! ", false); 837 857 Wait(2500); 838 858 StopAllTasks(); 839 859 840 860 /* 841 861 // keep … … 847 867 Wait(500); 848 868 }//end while 849 869 850 870 // purge incoming queue... 851 871 in = "..."; … … 854 874 }//end while 855 875 in = ""; 856 876 857 877 // manually reset task-semaphores 858 878 // not very clean, but this button is for emergencies anyway... … … 860 880 taskBrunning = false; 861 881 taskCrunning = false; 862 882 863 883 // reset counters for a nice clean start 864 884 ResetErrorCorrectionAndBlockCount(OUT_A); … … 867 887 */ 868 888 }//end if 869 870 889 890 871 891 // debugging 872 892 #ifdef ENABLEDEBUGGING_SHOWTASKS … … 876 896 string tmpC = "_ "; 877 897 string tmpSync = "____ "; 878 898 879 899 if (taskArunning) tmpA = "A "; 880 900 if (taskBrunning) tmpB = "B "; 881 901 if (taskCrunning) tmpC = "C "; 882 902 if (taskSyncRunning) tmpSync = "Sync "; 883 903 884 904 taskMsg = StrCat(tmpA, tmpB, tmpC, tmpSync); 885 905 … … 888 908 889 909 }//end while 890 910 891 911 892 912 TextOut(0,LCD_LINE1, "MainLoop exit", true); 893 913 PlayTone(500, 1000); 894 914 Wait(5000); 895 896 915 916 897 917 }//end task 898 918 -
trunk/tools/MotorControl/TransferMotorControlBinaryToNXT.bat
r777 r890 7 7 8 8 if not exist NeXTTool.exe goto nexttoolmissing 9 if not exist MotorControl2 1.rxe goto binarymissing9 if not exist MotorControl22.rxe goto binarymissing 10 10 11 11 goto download … … 40 40 41 41 echo. 42 echo This program downloads MotorControl2 1.rxe42 echo This program downloads MotorControl22.rxe 43 43 echo to the NXT brick. Please connect a single NXT brick 44 44 echo via a USB cable and turn it on. 45 echo Make sure Firmware 1.2 6(or higher) is installed on the NXT.45 echo Make sure Firmware 1.28 (or higher) is installed on the NXT. 46 46 echo. 47 47 … … 51 51 echo Transferring program... 52 52 53 NeXTTool /COM=usb -download=MotorControl2 1.rxe53 NeXTTool /COM=usb -download=MotorControl22.rxe 54 54 55 55 echo Verifying download... 56 56 echo. 57 57 echo If the next paragraph shows 58 echo MotorControl2 1.rxe=xxxxx58 echo MotorControl22.rxe=xxxxx 59 59 echo then everything worked. 60 60 echo A blank line indicates failure! 61 61 echo. 62 62 63 NeXTTool /COM=usb -listfiles=MotorControl2 1.rxe63 NeXTTool /COM=usb -listfiles=MotorControl22.rxe 64 64 65 65
