diff --git a/java/build.properties b/java/build.properties index e7fc61f58e49c8abd77c45acfc9bd1d372609720..8c6fc149f768d847b59e7027cffd5e871b7ef777 100644 --- a/java/build.properties +++ b/java/build.properties @@ -2,5 +2,5 @@ language=java resolve.status=beta resource.path= #resource.path=${shared.repository}/Humanoids;${shared.repository}/3dmodels;${shared.repository}/HMI/HmiElckerlyc/resources;${shared.repository}/logbackconfig;${shared.repository}/shaders; -run.jvmargs= -Xms128m -Xmx512m -Xss5M -Dlogback.configurationFile=LogbackConfigs/warnlogstdout.xml +run.jvmargs= -Xms128m -Xmx512m -Xss5M rebuild.list= diff --git a/java/ivy.xml b/java/ivy.xml index 3e95c71b4ec4ceab74d4230badf7e9a61bcd78df..3e526063073e10c8e2a20991ffe50be62f7e835e 100644 --- a/java/ivy.xml +++ b/java/ivy.xml @@ -1,5 +1,5 @@ <ivy-module version="2.0"> - <info organisation="Herwin" module="scrapbook"/> + <info organisation="ipaaca" module="ipaaca"/> <configurations> <include file="${ivy.settings.dir}/configurations.xml"/> </configurations> diff --git a/java/src/ipaacademo/TextPrinter.java b/java/src/ipaacademo/TextPrinter.java new file mode 100644 index 0000000000000000000000000000000000000000..2e725795d3149a23565bf31feeccb0f5a6f1d634 --- /dev/null +++ b/java/src/ipaacademo/TextPrinter.java @@ -0,0 +1,131 @@ +package ipaacademo; + +import java.util.Set; + +import ipaaca.AbstractIU; +import ipaaca.Initializer; +import ipaaca.InputBuffer; +import ipaaca.LocalIU; +import ipaaca.OutputBuffer; +import ipaaca.RemotePushIU; + +import javax.swing.JFrame; +import javax.swing.JLabel; + +import com.google.common.collect.ImmutableSet; + +public class TextPrinter +{ + static + { + Initializer.initializeIpaacaRsb(); + } + + private static final String CATEGORY = "TEXT"; + private static final double RATE = 1; + private UpdateThread updateThread; + + public TextPrinter() + { + Set<String> categories = new ImmutableSet.Builder<String>().add(CATEGORY).build(); + JLabel label = new JLabel(""); + + updateThread = new UpdateThread(new InputBuffer("TextPrinter", categories),label); + + JFrame frame = new JFrame("IPAACA TextPrinter Demo"); + frame.add(label); + frame.setSize(1000,300); + frame.setVisible(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + public void start() + { + updateThread.start(); + } + + private static class UpdateThread extends Thread + { + private InputBuffer inBuffer; + private JLabel label; + + public UpdateThread(InputBuffer inBuffer, JLabel label) + { + this.inBuffer = inBuffer; + this.label = label; + } + + @Override + public void run() + { + long startTime = System.currentTimeMillis(); + while(true) + { + double duration = (System.currentTimeMillis()-startTime)/1000d; + + RemotePushIU iuFirst = null; + for (RemotePushIU iu : inBuffer.getIUs()) + { + if(iu.getLinks("PREDECESSOR").isEmpty()) + { + iuFirst = iu; + break; + } + } + + int numChars = (int)(duration/RATE); + + AbstractIU iu = iuFirst; + String str = ""; + for(int i=0;i<numChars;i++) + { + str += iu.getPayload().get("CONTENT"); + Set<String> successor = iu.getLinks("SUCCESSOR"); + if(successor!=null && !successor.isEmpty()) + { + iu = inBuffer.getIU(successor.iterator().next()); + } + else + { + break; + } + } + label.setText(str); + + try + { + Thread.sleep(100); + } + catch (InterruptedException e) + { + Thread.interrupted(); + } + } + } + + } + + public static void main(String args[]) + { + TextPrinter tp = new TextPrinter(); + + + OutputBuffer outBuffer = new OutputBuffer("componentX"); + String[] inputString = {"h","e","l","l","o"," ","w","o","r","l","d","!s"}; + LocalIU predIU = null; + for(String str:inputString) + { + LocalIU localIU = new LocalIU(); + localIU.setCategory(CATEGORY); + outBuffer.add(localIU); + localIU.getPayload().put("CONTENT", str); + if(predIU!=null) + { + localIU.setLinks("PREDECESSOR", ImmutableSet.of(predIU.getUid())); + predIU.setLinks("SUCCESSOR",ImmutableSet.of(localIU.getUid())); + } + predIU = localIU; + } + tp.start(); + } +} diff --git a/python/Makefile b/python/Makefile deleted file mode 100644 index 429c8f5ba0ea8d58eba4fb2b274ae8969a98a98b..0000000000000000000000000000000000000000 --- a/python/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all: - @echo "Compiling protobuf spec for python..." - protoc --proto_path=../proto ../proto/ipaaca.proto --python_out=build/ - cp src/ipaaca.py build/ - ( cd build; python -c "import ipaaca" ) - rm build/ipaaca.py - rm build/ipaaca_pb2.py - -clean: - rm -f build/*.pyc build/*_pb2.py build/ipaaca.py - diff --git a/python/build.properties b/python/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..aa9003a9c77f1ce8614fe43a382b09d6778c25ab --- /dev/null +++ b/python/build.properties @@ -0,0 +1,7 @@ +language=python +resolve.status=beta +resource.path=${shared.resources}/Shared3DModels/resource;${shared.resources}/DefaultShaders/resource;${shared.resources}/LogbackConfigs/resource;${shared.resources}/HmiHumanoidBodyControl/resource;${shared.resources}/HmiHumanoidEmbodiments/resource; +rebuild.list= +pyzip.excludes= +run.py=run.py + diff --git a/python/build.xml b/python/build.xml new file mode 100644 index 0000000000000000000000000000000000000000..2c571af2bc17e9bc76328646e3960baf3a756d15 --- /dev/null +++ b/python/build.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="IpaacaPython" default="run"> + <import file="../../soashared/ant/build.xml" /> + <target name="-pre-compilation"> + <echo message="Compiling protobuf file" /> + <exec executable="protoc"> + <arg value="--proto_path=../proto" /> + <arg value="../proto/ipaaca.proto" /> + <arg value="--python_out=build/" /> + </exec> + </target> +</project> + diff --git a/python/ivy.xml b/python/ivy.xml new file mode 100644 index 0000000000000000000000000000000000000000..f7824bbed5b31631967f692c017cede769d81172 --- /dev/null +++ b/python/ivy.xml @@ -0,0 +1,6 @@ +<ivy-module version="2.0"> + <info organisation="HMI" module="IpaacaPython" /> + <dependencies> + <dependency org="junit" name="junit" rev="latest.release"/> + </dependencies> +</ivy-module> diff --git a/python/src/run.py b/python/src/run.py new file mode 100755 index 0000000000000000000000000000000000000000..e4f4db26e88094f481df9ce6caf358b76348e059 --- /dev/null +++ b/python/src/run.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +import ipaaca + +print "{this is the IpaacaPython run.py doing nothing at all}" + diff --git a/python/test/src/rsb.cfg b/python/test/src/rsb.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c7d8582067278e6e725cd5309d4b280bb5ccb6b6 --- /dev/null +++ b/python/test/src/rsb.cfg @@ -0,0 +1,5 @@ +[transport.spread] +host = localhost # default type is string +port = 4803 # types can be specified in angle brackets +enabled = true + diff --git a/python/test/testipaaca.py b/python/test/src/testipaaca.py similarity index 100% rename from python/test/testipaaca.py rename to python/test/src/testipaaca.py