Skip to content
Snippets Groups Projects
Commit 92a2b540 authored by Herwin van Welbergen's avatar Herwin van Welbergen
Browse files
parents e37b4186 156565b9
No related branches found
No related tags found
No related merge requests found
...@@ -2,5 +2,5 @@ language=java ...@@ -2,5 +2,5 @@ language=java
resolve.status=beta resolve.status=beta
resource.path= resource.path=
#resource.path=${shared.repository}/Humanoids;${shared.repository}/3dmodels;${shared.repository}/HMI/HmiElckerlyc/resources;${shared.repository}/logbackconfig;${shared.repository}/shaders; #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= rebuild.list=
<ivy-module version="2.0"> <ivy-module version="2.0">
<info organisation="Herwin" module="scrapbook"/> <info organisation="ipaaca" module="ipaaca"/>
<configurations> <configurations>
<include file="${ivy.settings.dir}/configurations.xml"/> <include file="${ivy.settings.dir}/configurations.xml"/>
</configurations> </configurations>
......
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();
}
}
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
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
<?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>
<ivy-module version="2.0">
<info organisation="HMI" module="IpaacaPython" />
<dependencies>
<dependency org="junit" name="junit" rev="latest.release"/>
</dependencies>
</ivy-module>
#!/usr/bin/env python
import ipaaca
print "{this is the IpaacaPython run.py doing nothing at all}"
[transport.spread]
host = localhost # default type is string
port = 4803 # types can be specified in angle brackets
enabled = true
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment