To jest stara wersja strony!
Opis
Spotkania
08.02.26
08.03.04
080318
Po namyśle: zdecydowanie chcemy, żeby Pana program docelowo chodził pod linuxem i windows.
Kwestie otwarte to:
Kod dziala w ten sposob, ze wystawia na socket (na wybranym porcie) polaczenie, ktore oczekuje na polaczenia od klientow. Po zainicjalizowaniu polaczenia, klient przesyla polecenia, ktore maja zostac wykonane przez robota. Na potrzeby komunikacji serwer ↔ klient zostal stworzony i zaimplementowany stosowny protokol (ponizej jego opis) wedlug ktorego nastepuje komunikacja.
Źródła projektu
Opis protokolu
NXT modul:
Possible commands:
command | return | description |
nxt; open | — | Initiates the NXT connection |
nxt; close | — | Closes the NXT connection |
nxt; batteryLevel | value | Returns the current battery level |
nxt; getName | value | Gets the name of the NXT |
nxt; startProgram; name | — | Starts a program on the NXT with a specified name |
nxt; stopProgram | — | Stops the current program if one is running |
nxt; playTone | — | Plays a tone |
nxt; playSoundFile; name, loop | — | Plays a sound file on the NXT with a specified name |
nxt; stopSound | — | Stops the currently playing sound |
Description arguments:
Possible replies:
ok
ok: [what]
err
err: not_enable_interface
err: unknown_module: [what]
err: unknown_command: [what]
err: wrong_params: [what]
Motor modul:
Possible commands:
command | return | description |
motor; getRotationCount; portNr | value | motor; getRotationCount; portNr |
motor; resetRotationCount; portNr; relative | — | Resets the specified motor's rotation count |
motor; setForward; portNr; power | — | Sets a motor to turn forward at a specified power |
motor; setReverse; portNr; power | — | Sets a motor to turn backward at a specified power |
motor; stop; portNr; brake | — | Tells a motor to stop turning |
motor; breakOn; portNr | — | Tells a motor to turn the brake on |
motor; breakOff; portNr | — | Tells a motor to turn the brake off |
motor; goTo; portNr; power; tacho; brake | — | Tells a motor to go to a certian angle and then stop |
Description arguments:
Possible replies:
ok
ok: [what]
err: not_enable_interface
err: unknown_module: [what]
err: unknown_command: [what]
err: wrong_params: [what]
Sensor modul:
Possible commands:
command | return | description |
sonar; setTouch; portNr | — | Sets a sensor in a specified port to a touch sensor |
sonar; setSound; portNr | — | Sets a sensor in a specified port to a sound sensor |
sonar; setLight; portNr, active | — | Sets a sensor in a specified port to a light sensor |
sonar; setSonar; portNr | — | Sets a sensor in a specified port to a sonar sensor |
sonar; setRaw; portNr | — | Sets a sensor to return a raw value |
sonar; getValue; portNr | value | Retrieves the value of a sensor |
sonar; lsGetStatus; portNr | value | Gets the status of the lowspeed port |
sonar; getSonarValue; portNr | value | Retrieves the value for sonar sensors |
sonar; setSonarOff; portNr | — | Tells the sonar sensor to stop sending pulses |
sonar; setSonarSingleShot; portNr | — | Tells the sonar sensor to only send a pulse when you ask it what it's value is |
sonar; setSonarContinuous; portNr | — | Tells the sonar sensor to continuously send pulses |
sonar; setSonarContinuousInterval; portNr, interval | — | Sets the interval at which the sonar sensor sends a pulse |
Description arguments:
Possible replies:
ok
ok: [what]
err: not_enable_interface
err: unknown_module: [what]
err: unknown_command: [what]
err: wrong_params: [what]
Wstepne testy wykazaly poprawnosc dzialania kodu (przetestowane funkcje dzialaly zgodnie z zalozeniami i potrafily wykonywac rozne operacja z wykorzystaniem robota).
Kod zostal napisany pod Linuxem z wykorzystaniem socketow dostarczanych przez ten wlasnie system. W zwiazku z koniecznoscia dzialania kodu takze na systemach rodziny windows dokonano prob uruchomienia napisanego kodu z wykorzystaniem srodowisk Cygwin i MinGW. W obu przypadkach proby zakonczyly sie niepowodzeniem. Nawet maksymalna ilosc dostepnych pakietow w srodowisku Cygwin nie pozwolila na uruchomienie kodu. Powodem byl problem z kompilacja bliblioteki nxtpp (bylo to niemozliwe zarowno za pomoca linkowania zbudowanych bibliotek *.lib dla windows jak i niepowodzeniem konczyla sie proba zbudowania samych pakietow nxtpp).
W zwiazku z powyzszym, aby mozna bylo uruchamiac kod zarowno na systemach linux jaki i windows postanowiono przepisac czesc kodu odpawiadajaca komunikacji sieciowej, z wykorzystaniem najnowszej wersji biblioteki asio boost'a (www.boost.org) - w trakcie realizacji.
Materiały