Aldebaran Robots Programmbeispiele: Unterschied zwischen den Versionen
(Die Seite wurde neu angelegt: „=Allgemeines= Ich weiß noch nicht so recht wie ich diese Seite(n) gestalten soll. Ich habe schon viele Programme aus dem Aldebaran Store, von Github und ander…“) |
|||
Zeile 3: | Zeile 3: | ||
Ich koennte mir vorstellen, jedes Programm hier im Wiki mit einer Art Steckbrief zu versehen, so dass man moeglichst schnell einen Eindruck des Umfangs und der Leistung bekommt. Dazu koennte ich mir vorstellen einen Parser für die CRG-Files zu schreiben der einem das Grundgeruest des Steckbriefes liefert. | Ich koennte mir vorstellen, jedes Programm hier im Wiki mit einer Art Steckbrief zu versehen, so dass man moeglichst schnell einen Eindruck des Umfangs und der Leistung bekommt. Dazu koennte ich mir vorstellen einen Parser für die CRG-Files zu schreiben der einem das Grundgeruest des Steckbriefes liefert. | ||
+ | |||
+ | Ich fang mal an einzelne Codeschnipsel zu kommentieren. | ||
+ | |||
+ | =AIDA-bot (Github)= | ||
+ | ==Random-Box= | ||
+ | |||
+ | [[Datei:Screenshot 20230223 220616.png]] | ||
+ | |||
+ | <pre> | ||
+ | class MyClass(GeneratedClass): | ||
+ | def __init__(self): | ||
+ | GeneratedClass.__init__(self) | ||
+ | |||
+ | def onLoad(self): | ||
+ | #put initialization code here | ||
+ | pass | ||
+ | |||
+ | def onUnload(self): | ||
+ | #put clean-up code here | ||
+ | pass | ||
+ | |||
+ | def onInput_onStart(self): | ||
+ | #self.onStopped() #activate the output of the box | ||
+ | pass | ||
+ | animations = [self.action1,self.action2,self.action3] | ||
+ | action = animations[int(random.randint(0, len(animations) - 1))] | ||
+ | action() | ||
+ | |||
+ | def onInput_onStop(self): | ||
+ | self.onUnload() #it is recommended to reuse the clean-up as the box is stopped | ||
+ | self.onStopped() #activate the output of the box | ||
+ | </pre> |
Version vom 23. Februar 2023, 23:08 Uhr
Allgemeines
Ich weiß noch nicht so recht wie ich diese Seite(n) gestalten soll. Ich habe schon viele Programme aus dem Aldebaran Store, von Github und anderen Quellen ausprobiert. Der Erfolg war durchwachsen. Ich will den Erstellern keine Vorwuerfe machen, es ist ja sehr lobenswert, dass sie den Quellcode ueberhaupt zur Verfuegung stellen, aber sind doch nicht selten Anpassungen notwendig um ein Programm ueberhaupt zum Laufen zu bewegen. Manchmal war der Aufwand sogar so groß, oder das Programm so bescheiden dokumentiert, dass sich jeder weitere Aufwand kaum lohnt.
Ich koennte mir vorstellen, jedes Programm hier im Wiki mit einer Art Steckbrief zu versehen, so dass man moeglichst schnell einen Eindruck des Umfangs und der Leistung bekommt. Dazu koennte ich mir vorstellen einen Parser für die CRG-Files zu schreiben der einem das Grundgeruest des Steckbriefes liefert.
Ich fang mal an einzelne Codeschnipsel zu kommentieren.
AIDA-bot (Github)
=Random-Box
class MyClass(GeneratedClass): def __init__(self): GeneratedClass.__init__(self) def onLoad(self): #put initialization code here pass def onUnload(self): #put clean-up code here pass def onInput_onStart(self): #self.onStopped() #activate the output of the box pass animations = [self.action1,self.action2,self.action3] action = animations[int(random.randint(0, len(animations) - 1))] action() def onInput_onStop(self): self.onUnload() #it is recommended to reuse the clean-up as the box is stopped self.onStopped() #activate the output of the box