Skip to content

Commit b71907b

Browse files
committed
Python Global Variable
Python Global Variable
1 parent 3659dfc commit b71907b

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Package name="GlobalVariable" format_version="4">
3+
<Manifest src="manifest.xml" />
4+
<BehaviorDescriptions>
5+
<BehaviorDescription name="behavior" src="behavior_1" xar="behavior.xar" />
6+
</BehaviorDescriptions>
7+
<Dialogs />
8+
<Resources />
9+
<Topics />
10+
<IgnoredPaths />
11+
<Translations auto-fill="en_US">
12+
<Translation name="translation_en_US" src="translations/translation_en_US.ts" language="en_US" />
13+
</Translations>
14+
</Package>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8" ?><ChoregrapheProject xmlns="http://www.aldebaran-robotics.com/schema/choregraphe/project.xsd" xar_version="3"><Box name="root" id="-1" localization="8" tooltip="Root box of Choregraphe&apos;s behavior. Highest level possible." x="0" y="0"><bitmap>media/images/box/root.png</bitmap><script language="4"><content><![CDATA[]]></content></script><Input name="onLoad" type="1" type_size="1" nature="0" inner="1" tooltip="Signal sent when diagram is loaded." id="1" /><Input name="onStart" type="1" type_size="1" nature="2" inner="0" tooltip="Box behavior starts when a signal is received on this input." id="2" /><Input name="onStop" type="1" type_size="1" nature="3" inner="0" tooltip="Box behavior stops when a signal is received on this input." id="3" /><Output name="onStopped" type="1" type_size="1" nature="1" inner="0" tooltip="Signal sent when box behavior is finished." id="4" /><Timeline enable="0"><BehaviorLayer name="behavior_layer1"><BehaviorKeyframe name="keyframe1" index="1"><Diagram><Box name="ChangeValue" id="1" localization="8" tooltip="" x="150" y="52"><bitmap>media/images/box/box-python-script.png</bitmap><script language="4"><content><![CDATA[class MyClass(GeneratedClass):
2+
def __init__(self):
3+
GeneratedClass.__init__(self)
4+
5+
def onLoad(self):
6+
#put initialization code here
7+
pass
8+
9+
def onUnload(self):
10+
#put clean-up code here
11+
pass
12+
13+
def onInput_onStart(self):
14+
global myValue
15+
myValue=100
16+
17+
18+
def onInput_onStop(self):
19+
self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
20+
self.onStopped() #activate the output of the box]]></content></script><Input name="onLoad" type="1" type_size="1" nature="0" inner="1" tooltip="Signal sent when diagram is loaded." id="1" /><Input name="onStart" type="1" type_size="1" nature="2" inner="0" tooltip="Box behavior starts when a signal is received on this input." id="2" /><Input name="onStop" type="1" type_size="1" nature="3" inner="0" tooltip="Box behavior stops when a signal is received on this input." id="3" /><Output name="onStopped" type="1" type_size="1" nature="1" inner="0" tooltip="Signal sent when box behavior is finished." id="4" /></Box><Box name="GetValue" id="2" localization="8" tooltip="" x="368" y="84"><bitmap>media/images/box/box-python-script.png</bitmap><script language="4"><content><![CDATA[class MyClass(GeneratedClass):
21+
def __init__(self):
22+
GeneratedClass.__init__(self)
23+
24+
def onLoad(self):
25+
#put initialization code here
26+
pass
27+
28+
def onUnload(self):
29+
#put clean-up code here
30+
pass
31+
32+
def onInput_onStart(self):
33+
global myValue
34+
35+
if myValue == 100:
36+
pass
37+
else:
38+
pass
39+
40+
def onInput_onStop(self):
41+
self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
42+
self.onStopped() #activate the output of the box]]></content></script><Input name="onLoad" type="1" type_size="1" nature="0" inner="1" tooltip="Signal sent when diagram is loaded." id="1" /><Input name="onStart" type="1" type_size="1" nature="2" inner="0" tooltip="Box behavior starts when a signal is received on this input." id="2" /><Input name="onStop" type="1" type_size="1" nature="3" inner="0" tooltip="Box behavior stops when a signal is received on this input." id="3" /><Output name="onStopped" type="1" type_size="1" nature="1" inner="0" tooltip="Signal sent when box behavior is finished." id="4" /></Box></Diagram></BehaviorKeyframe></BehaviorLayer></Timeline></Box></ChoregrapheProject>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<package uuid="globalvariable-5f4adb" version="0.0.0">
3+
<names>
4+
<name lang="en_US">Untitled</name>
5+
</names>
6+
<supportedLanguages>
7+
<language>en_US</language>
8+
</supportedLanguages>
9+
<descriptionLanguages>
10+
<language>en_US</language>
11+
</descriptionLanguages>
12+
<contents>
13+
<behaviorContent path="behavior_1">
14+
<userRequestable/>
15+
<nature>interactive</nature>
16+
<triggerSentences/>
17+
<loadingResponses/>
18+
<autonomous/>
19+
<permissions/>
20+
</behaviorContent>
21+
</contents>
22+
</package>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE TS>
3+
<TS version="2.1" language="en_US"/>

0 commit comments

Comments
 (0)