Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
pl:miw:miw08_mindstormscontrols [2008/04/07 21:03]
miw
pl:miw:miw08_mindstormscontrols [2019/06/27 15:50] (aktualna)
Linia 27: Linia 27:
  
  
 +===== 080408 =====
 +  * zapis protokołu kom w prologu tak jak poniżej
 +  * upload do wiki opisu FIXME
 +  * testy komunikacji,​ flush?
 +  * [[https://​akela.mendelu.cz/​swi-prolog/​syntax.html|zapis szesnastkowy w ISO Prologu]], proszę się upewnić, że to (hexy) się już nigdzie nie gubi przy ew. konwersji...
  
 +===== 080415 =====
 +  * test komunikacji!!!!!!!
 +  * całośc kom 2 kier na kilku poleceniach
  
  
 +====== Projekt ======
  
 +<​code>​
  
 +% C = getbatterylevel
 +%nxt_com(getbatterylevel,​ Ret) 
  
 +nxt_com(C) :- 
 +%  nxt_open(Fd),​
 +  nxt_prot(C, NxtCmd, RL), %Rl=4 bl
 +  nxt_send(Fd,​NxtCmd),​
 +  nxt_recv(Fd,​RL,​Resp),​
 +  nxt_resp(C, Resp, X). % X = VLMV
  
 +%nxt_open(Fd) :-
 +%
 +nxt_send(Fd,​NxtCmd) :-
  
 +nxt_recv(Fd,​R) :-
  
-===== 080408 ===== +nxt_resp(getbatterylevel
-  * zapis protokołu kom w prologu tak jak poniżej +</​code>​
-  * upload do wiki opisu FIXME +
-  * testy komunikacji,​ flush? +
-  * [[https://​akela.mendelu.cz/​swi-prolog/​syntax.html|zapis szesnastkowy w ISO Prologu]], proszę się upewnić, że to (hexysię +
-już nigdzie nie gubi przy ew. konwersji...+
  
 <​code>​ <​code>​
Linia 51: Linia 69:
 % czy porty dla sensorow sa abcd, czy 1,2,3,4? % czy porty dla sensorow sa abcd, czy 1,2,3,4?
 </​code>​ </​code>​
-Cytat+Z dokumentacji
-Byte 2: Output port (Range: 0 - 2) +  ​* ​Byte 2: Output port (Range: 0 - 2) 
-Byte 2: Input port (Range: 0 - 3)+  ​* ​Byte 2: Input port (Range: 0 - 3) 
 + 
 +Z nxt++: 
 +  * Motor  A - 0; 
 +  * Motor  B - 1; 
 +  * Motor  C - 2; 
 +  * Sensor 1 - 0; 
 +  * Sensor 2 - 1; 
 +  * Sensor 3 - 2; 
 +  * Sensor 4 - 3;
 <​code>​ <​code>​
 % póki co: % póki co:
Linia 97: Linia 124:
 nxt_run_state(motor_run_state_running,​ ['​\x20\'​]). nxt_run_state(motor_run_state_running,​ ['​\x20\'​]).
 nxt_run_state(motor_run_state_rampdown,​ ['​\x40\'​]). nxt_run_state(motor_run_state_rampdown,​ ['​\x40\'​]).
 +
 +% w nxt++ nie wysyłają na początku bajtu zerowego, to byłoby logiczne, ponieważ zawsze na początku będzie startprogram... :
  
 nxt_cmd(startprogram,​ ['​\x00\','​\x00\'​]). % czy dopisać wszędzie nxt_cmd(Cmd,​ ['​\x80\',​_]). ​ ??? nxt_cmd(startprogram,​ ['​\x00\','​\x00\'​]). % czy dopisać wszędzie nxt_cmd(Cmd,​ ['​\x80\',​_]). ​ ???
Linia 109: Linia 138:
 nxt_cmd(messagewrite,​ ['​\x00\','​\x09\'​]). nxt_cmd(messagewrite,​ ['​\x00\','​\x09\'​]).
 nxt_cmd(resetmotorposition,​ ['​\x00\','​\x0A\'​]). nxt_cmd(resetmotorposition,​ ['​\x00\','​\x0A\'​]).
 +nxt_cmd(getbatterylevel,​ ['​\x00\','​\x0B\'​]).
 +nxt_cmd(stopsoundplayback,​ ['​\x00\','​\x0C\'​]).
 +nxt_cmd(keepalive,​ ['​\x00\','​\x0D\'​]).
 +nxt_cmd(lsgetstatus,​ ['​\x00\','​\x0E\'​]).
 +nxt_cmd(lswrite,​ ['​\x00\','​\x0F\'​]).
 +nxt_cmd(lsread,​ ['​\x00\','​\x10\'​]).
 +nxt_cmd(getcurrentprogramname,​ ['​\x00\','​\x11\'​]).
 +nxt_cmd(messageread,​ ['​\x00\','​\x12\'​]).
  
 %% nxt_prot(+Command,​ -NxtCmd, +Port, +Type, +Mode, +Etc) %% nxt_prot(+Command,​ -NxtCmd, +Port, +Type, +Mode, +Etc)
 +
 +nxt_prot(startprogram,​ NxtCmd, FileName) :-
 + nxt_cmd(startprogram,​Cmd),​
 + ?
 +
 +nxt_prot(stopprogram,​ NxtCmd) :-
 + nxt_cmd(stopprogram,​ Cmd),
 + flatten([Cmd],​ NxtCmd).
 +
 +nxt_prot(playsoundfile,​ NxtCmd, Loop, FileName) :-
 + nxt_cmd(playsoundfile,​ Cmd),
 + boolean(Loop),​
 + LoopCmd = Loop,
 + ?
 +
 +nxt_prot(playtone,​ NxtCmd, Frequency, Duration) :-
 + nxt_cmd(playtone,​ Cmd),
 + FrequencyCmd1 is Frequency mod 256,
 + FrequencyCmd2 is (Frequency - (Frequency mod 256)) / 256, % wzięte z nxt++
 + DurationCmd1 is Duration mod 256,
 + DurationCmd2 is (Duration - (Duration mod 256)) / 256,
 + flatten([Cmd,​ FrequencyCmd1,​ FrequencyCmd2,​ DurationCmd1,​ DurationCmd2],​ NxtCmd). % <- poprawić na listy!
  
 nxt_prot(setoutputstate,​ NxtCmd, Port, PowerSetPoint,​ Mode, RegulationMode,​ TurnRatio, RunState, TachoLimit) :- nxt_prot(setoutputstate,​ NxtCmd, Port, PowerSetPoint,​ Mode, RegulationMode,​ TurnRatio, RunState, TachoLimit) :-
Linia 145: Linia 204:
  nxt_port(Port,​ PortCmd),  nxt_port(Port,​ PortCmd),
  flatten([Cmd,​ PortCmd], NxtCmd).  flatten([Cmd,​ PortCmd], NxtCmd).
- 
-nxt_prot(resermotorposition,​ NxtCmd, Port, IsRelative) :- 
- nxt_cmd(resermotorposition,​ Cmd), 
- nxt_port(Port,​ PortCmd), 
- boolean(IsRelative),​ 
- flatten([Cmd,​ , Port, IsRelative],​ NxtCmd). 
  
 nxt_prot(messagewrite,​ NxtCmd, Inbox, Size,Data) :- nxt_prot(messagewrite,​ NxtCmd, Inbox, Size,Data) :-
Linia 159: Linia 212:
  Size < 60, % vide doc!  Size < 60, % vide doc!
  flatten([Cmd,​Inbox,​Size,​Data],​NxtCmd).  flatten([Cmd,​Inbox,​Size,​Data],​NxtCmd).
 +
 +nxt_prot(resermotorposition,​ NxtCmd, Port, IsRelative) :-
 + nxt_cmd(resermotorposition,​ Cmd),
 + nxt_port(Port,​ PortCmd),
 + boolean(IsRelative),​
 + IsRelativeCmd = IsRelative,
 + flatten([Cmd,​ , PortCmd, IsRelativeCmd],​ NxtCmd).
 +
 +nxt_prot(getbatterylevel,​ NxtCmd) :-
 + nxt_cmd(getbatterylevel,​ Cmd),
 + flatten([Cmd],​ NxtCmd).
 +
 +nxt_prot(stopsoundplayback,​ NxtCmd) :-
 + nxt_cmd(stopsoundplayback,​ Cmd),
 + flatten([Cmd],​ NxtCmd).
 +
 +nxt_prot(keepalive,​ NxtCmd) :-
 + nxt_cmd(keepalive,​ Cmd),
 + flatten([Cmd],​ NxtCmd).
 +
 +nxt_prot(lsgetstatus,​ NxtCmd, Port) :-
 + nxt_cmd(lsgetstatus,​ Cmd),
 + nxt_port(Port,​ PortCmd),
 + flatten([Cmd,​ PortCmd], NxtCmd).
 +
 +nxt_prot(lswrite,​ NxtCmd, Port, TxDataLenght,​ RxDataLength,​ TxData) :-
 + nxt_cmd(lswrite,​ Cmd),
 + nxt_port(Port,​ PortCmd),
 + length(TxData,​L),​
 + TxDatalength is L + 4,
 + TxDataLength < (no właśnie, ile?),
 + flatten([Cmd,​ Port, TxDataLength,​ RxDataLength,​ TxData], NxtCmd).
 +
 +nxt_prot(lsread,​ NxtCmd, Port) :-
 + nxt_cmd(lsread,​ Cmd),
 + nxt_port(Port,​ PortCmd),
 + flatten([Cmd,​ PortCmd], NxtCmd).
 +
 +nxt_prot(getcurrentprogramname,​ NxtCmd) :-
 + nxt_cmd(getcurrentprogramname,​ Cmd),
 + flatten([Cmd],​ NxtCmd).
 +
 +nxt_prot(mesageread,​ NxtCmd, RemoteInbox,​ LocalInbox, Remove) :-
 + nxt_cmd(messageread,​ Cmd),
 + integer(RemoteInbox),​ RemoteInbox >= 0, RemoteInbox < 10,
 + integer(LocalInbox),​ LocalInbox >= 0, LocalInbox < 10,
 + boolean(Remove),​
 + RemoveCmd = Remove,
 + flatten([Cmd,​ RemoteInbox,​ LocalInbox, Remove], NxtCmd).
 +
 +
  
 % tu nalezy jeszcze sprawdzic null termination vide dokuemntacja,​ ew dodac jak go nie ma! % tu nalezy jeszcze sprawdzic null termination vide dokuemntacja,​ ew dodac jak go nie ma!
Linia 177: Linia 281:
 FIXME: proszę dopisać URL gdzie za strony LEGO Pan to pobrał, czy to jest w BT dev guide? FIXME: proszę dopisać URL gdzie za strony LEGO Pan to pobrał, czy to jest w BT dev guide?
  
-====== Projekt ======+
 ===== Milestones ===== ===== Milestones =====
   * komunikacja z nxt z prolog, potrafimy wyslac trywialne rozkazy, np. obroc silniczkem nr. 2   * komunikacja z nxt z prolog, potrafimy wyslac trywialne rozkazy, np. obroc silniczkem nr. 2
pl/miw/miw08_mindstormscontrols.1207594993.txt.gz · ostatnio zmienione: 2019/06/27 15:58 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0