Commit 4cf21428 authored by Matthias Möller's avatar Matthias Möller

Feinjustierung

parent ca513f5f
......@@ -8,8 +8,8 @@ import Server.WebsocketServer2;
public class MentalCommandWebSocket extends AbstractWebSocketComponent{
public int actualMentalCommand;
public int iteratedTriggeredMentalCommand = 0;
public int MCPULLSensibility = 3;
public int MCPUSHSensibility = 3;
public float MCPULLSensibility = new Float(0.45);
public float MCPUSHSensibility = new Float(0.45);
public MentalCommandWebSocket(AbstractEmotiv emo) {
......@@ -47,31 +47,32 @@ public class MentalCommandWebSocket extends AbstractWebSocketComponent{
public void actualizeComponents() {
int newMentalCommand = EmoState.INSTANCE.IS_MentalCommandGetCurrentAction(getEmoState());
float newMentalCommandStrength = EmoState.INSTANCE.IS_MentalCommandGetCurrentActionPower(getEmoState());
System.out.println(newMentalCommand + " " + newMentalCommandStrength);
if(newMentalCommand != this.actualMentalCommand){
this.actualMentalCommand = newMentalCommand;
this.iteratedTriggeredMentalCommand = 0;
}
if(newMentalCommandStrength > 0.6) {
this.iteratedTriggeredMentalCommand +=1;
}
switch(this.actualMentalCommand) {
case 2:
if(this.iteratedTriggeredMentalCommand >= this.MCPUSHSensibility) {
WebsocketServer2.sendMentalCommand(2);
System.out.println("MCPUSH");
if(this.MCPUSHSensibility <= newMentalCommandStrength) {
this.iteratedTriggeredMentalCommand += 1;
}
break;
case 4:
if(this.iteratedTriggeredMentalCommand >= this.MCPULLSensibility) {
WebsocketServer2.sendMentalCommand(4);
System.out.println("MCPULL");
if(this.MCPULLSensibility <= newMentalCommandStrength) {
this.iteratedTriggeredMentalCommand += 1;
}
break;
}
if(this.iteratedTriggeredMentalCommand >= 2) {
WebsocketServer2.sendMentalCommand(this.actualMentalCommand);
this.iteratedTriggeredMentalCommand = 0;
}
this.nextEmotivComponent.actualizeComponents();
......@@ -84,8 +85,10 @@ public class MentalCommandWebSocket extends AbstractWebSocketComponent{
}
public void updateMentalCommandSensibility() {
this.MCPUSHSensibility = this.getView().getMCPUSHSensibilitiy();
this.MCPULLSensibility = this.getView().getMCPULLSenisibility();
this.MCPUSHSensibility = (float) (this.getView().getMCPUSHSensibilitiy() * 0.05 + 0.3);
this.MCPULLSensibility = (float) (this.getView().getMCPULLSenisibility() * 0.05 + 0.3);
System.out.print("MCPUSH " + this.MCPUSHSensibility);
System.out.println("MCPULL " + this.MCPULLSensibility);
}
}
......@@ -66,6 +66,7 @@ public class WebsocketServer2 extends WebSocketServer{
public static void sendMentalCommand(int mentalCommand) {
System.out.println(mentalCommand);
Collection<WebSocket> sockets = Singleton.connections();
for(WebSocket socket : sockets) {
String message = "{";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment