diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a37236a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,56 @@
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+# Compilados do simulador
+build
+
+# Log do simulador
+log.txt
+
+# Compilado do instalador
+vss-simulator/Instalador
+
+# Configurações pessoais vscode
+.vscode
+
+# Binário do simulador
+Simulador
+
+#arquivos de teste
+*.teste.cpp
+*.teste.py
+
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.pyc
+*.teste.pyc
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0c5ad24
--- /dev/null
+++ b/README.md
@@ -0,0 +1,91 @@
+# VSSS ERUS
+
+Projeto de VSSS (Very Small Sized Soccer) da ERUS, desenvolvido em Python
+
+# Instalação de dependências
+## Com Simulador
+
+Para compilar o projeto e utilizar o simulador, é necessário instalar a seguinte lista de pacotes:
+
+`g++ cmake libxmu-dev libxi-dev protobuf-compiler libprotobuf-dev pkg-config libzmq5 libzmq3-dev libboost-all-dev libbullet-dev freeglut3 freeglut3-dev`
+
+Caso o pacote `pkg-config` esteja indisponível, instale o `pkgconf`.
+
+Utilize o gerenciador de pacotes da sua distribuição, como `apt` ou `pacman`, para instalar os pacotes listados.
+
+Também é necessário instalar o vssscorepy, o vss-sdk, pyzmq, OpenCV, numpy e google.
+
+```
+$ sudo -H pip install git+https://github.com/VSS-SDK/VSS-CorePy --upgrade
+```
+
+Adicionalmente, é necessário compilar os subprojetos do simulador, o que pode ser feito por meio do script `vss-simulator/instalador.sh`. **Certifique-se de que todas as dependências de pacotes foram instaladas antes de rodar os scripts, ou você TERÁ erros de compilação**!
+
+```
+$ sudo ./vss-simulator/instalador.sh
+```
+## Sem Simulador
+Em breve
+
+# Executando
+
+## Com Simulador
+Há um arquivo de auxílio para rodar o simulador. Para compilá-lo, entre no diretório vss-simulator e rode o comando make.
+Depois de compilado o programa pode ser rodado pelo comando:
+```
+$ ./Simulador
+```
+A simulação cria um arquivo de log com as saídas dos programas de simulação para serem analisados.
+
+## Com Sistemas de Visão e Hardware reais
+Em breve.
+
+# Padrões de código
+
+## Primeiro comentário do arquivo
+
+ """ Nome do módulo :
+ Ano de criação :
+ Descrição do módulo :
+ Versão :
+ Pré-requisitos : (arquivos e bibliotecas necessárias para compilar)
+ Membros :
+ """
+
+
+## Comentário de protótipo de funções
+
+ """ Nome da função :
+ Intenção da função :
+ Pré-requisitos :
+ Efeitos colaterais :
+ Parâmetros :
+ Retorno :
+ """
+
+
+**IMPORTANTE**: Comentários adicionais devem ser feitos na implementação (corpo das funções) detalhando a implementação do código.
+
+# Dados da Equipe:
+O VSSS-ERUS é uma equipe dedicada a implementação do desafio Very Small Size Soccer para competições. É um projeto da ERUS - Equipe de Robótica da UFES, e diversos documentos sobre o projeto podem ser encontrados no site da equipe.
+- Site da ERUS : http://erus.ufes.br/
+- E-mail da ERUS : erus@inf.ufes.br
+- E-mail do VSSS-ERUS : vssserus@gmail.com
+
+## Membros Atuais
+- Gabriel Pietroluongo
+ - gabrielpietroluongo@gmail.com
+- Gabriel Valdino
+ - gvaldino@yahoo.com
+- Mayke Wallace
+ - mayke.ace@hotmail.com
+- Lara de Luca
+ - lara2058@hotmail.com
+- Lorena Bassani
+ - lorenabassani12@gmail.com
+
+## Membros Antigos
+- Ricardo Ramos
+ - ricardobraun20006@gmail.com
+- Victor de Oliveira
+ - makkakie97@gmail.com
diff --git a/new_scripts/Agente.py b/new_scripts/Agente.py
new file mode 100644
index 0000000..563b285
--- /dev/null
+++ b/new_scripts/Agente.py
@@ -0,0 +1,71 @@
+""" Nome do módulo : Agente
+ Ano de criação : 2019/10
+ Descrição do módulo : Agente representa uma entidade em campo
+ Versão : 2.0
+ Pré-requisitos : sklearn
+ geometria
+ Membros : Lorena Bassani
+"""
+from sklearn.linear_model import LinearRegression
+from .Geometria import Ponto
+from .Campo import Campo
+import math as m
+
+class Agente(object):
+
+ def __init__(self, ponto = Ponto()):
+ self.__ponto = ponto
+ self.__theta = 0
+ self.__posicoesAntigas = list()
+
+ @property
+ def ponto(self):
+ return self.__ponto
+
+ @ponto.setter
+ def ponto(self, value):
+ self.__changePosition()
+ self.__ponto = value
+ c = Campo()
+ c.occupy(c.transform2Grid((value.x, value.y)), self)
+
+ @property
+ def posicao(self):
+ return self.ponto.posicao
+
+ @posicao.setter
+ def posicao(self, value):
+ self.__changePosition()
+ self.ponto.posicao = value
+ c = Campo()
+ c.occupy(c.transform2Grid(value), self)
+
+ @property
+ def x(self):
+ return self.ponto.x
+
+ @property
+ def y(self):
+ return self.ponto.y
+
+ @property
+ def theta(self):
+ return self.__theta
+
+ @theta.setter
+ def theta(self, value):
+ self.__theta = value
+
+ @property
+ def posicoesAntigas(self):
+ return self.__posicoesAntigas.copy()
+
+ def __changePosition(self):
+ if len(self.__posicoesAntigas) >= 5:
+ self.__posicoesAntigas.pop(0)
+ self.__posicoesAntigas.append(Ponto(self.ponto.x, self.ponto.y))
+ c = Campo()
+ c.release(c.transform2Grid(self.posicao))
+
+ def predicaoAdaptativa(self):
+ pass
\ No newline at end of file
diff --git a/new_scripts/Aliado.py b/new_scripts/Aliado.py
new file mode 100644
index 0000000..2e97b5f
--- /dev/null
+++ b/new_scripts/Aliado.py
@@ -0,0 +1,58 @@
+""" Nome do módulo : Aliado
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que descreve um jogador aliado em campo
+ Jogadores Aliados podem ser controlados
+ Versão : 2.0
+ Pré-requisitos : Jogador
+ Ponto
+ ComportamentoJogadores
+ Factory
+ IComportamento
+ Membros : Lorena Bassani
+"""
+from .Jogador import Jogador
+from .Geometria import Ponto
+from .ComportamentosJogadores.Factory import Factory
+from .ComportamentosJogadores.IComportamento import IComportamento
+
+class Aliado(Jogador):
+
+ def __init__(self, idJ, ponto = Ponto(), comportamento = None):
+ Jogador.__init__(self, idJ = idJ, ponto = ponto)
+ self.comportamento = comportamento
+
+ """ Nome da função : comportamento (getter)
+ Intenção da função : Retornar qual o comportamento atual do Jogador
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : COMPORTAMENTOS : Constante da Enumeração COMPORTAMENTOS
+ """
+ @property
+ def comportamento(self):
+ return self.__comportamentoId
+
+ """ Nome da função : comportamento (setter)
+ Intenção da função : Modificar o comportamento atual do Jogador
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Modifica o comportamento atual do Joagdor
+ Parâmetros : COMPORTAMENTOS : Constante da Enumeração COMPORTAMENTOS
+ Retorno : Nenhum
+ """
+ @comportamento.setter
+ def comportamento(self, comportamento):
+ self.__comportamentoId = comportamento
+ self.__comportamento = Factory.create(comportamento)
+
+ """ Nome da função : isInimigo
+ Intenção da função : Dizer se o Jogador é Inimigo
+ Pré-requisitos : Ser uma subclasse de Joagador
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : Boolean : Sempre False
+ """
+ def isInimigo(self):
+ return False
+
+ def definirObjetivo(self, mundo):
+ return self.__comportamento.definirObjetivo(self, mundo)
\ No newline at end of file
diff --git a/new_scripts/Ball.py b/new_scripts/Ball.py
new file mode 100644
index 0000000..f97941f
--- /dev/null
+++ b/new_scripts/Ball.py
@@ -0,0 +1,19 @@
+""" Nome do módulo : Ball
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que define bola em campo
+ Versão : 2.0
+ Pré-requisitos : Agente
+ Ponto
+ Membros : Lorena Bassani
+"""
+from .Agente import Agente
+from .Geometria import Ponto
+from .Patterns.Singleton import Singleton
+
+class Ball(Agente, Singleton):
+
+ def __init__(self, *args, **keyargs):
+ pass
+
+ def inicializa(self, ponto = Ponto()):
+ Agente.__init__(self, ponto)
diff --git a/new_scripts/Campo.py b/new_scripts/Campo.py
new file mode 100644
index 0000000..2e5e579
--- /dev/null
+++ b/new_scripts/Campo.py
@@ -0,0 +1,39 @@
+""" Nome do módulo : Campo
+ Ano de criação : 2019/10
+ Descrição do módulo : Modelar o campo do jogo
+ Versão : 1.0
+ Pré-requisitos : WeightedGridGraph
+ Pattern.Singleton
+ Membros : Lorena B Bassani
+"""
+from .Patterns.Singleton import Singleton
+from .PathPlanning.Graph import WeightedGridGraph
+
+
+class Campo(WeightedGridGraph, Singleton):
+
+ def __init__(self, *args, **keyargs):
+ pass
+
+ def inicializa(self, celulasX, celulasY, dimX = 150, dimY = 130):
+ if not hasattr(self, "grade"):
+ WeightedGridGraph.__init__(self, celulasX, celulasY)
+ self.__h = (dimX/(celulasX - 1), dimY/(celulasY - 1))
+
+ @property
+ def tamanhoCelula(self):
+ return self.__h
+
+ def transform2Cart(self, cel):
+ # TODO : Ver Se as grades possuem as mesmas características de crescimento de coordenadas
+ i, j = WeightedGridGraph.transform2Cart(self, cel)
+ return (i*self.__h[0], j*self.__h[1])
+
+ def transform2Grid(self, cel):
+ # TODO : Redefinir trasnformação
+ x, y = cel
+ return WeightedGridGraph.transform2Grid(self, (x//self.__h[0], y//self.__h[1]))
+
+ def cost(self, start, goal):
+ # TODO : Redefinir custo para variar com a proximidade a um obstáculo
+ return WeightedGridGraph.cost(self, start, goal)
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/ComportamentoAtacante.py b/new_scripts/ComportamentosJogadores/ComportamentoAtacante.py
new file mode 100644
index 0000000..de04a24
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/ComportamentoAtacante.py
@@ -0,0 +1,43 @@
+""" Nome do módulo : ComportamentoAtacante
+ Ano de criação : 2019/10
+ Descrição do módulo : Comportamento de Atacante para Jogadores
+ Versão : 1.0
+ Pré-requisitos : IComportamento
+ Geometria
+ Mundo, Arena, Lado
+ Jogador
+ Ball
+ math
+ Membros : Lorena Bassani
+"""
+from .IComportamento import IComportamento
+from ..Geometria import Ponto
+from ..Mundo import Mundo, Arena, Lado
+from ..Jogador import Jogador
+from ..Ball import Ball
+import math as m
+
+class ComportamentoAtacante(IComportamento):
+ def __init__(self):
+ IComportamento.__init__(self)
+
+ def definirObjetivo(self, jogador : Jogador, mundo : Mundo):
+ ball = mundo.ball
+ if ball.ponto.distancia(jogador.ponto) > 30:
+ x, y = ball.posicao
+ # Se posicionar antes da bola
+ if mundo.lado == Lado.DIREITO:
+ x += 3.35
+ else:
+ x -= 3.35
+ # Se a bola estiver acima do meio de campo, se posicionar acima dela
+ if y < Arena.marcacoes["Meio"].y:
+ y -= 3.35
+ else:
+ y += 3.35
+ return Ponto(x, y)
+ elif ball.ponto.distancia(jogador.ponto) > 5:
+ return ball.ponto
+ else:
+ resp = Arena.golEsquerdo["Meio"] if mundo.lado == Lado.ESQUERDO else Arena.golDireito["Meio"]
+ return resp
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/ComportamentoDefesa.py b/new_scripts/ComportamentosJogadores/ComportamentoDefesa.py
new file mode 100644
index 0000000..5fdeaa1
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/ComportamentoDefesa.py
@@ -0,0 +1,25 @@
+""" Nome do módulo : ComportamentoDefesa
+ Ano de criação : 2019/10
+ Descrição do módulo : Comportamento de Defesa para Jogadores
+ Versão : 1.0
+ Pré-requisitos : IComportamento
+ Geometria
+ Mundo, Arena, Lado
+ Jogador
+ Ball
+ math
+ Membros : Lorena Bassani
+"""
+from .IComportamento import IComportamento
+from ..Geometria import Ponto
+from ..Mundo import Mundo, Arena, Lado
+from ..Jogador import Jogador
+from ..Ball import Ball
+import math as m
+
+class ComportamentoDefesa(IComportamento):
+ def __init__(self):
+ IComportamento.__init__(self)
+
+ def definirObjetivo(self, jogador, mundo):
+ pass
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/ComportamentoGoleiro.py b/new_scripts/ComportamentosJogadores/ComportamentoGoleiro.py
new file mode 100644
index 0000000..371ae3d
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/ComportamentoGoleiro.py
@@ -0,0 +1,63 @@
+""" Nome do módulo : ComportamentoGoleiro
+ Ano de criação : 2019/10
+ Descrição do módulo : Comportamento de Goleiro para Jogadores
+ Versão : 2.0
+ Pré-requisitos : IComportamento
+ Geometria
+ Mundo, Arena, Lado
+ Ball
+ Jogador
+ math
+ Membros : Lorena Bassani
+"""
+from .IComportamento import IComportamento
+from ..Geometria import Ponto
+from ..Mundo import Mundo, Arena, Lado
+from ..Ball import Ball
+from ..Jogador import Jogador
+import math as m
+
+class ComportamentoGoleiro(IComportamento):
+ def __init__(self):
+ IComportamento.__init__(self)
+
+ def definirObjetivo(self, jogador : Jogador, mundo : Mundo):
+ """ Ideia da implementação :
+ Posicionar o robô de forma que ele impessa a trajetória da bola
+ Como : Calcular o angulo de abertura entre a bola e o gol
+ Posicionar o robô onde o "triangulo" tenha base de 7,5 (tamanho do robô)
+ """
+ resp = Ponto()
+ ball = mundo.ball
+ bx, _ = ball.posicao
+ bt = ball.theta
+ """ a² = b² + c² - 2bc*cos α
+ a² - b² - c² = -2bc* cos α
+ (b² + c² - a²)/2bc = cos α
+ α = acos(((b² + c² - a²)/2bc))
+ Onde :
+ a <- lado oposto (tamanho do gol)
+ b e c <- lados adjascentes (distancia da bola até um dos limites do gol)
+ α <- angulo desejado
+ """
+ gol = Arena.golDireito if mundo.lado == Lado.DIREITO else Arena.golEsquerdo
+ a = Arena.metricas["Gol"][1]
+ b = ball.ponto.distancia(gol["Superior"])
+ c = ball.ponto.distancia(gol["Inferior"])
+ alpha = (b**2 + c**2 - a**2)/2*b*c
+ if alpha > 1:
+ alpha = 1.0
+ elif alpha < -1:
+ alpha = -1.0
+ alpha = m.acos(alpha)
+
+ dx = 3.75/m.tan(alpha) if m.tan(alpha) != 0 else 0 # 3.75 é metade da largura do robô de 7.5x7.5
+ resp.x = bx + dx if mundo.lado == Lado.DIREITO else bx - dx
+
+ theta = m.fabs(bt - jogador.theta)
+ resp.y = (resp.x/m.tan(theta))
+
+ resp.y = 100 if resp.y > 100 else 30 if resp.y < 30 else resp.y
+ resp.posicao = (10, 65) if mundo.lado == Lado.ESQUERDO and resp.x > 37.5 else (150, 65) if mundo.lado == Lado.DIREITO and resp.x < 112.5 else resp.posicao
+
+ return resp
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/ComportamentoLissajous.py b/new_scripts/ComportamentosJogadores/ComportamentoLissajous.py
new file mode 100644
index 0000000..f51d6ec
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/ComportamentoLissajous.py
@@ -0,0 +1,36 @@
+""" Nome do módulo : ComportamentoLissajous
+ Ano de criação : 2019/10
+ Descrição do módulo : Modela um comportamento que descreve uma curva de Lissajous
+ Versão : 1.0
+ Pré-requisitos : IComportamento
+ Geometria
+ math
+ Membros : Lorena B Bassani
+"""
+from .IComportamento import IComportamento
+from ..Geometria import Ponto
+from ..Mundo import Mundo, Arena, Lado
+from ..Jogador import Jogador
+from ..Ball import Ball
+import math as m
+
+class ComportamentoLissajous(IComportamento):
+ __PI = 3.14159
+ def __init__(self, A = 30, B = 100, a = 3, b = 4, sig = (__PI/2)):
+ IComportamento.__init__(self)
+ self.A = A
+ self.B = B
+ self.a = a
+ self.b = b
+ self.sigma = sig
+ self.__t = 0
+
+ def definirObjetivo(self, jogador, Mundo):
+ """ Na matemática, a curva de Lissajous (figura de Lissajous ou curva de Bowditch)
+ é o gráfico produzido por um sistema de equações paramétricas que descreve um complexo movimento harmônico.
+ x = A*sen(at + sig), y = B*sen(bt)
+ """
+ x = self.A*m.sin(self.a*self.__t + self.sigma)
+ y = self.B*m.sin(self.b*self.__t)
+ self.__t += 1
+ return Ponto(x, y)
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/Comportamentos.py b/new_scripts/ComportamentosJogadores/Comportamentos.py
new file mode 100644
index 0000000..b584df0
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/Comportamentos.py
@@ -0,0 +1,13 @@
+""" Nome do módulo : COMPORTAMENTOS
+ Ano de criação : 2019/10
+ Descrição do módulo : Enumeração de comportamentos de Jogador
+ Versão : 1.0
+ Pré-requisitos : Enum
+ Membros : Lorena Bassani
+"""
+from enum import Enum
+
+class COMPORTAMENTOS(Enum):
+ GOLEIRO = 0
+ ATACANTE = 1
+ DEFESA = 2
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/Factory.py b/new_scripts/ComportamentosJogadores/Factory.py
new file mode 100644
index 0000000..bb93df4
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/Factory.py
@@ -0,0 +1,35 @@
+""" Nome do módulo : Factory
+ Ano de criação : 2019/10
+ Descrição do módulo : Fábrica de comportamentos de jogador
+ Versão : 1.0
+ Pré-requisitos : Comportamentos
+ ComportamentoGoleiro
+ ComportamentoDefesa
+ ComportamentoAtaque
+ Membros : Lorena Bassani
+"""
+from .Comportamentos import COMPORTAMENTOS
+from .ComportamentoGoleiro import ComportamentoGoleiro
+from .ComportamentoDefesa import ComportamentoDefesa
+from .ComportamentoAtacante import ComportamentoAtacante
+from .ComportamentoLissajous import ComportamentoLissajous
+
+class Factory(object):
+
+ """ Nome da função : create
+ Intenção da função : Criar um objeto adequado de comportamento para Jogador
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : COMPORTAMENTO : Comportamento relativo ao que se quer do Jogador
+ Retorno : IComportamento : Objeto que implementa um Comportamento de Jogador
+ """
+ @staticmethod
+ def create(comportamento):
+ if comportamento == COMPORTAMENTOS.GOLEIRO:
+ return ComportamentoGoleiro()
+ elif comportamento == COMPORTAMENTOS.ATACANTE:
+ return ComportamentoAtacante()
+ elif comportamento == COMPORTAMENTOS.DEFESA:
+ return ComportamentoDefesa()
+ else:
+ return ComportamentoLissajous()
\ No newline at end of file
diff --git a/new_scripts/ComportamentosJogadores/IComportamento.py b/new_scripts/ComportamentosJogadores/IComportamento.py
new file mode 100644
index 0000000..b7ff0a2
--- /dev/null
+++ b/new_scripts/ComportamentosJogadores/IComportamento.py
@@ -0,0 +1,10 @@
+""" Nome do módulo : IComportamento
+ Ano de criação : 2019/10
+ Descrição do módulo : Interface de Comportamento para Padrão Strategy
+ Versão : 1.0
+ Pré-requisitos : Nenhum
+ Membros : Lorena Bassani
+"""
+class IComportamento(object):
+ def definirObjetivo(self, jogador, mundo):
+ raise NotImplementedError
\ No newline at end of file
diff --git a/Calibracao.cpp b/new_scripts/ComportamentosJogadores/__init__.py
similarity index 100%
rename from Calibracao.cpp
rename to new_scripts/ComportamentosJogadores/__init__.py
diff --git a/new_scripts/Comunicacao/IComunicacao.py b/new_scripts/Comunicacao/IComunicacao.py
new file mode 100644
index 0000000..acfcaa9
--- /dev/null
+++ b/new_scripts/Comunicacao/IComunicacao.py
@@ -0,0 +1,15 @@
+""" Nome do módulo : IComunicacao.py
+ Ano de criação : 2019/10
+ Descrição do módulo : Interface de Comunicacao
+ Versão : 1.0
+ Pré-requisitos : Nenhum
+ Membros : Lorena Bassani
+"""
+
+class IComunicacao(object):
+
+ def enviaMensagem(self, Mensagem, Receptor, Remetente = None):
+ raise NotImplementedError
+
+ def recebeMensagem(self):
+ raise NotImplementedError
\ No newline at end of file
diff --git a/meanshift.cpp b/new_scripts/Comunicacao/__init__.py
similarity index 100%
rename from meanshift.cpp
rename to new_scripts/Comunicacao/__init__.py
diff --git a/new_scripts/Controle/ControleTrajeto/ControlePID.py b/new_scripts/Controle/ControleTrajeto/ControlePID.py
new file mode 100644
index 0000000..bb3cb88
--- /dev/null
+++ b/new_scripts/Controle/ControleTrajeto/ControlePID.py
@@ -0,0 +1,87 @@
+import time
+from .IControleTrajeto import IcontroleTrajeto
+class ControleTrajetoPID(IcontroleTrajeto):
+ def __init__(self, P = 0.2, I = 0.0, D = 0.0, current_time=None):
+ """Determines how aggressively the PID reacts to the current error with setting Proportional Gain"""
+ self.Kp = P
+ """Determines how aggressively the PID reacts to the current error with setting Integral Gain"""
+ self.Ki = I
+ """Determines how aggressively the PID reacts to the current error with setting Derivative Gain"""
+ self.Kd = D
+
+ self.sample_time = 0.00
+ self.current_time = current_time if current_time is not None else time.time()
+ self.last_time = self.current_time
+
+ self.clear()
+
+ def clear(self):
+ """Clears PID computations and coefficients"""
+ self.SetPoint = 0.0
+
+ self.PTerm = 0.0
+ self.ITerm = 0.0
+ self.DTerm = 0.0
+ self.lastError = 0.0
+
+ # Windup Guard
+ self.intError = 0.0
+ self.windupGuard = 20.0
+
+ self.output = 0.0
+
+ def controle(self, actualValue):
+ pass
+ """ xs, ys, ts = start
+ xg, yg, tg = goal
+ erroT = ts - tg
+ erroX = xs - xg
+ erroY = ys - yg """
+
+ def update(self, feedback_value, current_time=None):
+ """ Calculates PID value for given reference feedback
+ Test PID with Kp=1.2, Ki=1, Kd=0.001 (test_pid.py)
+ """
+ error = self.SetPoint - feedback_value
+
+ self.current_time = current_time if current_time is not None else time.time()
+ delta_time = self.current_time - self.last_time
+ deltaError = error - self.lastError
+
+ if (delta_time >= self.sample_time):
+ self.PTerm = self.Kp * error
+ self.ITerm += error * delta_time
+
+ if (self.ITerm < -self.windupGuard):
+ self.ITerm = -self.windupGuard
+ elif (self.ITerm > self.windupGuard):
+ self.ITerm = self.windupGuard
+
+ self.DTerm = 0.0
+ if delta_time > 0:
+ self.DTerm = deltaError / delta_time
+
+ # Remember last time and last error for next calculation
+ self.last_time = self.current_time
+ self.lastError = error
+
+ self.output = self.PTerm + (self.Ki * self.ITerm) + (self.Kd * self.DTerm)
+
+ def setWindup(self, windup):
+ """ Integral windup, also known as integrator windup or reset windup,
+ refers to the situation in a PID feedback controller where
+ a large change in setpoint occurs (say a positive change)
+ and the integral terms accumulates a significant error
+ during the rise (windup), thus overshooting and continuing
+ to increase as this accumulated error is unwound
+ (offset by errors in the other direction).
+ The specific problem is the excess overshooting.
+ """
+ self.windupGuard = windup
+
+ def setSampleTime(self, sample_time):
+ """ PID that should be updated at a regular interval.
+ Based on a pre-determined sampe time, the PID decides
+ if it should compute or return immediately.
+ """
+ self.sample_time = sample_time
diff --git a/new_scripts/Controle/ControleTrajeto/ControleSiegwart.py b/new_scripts/Controle/ControleTrajeto/ControleSiegwart.py
new file mode 100644
index 0000000..030bcdb
--- /dev/null
+++ b/new_scripts/Controle/ControleTrajeto/ControleSiegwart.py
@@ -0,0 +1,46 @@
+from .IControleTrajeto import IcontroleTrajeto
+from ...Geometria import Ponto, to180range
+import math as m
+
+class ControleSiegwart(IcontroleTrajeto):
+
+ __kRho = 1.85
+ __kAlpha = 9.7
+ __kBeta = -0.01
+ __PI = 3.14159
+
+ def controle(self, actualValue, objective, speed):
+ xa, ya, ta = actualValue
+ xo, yo, to = objective
+
+ ta = to180range(ta*ControleSiegwart.__PI/180)
+ rho = Ponto(xa, ya).distancia(Ponto(xo, yo))
+ lamb = m.atan2(yo - ya, xo - xa)
+
+ if rho < 3:
+ lamb = 0
+
+ alpha = to180range(lamb - ta)
+ beta = to - lamb
+
+ linearSpeed = - ControleSiegwart.__kRho*rho
+ angularSpeed = ControleSiegwart.__kAlpha*alpha + ControleSiegwart.__kBeta*beta
+
+ scale = speed/linearSpeed
+ linearSpeed *= scale
+ angularSpeed *= scale
+
+ if rho < 3:
+ linearSpeed = 0
+ angularSpeed *= 0.4
+
+ if m.fabs(alpha) > 0.5*ControleSiegwart.__PI:
+ linearSpeed = - linearSpeed
+
+ result = ((linearSpeed - angularSpeed*3.35)/2, (linearSpeed + angularSpeed*3.35)/2)
+ maxSpeed = max(m.fabs(result[0]), m.fabs(result[1]))
+
+ if maxSpeed > 100:
+ result = (result[0]*100/m.fabs(maxSpeed), result[1]*100/m.fabs(maxSpeed))
+
+ return result
\ No newline at end of file
diff --git a/new_scripts/Controle/ControleTrajeto/IControleTrajeto.py b/new_scripts/Controle/ControleTrajeto/IControleTrajeto.py
new file mode 100644
index 0000000..dbb5888
--- /dev/null
+++ b/new_scripts/Controle/ControleTrajeto/IControleTrajeto.py
@@ -0,0 +1,4 @@
+class IcontroleTrajeto(object):
+
+ def controle(self, actualValue, objective):
+ raise NotImplementedError
\ No newline at end of file
diff --git a/scripts/log.txt b/new_scripts/Controle/ControleTrajeto/__init__.py
similarity index 100%
rename from scripts/log.txt
rename to new_scripts/Controle/ControleTrajeto/__init__.py
diff --git a/new_scripts/Controle/ControleVelocidade/__init__.py b/new_scripts/Controle/ControleVelocidade/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/new_scripts/Controle/__init__.py b/new_scripts/Controle/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/new_scripts/Geometria.py b/new_scripts/Geometria.py
new file mode 100644
index 0000000..a250150
--- /dev/null
+++ b/new_scripts/Geometria.py
@@ -0,0 +1,79 @@
+""" Nome do módulo : Geometria
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo de auxílio para calculos geometricos
+ Versão : 1.0
+ Pré-requisitos : math
+ Membros : Lorena Bassani
+"""
+import math as m
+
+class Ponto(object):
+
+ """ Nome da função : Ponto (Construtor)
+ Intenção da função : Iniciar objeto tipo Ponto
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : As coordenadas do ponto serão setadas para os valores passados
+ como parametro ou (0, 0) caso não seja especificado na chamada.
+ Parâmetros : float : Coordenada x
+ float : Coordenada y
+ Retorno : Objeto tipo ponto criado
+ """
+ def __init__(self, x = 0, y = 0):
+ self.x = x
+ self.y = y
+
+ """ Nome da função : Getters e Setters
+ Intenção da função : Acesso de escrita e leitura as propriedades de Ponto
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Pode alterar propriedades
+ Parâmetros : Variados
+ Retorno : Variados
+ """
+
+ @property
+ def x(self):
+ return self._x
+
+ @x.setter
+ def x(self, value):
+ self._x = value
+
+ @property
+ def y(self):
+ return self._y
+
+ @y.setter
+ def y(self, value):
+ self._y = value
+
+ @property
+ def posicao(self):
+ return (self.x, self.y)
+
+ @posicao.setter
+ def posicao(self, value):
+ x, y = value
+ self.x = x
+ self.y = y
+
+ def __eq__(self, outro):
+ return self.posicao == outro.posicao
+
+ """ Nome da função : distancia
+ Intenção da função : Calcular a distância entre dois pontos
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Ponto : ponto para calcular a distância a partir deste
+ Retorno : float : distância entre os pontos
+ """
+ def distancia(self, outro):
+ return m.sqrt((self.x - outro.x)**2 + (self.y - outro.y)**2)
+
+def to180range(angle):
+ M_PI = 3.14159
+ angle = m.fmod(angle, 2 * M_PI)
+ if (angle < - M_PI):
+ angle = angle + 2 * M_PI
+ elif (angle > M_PI):
+ angle = angle - 2 * M_PI
+ return angle
\ No newline at end of file
diff --git a/new_scripts/Inimigo.py b/new_scripts/Inimigo.py
new file mode 100644
index 0000000..75f4ef4
--- /dev/null
+++ b/new_scripts/Inimigo.py
@@ -0,0 +1,25 @@
+""" Nome do módulo : Inimigo
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que especifica um inimigo em Campo
+ Versão : 1.0
+ Pré-requisitos : Jogador
+ Ponto
+ Membros : Lorena Bassani
+"""
+from .Jogador import Jogador
+from .Geometria import Ponto
+
+class Inimigo(Jogador):
+
+ def __init__(self, idJ, ponto = Ponto()):
+ Jogador.__init__(self, idJ = idJ, ponto = ponto)
+
+ """ Nome da função : isInimigo
+ Intenção da função : Dizer se um Jogador é Inimigo
+ Pré-requisitos : Ser uma Subclasse de Jogador
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : Boolean : Sempre True
+ """
+ def isInimigo(self):
+ return True
\ No newline at end of file
diff --git a/new_scripts/Jogador.py b/new_scripts/Jogador.py
new file mode 100644
index 0000000..b623a6a
--- /dev/null
+++ b/new_scripts/Jogador.py
@@ -0,0 +1,37 @@
+""" Nome do módulo : Jogador
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que define a classe abstrata Jogador
+ Versão : 2.0
+ Pré-requisitos : Agente
+ Ponto
+ Membros : Lorena Bassani
+"""
+from .Agente import Agente
+from .Geometria import Ponto
+
+class Jogador(Agente):
+
+ def __init__(self, idJ, ponto = Ponto()):
+ Agente.__init__(self, ponto)
+ self.__id = idJ
+
+ """ Nome da função : id (getter)
+ Intenção da função : Retorna o Id de um Jogador
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : int : Id do joagador
+ """
+ @property
+ def id(self):
+ return self.__id
+
+ """ Nome da função : isInimigo
+ Intenção da função : Dizer se o Jogador é Inimigo
+ Pré-requisitos : Ser uma subclasse de Joagador
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : Boolean : True se for um Joagdor Inimigo, False caso contrário
+ """
+ def isInimigo(self):
+ return NotImplementedError
\ No newline at end of file
diff --git a/new_scripts/Mundo.py b/new_scripts/Mundo.py
new file mode 100644
index 0000000..04e8980
--- /dev/null
+++ b/new_scripts/Mundo.py
@@ -0,0 +1,156 @@
+""" Nome do módulo : Mundo
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que define o Mundo onde ocorre o jogo
+ Versão : 2.0
+ Pré-requisitos : Padrão Singleton
+ Jogador
+ Ball
+ ComportamentosJogadores Comportamentos
+ Membros : Lorena Bassani
+"""
+from .Patterns.Singleton import Singleton
+from .Geometria import Ponto
+from .Jogador import Jogador
+from .ComportamentosJogadores.Comportamentos import COMPORTAMENTOS
+from .Ball import Ball
+from .Campo import Campo
+from .Controle.ControleTrajeto.IControleTrajeto import IcontroleTrajeto
+from .Controle.ControleTrajeto.ControleSiegwart import ControleSiegwart
+from .PathPlanning.IPathPlanning import IPathPlanning
+from .PathPlanning.AStar import AStar
+from enum import Enum
+import math as m
+
+class Lado(Enum):
+ ESQUERDO = 0
+ DIREITO = 1
+
+class Arena(object):
+ cantoSuperior = { "Direito" : Ponto(170, 0),
+ "Esquerdo" : Ponto(0, 0)
+ }
+ cantoInferior = { "Direito" : Ponto(170, 130),
+ "Esquerdo" : Ponto(0, 130)
+ }
+ golDireito = { "Superior" : Ponto(160 ,45),
+ "Meio" : Ponto(160, 65),
+ "Inferior" : Ponto(160, 95)
+ }
+ golEsquerdo = { "Superior" : Ponto(10 ,45),
+ "Meio" : Ponto(10, 65),
+ "Inferior" : Ponto(10, 95)
+ }
+ marcacoes = { "Meio" : Ponto(85, 65)
+ }
+ metricas = { "Tamanho " : (170, 130),
+ "Gol" : (10, 40)
+ }
+
+class Mundo(Singleton):
+
+ def __init__(self, *args, **keyargs):
+ pass
+
+ def inicializa(self, controladorTrajeto = ControleSiegwart(), pathPlanning = AStar, lado = Lado.DIREITO):
+ self.__jogadores = {"Team" : list(), "Enemies" : list()}
+ self.ball = Ball()
+ self.campo = Campo(celulasX = 15, celulasY = 13)
+ self.pathPlanning = AStar
+ self.controladorTrajeto = controladorTrajeto
+ self.lado = lado
+
+ """ Nome da função : inimigos (getter)
+ Intenção da função : Retorna os Inimigos
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : list : Lista de Inimigos
+ """
+ @property
+ def inimigos(self):
+ return self.__jogadores["Enemies"]
+
+ """ Nome da função : inimigos (setter)
+ Intenção da função : Alterar a lista de inimigos
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Altera todo o time de inimigos
+ Parâmetros : Novo time de Inimigos
+ Retorno : Nenhum
+ """
+ @inimigos.setter
+ def inimigos(self, inimigos):
+ self.__jogadores["Enemies"].clear()
+ self.__jogadores["Enemies"].extend(inimigos)
+
+ """ Nome da função : goleiro (getter)
+ Intenção da função : Retorna o Jogador Goleiro
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : Aliado : Jogador com Comportamento Goleiro
+ """
+ @property
+ def goleiro(self):
+ g = list(filter(lambda x: x.comportamento == COMPORTAMENTOS.GOLEIRO, self.__jogadores["Team"]))
+ if g:
+ return g[0]
+ return None
+
+ """ Nome da função : goleiro (setter)
+ Intenção da função : Alterar o Goleiro
+ Pré-requisitos : Não ter um Goleiro previamente
+ Efeitos colaterais : Define um novo goleiro
+ Parâmetros : int : Id do Jogador para alterar
+ Retorno : Nenhum
+ """
+ @goleiro.setter
+ def goleiro(self, jogadorId):
+ if not self.goleiro:
+ p = self.jogador(jogadorId)
+ p.comportamento = COMPORTAMENTOS.GOLEIRO
+
+ """ Nome da função : jogador (getter)
+ Intenção da função : Retornar um Jogador de Acordo com seu Id
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Id do Jogador
+ Retorno : Jogador : Jogador correspondente ao Id
+ """
+ def jogador(self, jogadorId):
+ p = list(filter(lambda x: x.id == jogadorId, self.__jogadores["Team"]))
+ if p:
+ return p
+ return None
+
+ @property
+ def time(self):
+ return self.__jogadores["Team"]
+
+ @time.setter
+ def time(self, newTime):
+ self.__jogadores["Team"].clear()
+ self.__jogadores["Team"].extend(newTime)
+
+ def control(self):
+ self.__defineFunction()
+ controle = list()
+ for p in self.__jogadores["Team"]:
+ # Primeiro passo: Definir Objetivo
+ goal = p.definirObjetivo(self).posicao
+ start = p.posicao
+ # Segundo passo: Planejar Caminho
+ # path = self.pathPlanning.PathPlan(self.campo, self.campo.transform2Grid(start), self.campo.transform2Grid(goal))
+ # path = self.pathPlanning.reconstructPath(path, self.campo.transform2Grid(start), self.campo.transform2Grid(goal))
+ # Terceiro passo: Seguir Caminho
+ # gx, gy = self.campo.transform2Cart(path.pop(0))
+ gx, gy = goal
+ sx, sy = start
+ gt = m.acos((gx*sx + gy*sy)/(m.sqrt(gx**2 + gy**2)*m.sqrt(sx**2 + sy**2)))
+ goal = gx, gy, gt
+ start = sx, sy, p.theta
+ vel = self.controladorTrajeto.controle(actualValue = start, objective = goal, speed = 100)
+ controle.append(vel)
+ return controle
+
+ def __defineFunction(self):
+ pass
\ No newline at end of file
diff --git a/new_scripts/PathPlanning/AStar.py b/new_scripts/PathPlanning/AStar.py
new file mode 100644
index 0000000..2a56132
--- /dev/null
+++ b/new_scripts/PathPlanning/AStar.py
@@ -0,0 +1,49 @@
+""" Nome do módulo : AStar
+ Ano de criação : 2019/10
+ Descrição do módulo : Algoritmo A* para Planejameto de Trajetória
+ Versão : 1.0
+ Pré-requisitos : IPathPlanning
+ WeightedGridGraph
+ PriorityQueue
+ Membros : Lorena Bassani
+"""
+from .IPathPlanning import IPathPlanning
+from .Graph import WeightedGridGraph
+from queue import PriorityQueue
+
+""" A* is a modification of Dijkstra’s Algorithm that is optimized for
+ a single destination. Dijkstra’s Algorithm can find paths to all
+ locations; A* finds paths to one location, or the closest of several
+ locations. It prioritizes paths that seem to be leading closer to a goal.
+"""
+class AStar(IPathPlanning):
+
+ @staticmethod
+ def PathPlan(graph, start, goal):
+ frontier = PriorityQueue()
+ frontier.put((0, start))
+ came_from = {}
+ cost_so_far = {}
+ came_from[start] = None
+ cost_so_far[start] = 0
+
+ while not frontier.empty():
+ _, current = frontier.get()
+ if current == goal:
+ break
+ neighbors = graph.neighbors(current)
+ for prox, occ in neighbors:
+ new_cost = cost_so_far[current] + graph.cost(current, prox)
+ if occ is None and (prox not in cost_so_far or new_cost < cost_so_far[prox]):
+ cost_so_far[prox] = new_cost
+ priority = new_cost + AStar.__heuristic(graph.transform2Cart(goal), graph.transform2Cart(prox))
+ frontier.put((priority, prox))
+ came_from[prox] = current
+
+ return came_from, cost_so_far
+
+ @staticmethod
+ def __heuristic(a, b):
+ (x1, y1) = a
+ (x2, y2) = b
+ return abs(x1 - x2) + abs(y1 - y2)
\ No newline at end of file
diff --git a/new_scripts/PathPlanning/BreadthFirstSearch.py b/new_scripts/PathPlanning/BreadthFirstSearch.py
new file mode 100644
index 0000000..dd6a07c
--- /dev/null
+++ b/new_scripts/PathPlanning/BreadthFirstSearch.py
@@ -0,0 +1,36 @@
+""" Nome do módulo : BreadthFirstSearch
+ Ano de criação : 2019/10
+ Descrição do módulo : Algoritmo de Busca Primeiro em Largura para Grafos
+ Versão : 1.0
+ Pré-requisitos : IPathPlanning
+ GridGraph
+ Queue
+ Membros : Lorena Basasani
+"""
+from .IPathPlanning import IPathPlanning
+from .Graph import GridGraph
+from queue import Queue
+
+""" Explores equally in all directions. This is an incredibly useful algorithm,
+ not only for regular path finding, but also for procedural map generation,
+ flow field pathfinding, distance maps, and other types of map analysis.
+"""
+class BreadthFirstSearch(IPathPlanning):
+
+ @staticmethod
+ def PathPlan(graph, start, goal):
+ frontier = Queue()
+ frontier.put(start)
+ came_from = {}
+ came_from[start] = None
+ while not frontier.empty():
+ current = frontier.get()
+ if current == goal:
+ break
+ neighbors = graph.neighbors(current)
+ for prox, occ in neighbors:
+ if prox not in came_from and occ == None:
+ frontier.put(prox)
+ came_from[prox] = current
+
+ return came_from
\ No newline at end of file
diff --git a/new_scripts/PathPlanning/DijkstraAlgorithm.py b/new_scripts/PathPlanning/DijkstraAlgorithm.py
new file mode 100644
index 0000000..e12ee6f
--- /dev/null
+++ b/new_scripts/PathPlanning/DijkstraAlgorithm.py
@@ -0,0 +1,43 @@
+""" Nome do módulo : DijkstraAlgorithm
+ Ano de criação : 2019/10
+ Descrição do módulo : Algoritmo de Dijkstra para busca de caminho em grafos
+ Versão : 1.0
+ Pré-requisitos : IPathPlanning
+ WeightedGridGraph
+ PriorityQueue
+ Membros : Lorena Bassani
+"""
+from .Graph import WeightedGridGraph
+from .IPathPlanning import IPathPlanning
+from queue import PriorityQueue
+
+""" Instead of exploring all possible paths equally, it favors lower cost paths.
+ We can assign lower costs to encourage moving on roads, higher costs to avoid
+ forests, higher costs to discourage going near enemies, and more. When movement
+ costs vary, we use this instead of Breadth First Search.
+"""
+class DijkstraAlgorithm(IPathPlanning):
+
+ @staticmethod
+ def PathPlan(graph, start, goal):
+ frontier = PriorityQueue()
+ frontier.put((0, start))
+ came_from = {}
+ cost_so_far = {}
+ came_from[start] = None
+ cost_so_far[start] = 0
+
+ while not frontier.empty():
+ _, current = frontier.get()
+ if current == goal:
+ break
+ neighbors = graph.neighbors(current)
+ for prox, occ in neighbors:
+ new_cost = cost_so_far[current] + graph.cost(current, prox)
+ if occ is None and (prox not in cost_so_far or new_cost < cost_so_far[prox]):
+ cost_so_far[prox] = new_cost
+ priority = new_cost
+ frontier.put((priority, prox))
+ came_from[prox] = current
+
+ return came_from, cost_so_far
\ No newline at end of file
diff --git a/new_scripts/PathPlanning/DrawingGrid.py b/new_scripts/PathPlanning/DrawingGrid.py
new file mode 100644
index 0000000..a1ddefe
--- /dev/null
+++ b/new_scripts/PathPlanning/DrawingGrid.py
@@ -0,0 +1,33 @@
+""" Nome do módulo : GraphDrawer
+ Ano de criação : 2019/10
+ Descrição do módulo : Desenha o Grafo em tela
+ Versão : 1.0
+ Pré-requisitos : GridGraph
+ Membros : Lorena Bassani
+"""
+from .Graph import GridGraph
+class GridDrawer(object):
+ @staticmethod
+ def draw_tile(graph, c, style, width):
+ r = "."
+ if 'number' in style and c in style['number']: r = "%d" % style['number'][c]
+ if 'point_to' in style and style['point_to'].get(graph.transform2Grid(c), None) is not None:
+ (x1, y1) = c
+ (x2, y2) = graph.transform2Cart(style['point_to'][graph.transform2Grid(c)])
+ if x2 == x1 + 1: r = ">"
+ if x2 == x1 - 1: r = "<"
+ if y2 == y1 + 1: r = "v"
+ if y2 == y1 - 1: r = "^"
+ if 'start' in style and c == style['start']: r = "A"
+ if 'goal' in style and c == style['goal']: r = "Z"
+ if 'path' in style and c in style['path']: r = "@"
+ if c in list(map(lambda x : graph.transform2Cart(x), graph.whatIsOccupied())) : r = "#" * width
+ return r
+
+ @staticmethod
+ def draw_grid(graph, width=2, **style):
+ nx, ny = graph.grid
+ for y in range(ny):
+ for x in range(nx):
+ print("%%-%ds" % width % GridDrawer.draw_tile(graph, (x, y), style, width), end="")
+ print()
diff --git a/new_scripts/PathPlanning/Graph.py b/new_scripts/PathPlanning/Graph.py
new file mode 100644
index 0000000..6d2584e
--- /dev/null
+++ b/new_scripts/PathPlanning/Graph.py
@@ -0,0 +1,164 @@
+""" Nome do módulo : Graph
+ Ano de criação : 2019/10
+ Descrição do módulo : Implementa SimpleGraph e GridGaph
+ Versão : 1.0
+ Pré-requisitos : Nenhum
+ Membros : Lorena Bassani
+"""
+class SimpleGraph(object):
+ def __init__(self):
+ self.edges = {}
+
+ """ Nome da função : neighbors
+ Intenção da função : Retorna os Vizinhos do nó
+ Pré-requisitos : Nó pertencente ao grafo
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nó : Nó do qual se deseja saber os vizinhos
+ Retorno : list : Vizinhos do Nó
+ """
+ def neighbors(self, id):
+ return self.edges[id]
+
+class GridGraph(object):
+ def __init__(self, celulasX, celulasY):
+ self.__grade = (celulasX, celulasY)
+ self.__occupied = list()
+
+ """ Nome da função : grid (getter)
+ Intenção da função : Retorna as dimensões da Grade
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : (nx, ny) : Dimensão da Grade
+ """
+ @property
+ def grid(self):
+ return self.__grade
+
+ """ Nome da função : occupy
+ Intenção da função : Ocupar uma celula com um objeto
+ Pré-requisitos : Celula pertencente a Grade
+ Efeitos colaterais : A Celula informada passa a ser ocupada pelo objeto
+ Parâmetros : int : Celula a ser ocupada
+ object : Objeto que irá ocupar a célula
+ Retorno : Nenhum
+ """
+ def occupy(self, cel, obj):
+ if self.isInsideGrid(cel):
+ self.__occupied.append((cel, obj))
+
+ """ Nome da função : release
+ Intenção da função : Libera a Celula
+ Pré-requisitos : Celula pertencente a Grade e ocupada
+ Efeitos colaterais : Desocupa a celula (Cuidado, pode eliminar se for a única referência para ele)
+ Parâmetros : int : Celula a ser liberada
+ Retorno : Nenhum
+ """
+ def release(self, cel):
+ liberar = self.getOccupier(cel)
+ if liberar:
+ self.__occupied.remove(liberar)
+
+ """ Nome da função : isOccupied
+ Intenção da função : Dizer se a celula está ocupada
+ Pré-requisitos : Celula pertencente a Grade
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula que se deseja saber se está ocupada
+ Retorno : Boolean : True se estiver ocupada, False caso contrário
+ """
+ def isOccupied(self, cel):
+ return self.getOccupier(cel) is not None
+
+ """ Nome da função : getOccupier
+ Intenção da função : Retornar referência ao objeto que ocupa uma celula, junto com a celula ocupada
+ Pré-requisitos : Celula pertecente a Grade
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula a ser retornada
+ Retorno : (int, object) : Celula e objeto que a ocupa (None se não for ocupada)
+ """
+ def getOccupier(self, cel):
+ ocupador = list(filter(lambda x: x[0] == cel, self.__occupied))
+ if ocupador:
+ return ocupador[0]
+ return None
+
+ """ Nome da função : isInsideGrid
+ Intenção da função : Dizer se uma celula está na Grade
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula que se deseja saber se pertence a Grade
+ Retorno : Boolean : True se pertencer a grade, False caso contrário
+ """
+ def isInsideGrid(self, cel):
+ return cel >= 0 and cel < self.__grade[0]*self.__grade[1]
+
+ """ Nome da função : whatIsOccupied
+ Intenção da função : Retornar todos os pontos ocupados da Grade
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : Nenhum
+ Retorno : list : Lista de Celulas ocupadas na Grade
+ """
+ def whatIsOccupied(self):
+ return list(map(lambda x: x[0], self.__occupied))
+
+ """ Nome da função : neighbors
+ Intenção da função : Retornar Vizinhos da Celula
+ Pré-requisitos : Celula pertencente a Grade
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula que se deseja saber os vizinhos
+ Retorno : list : Lista com as celulas vizinhas
+ """
+ def neighbors(self, cel):
+ nbs = list()
+ cels = list()
+ cels.append(cel - self.__grade[0])
+ cels.append(cel + self.__grade[0])
+ if cel % self.__grade[0] > 0:
+ cels.append(cel - 1)
+ if cel % self.__grade[0] < self.__grade[0] - 1:
+ cels.append(cel + 1)
+
+ for c in cels:
+ if self.isInsideGrid(c):
+ o = self.getOccupier(c)
+ if o is None:
+ o = (c, None)
+ nbs.append(o)
+ return nbs
+
+ """ Nome da função : transform2Cart
+ Intenção da função : Transforma uma celula da Grade em um ponto cartesiano correspondente
+ Pré-requisitos : Celula pertencente a Grade
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula que se deseja saber as coordenadas cartesianas
+ Retorno : (int, int) : Coordenadas cartesianas correrpondestes a celula
+ """
+ def transform2Cart(self, cel):
+ return (cel % self.__grade[0], cel // self.__grade[0])
+
+ """ Nome da função : transform2Grid
+ Intenção da função : Transformar um ponto cartesiano em um ponto da grade
+ Pré-requisitos : Ponto pertencente ao dominio [0, 0]x[nx, ny]
+ Efeitos colaterais : Nenhum
+ Parâmetros : (int, int) : Coordenadas cartesianas do ponto que se deseja saber a celula na Grade
+ Retorno : int : Celula correspondente ao ponto
+ """
+ def transform2Grid(self, cel):
+ x, y = cel
+ return y*self.__grade[0] + x
+
+class WeightedGridGraph(GridGraph):
+ def __init__(self, celulasX, celulasY):
+ GridGraph.__init__(self, celulasX, celulasY)
+
+ """ Nome da função : cost
+ Intenção da função : Calcula o custo de se mover de start até goal
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Nenhum
+ Parâmetros : int : Celula de Inicio
+ int : Celula de Objetivo
+ Retorno : int : Custo de movimentação pela grade
+ """
+ def cost(self, start, goal):
+ return 1
diff --git a/new_scripts/PathPlanning/IPathPlanning.py b/new_scripts/PathPlanning/IPathPlanning.py
new file mode 100644
index 0000000..4808b5b
--- /dev/null
+++ b/new_scripts/PathPlanning/IPathPlanning.py
@@ -0,0 +1,24 @@
+""" Nome do módulo : IPathPlanning
+ Ano de criação : 2019/10
+ Descrição do módulo : Interface de Algoritmos de Planejamento de Trajetória
+ Versão : 1.0
+ Pré-requisitos :
+ Membros : Lorena Bassani
+"""
+
+class IPathPlanning(object):
+
+ @staticmethod
+ def PathPlan(graph, start, goal):
+ raise NotImplementedError
+
+ @staticmethod
+ def reconstructPath(cameFrom, start, goal):
+ current = goal
+ path = []
+ while current != start:
+ path.append(current)
+ current = cameFrom[current]
+ path.append(start) # optional
+ path.reverse() # optional
+ return path
\ No newline at end of file
diff --git a/new_scripts/PathPlanning/__init__.py b/new_scripts/PathPlanning/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/new_scripts/Patterns/Observer.py b/new_scripts/Patterns/Observer.py
new file mode 100644
index 0000000..75a549d
--- /dev/null
+++ b/new_scripts/Patterns/Observer.py
@@ -0,0 +1,54 @@
+""" Nome do módulo : Observer
+ Ano de criação : 2019/10
+ Descrição do módulo : Interface do Padrão Observer
+ Versão : 1.0
+ Pré-requisitos : Nenhum
+ Membros : Lorena B Bassani
+"""
+
+class Observer(object):
+
+ """ Nome da função : update
+ Intenção da função : Informar a ocorrencia do evento para o observador
+ Pré-requisitos : Desconhecido
+ Efeitos colaterais : Desconhecido
+ Parâmetros : Desconhecido
+ Retorno : Desconhecido
+ """
+ def update(self, *args, **keyargs):
+ raise NotImplementedError
+
+class Notifier(object):
+ def __init__(self):
+ self.__observers = list()
+
+ """ Nome da função : attach
+ Intenção da função : Inserir um observador na lista de observação
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : O Observador é inserido na lista de observação
+ Parâmetros : Observer : Observador a ser inserido
+ Retorno : Nenhum
+ """
+ def attach(self, observer : Observer):
+ self.__observers.append(observer)
+
+ """ Nome da função : dettach
+ Intenção da função : Retirar um Observador da lista de observação
+ Pré-requisitos : Observador estar na lista de observadores
+ Efeitos colaterais : Observador é retirado da lista de observadores
+ Parâmetros : Obervador : Observador a ser retirado da lista de observadores
+ Retorno : Nenhum
+ """
+ def dettach(self, observer: Observer):
+ self.__observers.remove(observer)
+
+ """ Nome da função : notify
+ Intenção da função : Notificar todos os observadores
+ Pré-requisitos : Nenhum
+ Efeitos colaterais : Todos os obervadores são notificados
+ Parâmetros : Desconhecido
+ Retorno : Nenhum
+ """
+ def notify(self, *args, **keyargs):
+ map(lambda x: x.update(*args, **keyargs), self.__observers)
+
diff --git a/new_scripts/Patterns/Singleton.py b/new_scripts/Patterns/Singleton.py
new file mode 100644
index 0000000..98b4794
--- /dev/null
+++ b/new_scripts/Patterns/Singleton.py
@@ -0,0 +1,23 @@
+""" Nome do módulo : Singleton
+ Ano de criação : 2019/10
+ Descrição do módulo : Módulo que implementa padrão Singleton
+ Versão : 2.0
+ Pré-requisitos : Nenhum
+ Membros : Lorena B. Bassani
+"""
+
+class Singleton(object):
+ __single = None # the one, true Singleton
+
+ def __new__(classtype, *args, **kwargs):
+ # Check to see if a __single exists already for this class
+ # Compare class types instead of just looking for None so
+ # that subclasses will create their own __single objects
+ if classtype != type(classtype.__single):
+ classtype.__single = object.__new__(classtype)
+ classtype.inicializa(classtype.__single, *args, **kwargs)
+ return classtype.__single
+
+ def inicializa(self, *args, **keyargs):
+ raise NotImplementedError
+
diff --git a/new_scripts/__init__.py b/new_scripts/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/scripts/.idea/.name b/scripts/.idea/.name
deleted file mode 100644
index c47b4d5..0000000
--- a/scripts/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-vsss
\ No newline at end of file
diff --git a/scripts/.idea/encodings.xml b/scripts/.idea/encodings.xml
deleted file mode 100644
index d821048..0000000
--- a/scripts/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/misc.xml b/scripts/.idea/misc.xml
deleted file mode 100644
index 9689a07..0000000
--- a/scripts/.idea/misc.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/modules.xml b/scripts/.idea/modules.xml
deleted file mode 100644
index d686c92..0000000
--- a/scripts/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/scopes/scope_settings.xml b/scripts/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/scripts/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/vcs.xml b/scripts/.idea/vcs.xml
deleted file mode 100644
index 6564d52..0000000
--- a/scripts/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/vsss.iml b/scripts/.idea/vsss.iml
deleted file mode 100644
index d0876a7..0000000
--- a/scripts/.idea/vsss.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/.idea/workspace.xml b/scripts/.idea/workspace.xml
deleted file mode 100644
index 9dd1ef3..0000000
--- a/scripts/.idea/workspace.xml
+++ /dev/null
@@ -1,451 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1430166199066
-
- 1430166199066
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/scripts/Agent.py b/scripts/Agent.py
index 21823da..d4ed4ba 100644
--- a/scripts/Agent.py
+++ b/scripts/Agent.py
@@ -1,13 +1,12 @@
import math
-import World
class Agent:
def __init__(self):
self.x = self.y = 0
- def update_position(self, (x, y)):
- self.x = x
- self.y = y
+ def update_position(self, t):
+ self.x = t[0]
+ self.y = t[1]
def getx(self):
return self.x
@@ -21,6 +20,5 @@ def getxy(self):
def distance_to(self, x, y):
return math.sqrt((x - self.x) ** 2 + (y - self.y) ** 2)
- def predicao_adaptativa(self, x):
- #return 4
- return 4.5 + (x - World.World.FIELD_LEFT) * (3.5 - 4.5) / (World.World.FIELD_RIGHT - World.World.FIELD_LEFT)
\ No newline at end of file
+ def predicao_adaptativa(self, x, mundo):
+ return 4.5 + (x - mundo.FIELD_LEFT) * (3.5 - 4.5) / (mundo.FIELD_RIGHT - mundo.FIELD_LEFT)
\ No newline at end of file
diff --git a/scripts/Agent.pyc b/scripts/Agent.pyc
deleted file mode 100644
index 0d95996..0000000
Binary files a/scripts/Agent.pyc and /dev/null differ
diff --git a/scripts/Arquivos.rar b/scripts/Arquivos.rar
deleted file mode 100644
index e9cb74f..0000000
Binary files a/scripts/Arquivos.rar and /dev/null differ
diff --git a/scripts/Ball.py b/scripts/Ball.py
index e5d0bdb..22e50f2 100644
--- a/scripts/Ball.py
+++ b/scripts/Ball.py
@@ -1,10 +1,9 @@
-import Agent
+from .Agent import Agent
import math
-class Ball(Agent.Agent):
+class Ball(Agent):
def __init__(self):
- #self.x_old, self.y_old = 0, 0
self.x_old = [0.0,0.0,0.0,0.0,0.0]
self.y_old = [0.0,0.0,0.0,0.0,0.0]
self.x = self.y = 0
@@ -12,16 +11,10 @@ def __init__(self):
def getxy_old(self):
return self.x_old, self.y_old
- # def predict_ball_method(self, player):
- # return self.x,self.y
-
- def predict_ball_method(self, player):
+ def predict_ball_method(self, player, mundo):
mx = sum(self.x_old)/5.0
my = sum(self.y_old)/5.0
- #vx_ball = self.getx() - self.x_old
- #vy_ball = self.gety() - self.y_old
-
vx_ball = (self.getx() - mx)/2.0
vy_ball = (self.gety() - my)/2.0
@@ -38,31 +31,23 @@ def predict_ball_method(self, player):
dif_y = self.gety()-player.gety()
ro_aux = math.sqrt(dif_x**2 + dif_y**2)
- c_magic = self.predicao_adaptativa(self.x)
- #k_pred = c_magic*ro_aux/80.0
+ c_magic = self.predicao_adaptativa(self.x, mundo)
k_pred = c_magic*ro_aux/100.0
cx_ball_predic = self.getx() + vx_ball * k_pred * norm_v_ball
cy_ball_predic = self.gety() + vy_ball * k_pred * norm_v_ball
return cx_ball_predic, cy_ball_predic
- def predict_ball_method_ofensive(self, player):
+ def predict_ball_method_ofensive(self, player, mundo):
mx = sum(self.x_old)/5.0
my = sum(self.y_old)/5.0
- #vx_ball = self.getx() - self.x_old
- #vy_ball = self.gety() - self.y_old
vx_ball = (self.getx() - mx)/2.0
vy_ball = (self.gety() - my)/2.0
norm_v_ball = math.sqrt(vx_ball**2 + vy_ball**2)
- """
- if norm_v_ball < 2:
- cx_ball_predic = self.getx()
- cy_ball_predic = self.gety()
- else:"""
if(norm_v_ball == 0):
norm_v_ball = 1
vx_ball /= norm_v_ball
@@ -72,8 +57,7 @@ def predict_ball_method_ofensive(self, player):
dif_y = self.gety()-player.gety()
ro_aux = math.sqrt(dif_x**2 + dif_y**2)
- c_magic = self.predicao_adaptativa(self.x)
- #k_pred = c_magic*ro_aux/80.0
+ c_magic = self.predicao_adaptativa(self.x, mundo)
k_pred = c_magic*ro_aux/85.0
cx_ball_predic = self.getx() + vx_ball * k_pred * norm_v_ball
@@ -81,32 +65,8 @@ def predict_ball_method_ofensive(self, player):
return cx_ball_predic, cy_ball_predic
- """
- def predict_ball_method_ofensive(self, player):
- vx_ball = self.getx() - self.x_old
- vy_ball = self.gety() - self.y_old
- norm_v_ball = math.sqrt(vx_ball**2 + vy_ball**2)
-
- if norm_v_ball < 2:
- cx_ball_predic = self.getx()
- cy_ball_predic = self.gety()
- else:
- vx_ball /= norm_v_ball
- vy_ball /= norm_v_ball
-
- dif_x = self.getx()-player.getx()
- dif_y = self.gety()-player.gety()
- ro_aux = math.sqrt(dif_x**2 + dif_y**2)
-
- k_pred = 3.0 #1.0
-
- cx_ball_predic = self.getx() + vx_ball * k_pred * norm_v_ball
- cy_ball_predic = self.gety() + vy_ball * k_pred * norm_v_ball
- return cx_ball_predic, cy_ball_predic
- """
def set_position(self, xy):
- #self.x_old, self.y_old = self.getxy()
xo, yo = self.getxy()
self.x_old.insert(0,float(xo))
self.x_old.pop()
diff --git a/scripts/Ball.pyc b/scripts/Ball.pyc
deleted file mode 100644
index 81aa55d..0000000
Binary files a/scripts/Ball.pyc and /dev/null differ
diff --git a/scripts/Communication.pyc b/scripts/Communication.pyc
deleted file mode 100644
index 6001d97..0000000
Binary files a/scripts/Communication.pyc and /dev/null differ
diff --git a/scripts/Goalkeeper.py b/scripts/Goalkeeper.py
index 8781c26..9efd628 100644
--- a/scripts/Goalkeeper.py
+++ b/scripts/Goalkeeper.py
@@ -1,31 +1,20 @@
-import Player
-from World import *
+from .Player import Player
+from .World import *
import numpy as np
-from lista_marcacoes import *
+from .lista_marcacoes import *
'''posicaox = [0,0,0,0] para pegar o vetor velocidade
posicaoy = [0,0,0,0]'''
-class Goalkeeper(Player.Player):
- # def __init__(self, rid=None):
- # Player.__init__(rid)
- # self.path_x = [0.10,0.30,0.60]
- # self.path_y = [0.10,0.30,0.60]
- # self.start = True
+class Goalkeeper(Player):
+ def __init__(self):
+ Player.__init__(self)
def defende(self, world):
- xp, yp = world.get_ball().predict_ball_method(self)
- #adiciona_ponto(int(xp), int(yp), 255, 0, 102, 'bola prevista')
+ xp, yp = world.get_ball().predict_ball_method(self, world)
posx = world.get_team_goal()[0] + 10
- '''
- theta_r = math.atan2(float(world.get_ball().gety() - world.trave_left_upper[1]),
- float(world.get_ball().getx() - (world.trave_left_upper[0])))
- theta_s = math.atan2(float(world.get_ball().gety() - world.trave_left_lower[1]),
- float(world.get_ball().getx() - (world.trave_left_lower[0])))
- '''
-
theta_r = math.atan2(float(yp - world.trave_left_upper[1]),
float(xp - (world.trave_left_upper[0])))
theta_s = math.atan2(float(yp - world.trave_left_lower[1]),
@@ -33,17 +22,12 @@ def defende(self, world):
m_bissetriz = math.tan((theta_r + theta_s) / 2.0)
- #bissetriz = -m_bissetriz * (world.get_ball().getx() - posx) + world.get_ball().gety()
bissetriz = -m_bissetriz * (xp - posx) + yp
- #posy = (bissetriz + world.get_ball().gety()) * 0.5
- #posy = (bissetriz*3 + world.get_ball().gety()) /4.0
posy = (bissetriz*3 + yp) /4.0
if(abs(posx - world.get_ball().getx()) < 30):
- #posy = world.get_ball().gety()
posy = yp
- #print posy
if posy < world.trave_left_upper[1] - 1.8:
posy = world.trave_left_upper[1] - 1.8
posx -= 3
@@ -51,49 +35,18 @@ def defende(self, world):
posx -= 3
posy = world.trave_left_lower[1] + 1.8
- # kc = 0.1 #kc define a curvatura do trajeto de setpoint do goleiro
- # posx = world.get_team_goal()[0] - 30 + abs(kc*(posy - world.get_team_goal()[1]))
-
- # cv2.circle(frame,( int(posx) , int(posy) ),5,(200,100,100),-1)
-
- '''
- posicaox[1] = posicaox[0] #guarda posicao antiga da bolinha
- posicaox[0] = world.get_ball().getx() #atualiza posicao atual da bolinha
-
- posicaoy[1] = posicaoy[0]
- posicaoy[0] = world.get_ball().gety()
-
- posicaox[3] = posicaox[2] #guarda posicao antiga do setpoint
- posicaox[2] = posx #atualiza posicao atual do setpoint
-
- posicaoy[3] = posicaoy[2]
- posicaoy[2] = posy
-
- #print "Antigo" , posicaoy[1]
- #print "Novo", posicaoy[0]
-
- print "Vetor velocidade da bolinha (", posicaox[0] - posicaox[1] , " ", posicaoy[0] - posicaoy[1], ")"
- print "Vetor velocidade do setpoint (", posicaox[2] - posicaox[3] , " ", posicaoy[2] - posicaoy[3], ")"
-
- '''
adiciona_ponto(int(world.trave_left_upper[0]), int(world.trave_left_upper[1]),255,255,2555,'xg+20, yg')
adiciona_ponto(int(world.trave_left_lower[0]), int(world.trave_left_lower[1]),255,255,2555,'xg+20, yg')
- #print 'goleiro : ',posx, posy
+
return posx , posy # coordenadas que o goleiro deve ficar
def controle(self, world):
- pd = world.get_goalkeeper()
+ pd = self
xfront , yfront = pd.get_front() #unidade das coordenadas eh cm
xback , yback = pd.get_back() #unidade das coordenadas eh cm
pd_x , pd_y = pd.getx() , pd.gety() #unidade das coordenadas eh cm
- #xb, yb = world.get_ball().getxy()
xb, yb = self.defende(world) # coordenadas que o goleiro deve ficar
- '''if(math.sqrt((xb - pd_x)/100, (yb - pd_y)/100) < 0.05 or start):
- start = False
- xb = self.position_x.pop()
- yb = self.position_y.pop()
- '''
theta_jog = self.get_theta()
theta_ball = math.atan2(yb,xb) # unidade rad
diff --git a/scripts/Goalkeeper.pyc b/scripts/Goalkeeper.pyc
deleted file mode 100644
index 4c1cec0..0000000
Binary files a/scripts/Goalkeeper.pyc and /dev/null differ
diff --git a/scripts/Player.py b/scripts/Player.py
index 84585e0..9e75e57 100644
--- a/scripts/Player.py
+++ b/scripts/Player.py
@@ -1,9 +1,9 @@
-import Agent
+from .Agent import Agent
import math
-import World
+from .World import *
-class Player(Agent.Agent):
+class Player(Agent):
def __init__(self, rid=None):
self.xa_old = [0.0,0.0,0.0,0.0,0.0]
@@ -13,8 +13,9 @@ def __init__(self, rid=None):
self.xa = self.ya = self.xb = self.yb = 0
self.theta_old = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]
self.theta = 0
- self.medo_de_bater_na_parede = 30.0;
+ self.medo_de_bater_na_parede = 30.0
self.id = rid
+ Agent.__init__(self)
############# Controlador
@@ -24,9 +25,9 @@ def __init__(self, rid=None):
self.te_old = 0
#somatorio dos erros para o KI
- self.erroX = 0;
- self.erroY = 0;
- self.erroT = 0;
+ self.erroX = 0
+ self.erroY = 0
+ self.erroT = 0
def set_xe_old(self, xe):
self.xe_old = xe
@@ -103,20 +104,18 @@ def update_theta(self):
self.theta = sum(self.theta_old)/15.0
def update_xy(self):
- # distancia_y = int(yt) - 0.5*(int(cy_pink)+int(cy_team))
- #distancia_x = int(xt) - 0.5*(int(cx_pink)+int(cx_team))
x = 0.5 * (self.xa + self.xb)
y = 0.5 * (self.ya + self.yb)
self.update_position((x, y))
- def set_position(self, (xa, ya), (xb, yb)):
- self.xa_old.insert(0,float(xa))
+ def set_position(self, ta, tb):
+ self.xa_old.insert(0,float(ta[0]))
self.xa_old.pop()
- self.ya_old.insert(0,float(ya))
+ self.ya_old.insert(0,float(ta[1]))
self.ya_old.pop()
- self.xb_old.insert(0,float(xb))
+ self.xb_old.insert(0,float(tb[0]))
self.xb_old.pop()
- self.yb_old.insert(0,float(yb))
+ self.yb_old.insert(0,float(tb[1]))
self.yb_old.pop()
mxa = sum(self.xa_old)/5.0
@@ -135,7 +134,6 @@ def set_position_xyt(self, x, y, theta):
self.set_theta(theta)
def get_theta(self):
- #return self.theta*180.0/3.1415
return self.theta
def predicao_adaptativa(self, x, world):
@@ -143,11 +141,11 @@ def predicao_adaptativa(self, x, world):
def chuta(self, world):
ball = world.get_ball()
- xb, yb = ball.predict_ball_method(self)
+ xb, yb = ball.predict_ball_method(self, world)
xr, yr = self.getxy()
xg, yg = world.get_right_goal()
my_inf = 1e5
- ofensividade = world.campo_potencial(self)
+ ofensividade = self.campo_potencial(world)
d_East = abs(xb - world.FIELD_RIGHT)
d_West = abs(xb - world.FIELD_LEFT)
@@ -169,14 +167,14 @@ def chuta(self, world):
pto_inf = ((world.FIELD_RIGHT + world.FIELD_LEFT)/2, my_inf)
d_Best = d_South
- value = world.campo_potencial(self)
+ value = self.campo_potencial(world)
grad_x = (world.campo_potencial_g(xb + 10.0, yb, self.medo_de_bater_na_parede) - value )
grad_y = (world.campo_potencial_g(xb, yb + 10.0, self.medo_de_bater_na_parede) - value )
- norm_grad = math.sqrt(grad_x ** 2 + grad_y ** 2);
+ norm_grad = math.sqrt(grad_x ** 2 + grad_y ** 2)
if norm_grad != 0:
grad_x /= norm_grad
grad_y /= norm_grad
@@ -184,7 +182,6 @@ def chuta(self, world):
curva_de_nivel_segura = 0.2 # Curva de nivel a partir da qual nao eh mais possivel manobrar o robo.
- # cv2.circle(frame,( int(grad_x + xb_real) , int(grad_y + yb_real) ),5,(200,200,50),-1)
posx = xb
posy = yb
@@ -238,43 +235,16 @@ def lyapunov(self, ro, alfa, Kni, K_alfa_omega, fator_freio):
v_r = (omega + ni)
v_l = (-omega + ni)
-
- #print "antes, vr, vl = ", v_l, v_r
-
+
maior = max(abs(v_r),abs(v_l))
if maior > 255.0:
v_r = v_r * (255.0/maior)
v_l = v_l * (255.0/maior)
- """
- if abs(v_r) > 255.0:
- v_r = v_r * (255.0/abs(v_r))
- v_l = v_l * (255.0/abs(v_r))
-
-
- if abs(v_l) > 255.0:
- v_l = v_l * (255.0/abs(v_l))
- v_r = v_r * (255.0/abs(v_l))
- """
-
v_r = int(v_r)
v_l = int(v_l)
- """
- if v_r > 255:
- v_r = 255
- if v_r < -255:
- v_r = -255
-
- if v_l > 255:
- v_l = 255
- if v_l < -255:
- v_l = -255
- """
-
- #print "depois, vr, vl = ", v_l, v_r
-
return v_r, v_l
def controle(self, world):
@@ -324,3 +294,15 @@ def controle(self, world):
vr, vl = y[0][0]*K/vmax, y[1][0]*K/vmax #mudei a constante para 255 antes era 100
return int(vr), int(vl)
+
+ def campo_potencial(self, mundo):
+ #return (math.tanh((xr - right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_upper[1])**2/medo_de_bater_na_parede**2))/4.0
+ xr, yr = self.getxy()
+ dx = xr - mundo.left_goal[0]
+ dy = yr - mundo.left_goal[1]
+
+ ro = math.sqrt(dx**2+dy**2)
+ ret = (math.tanh((xr - mundo.right_upper[0])**2/self.medo_de_bater_na_parede**2)* math.tanh((xr - mundo.left_upper[0])**2/self.medo_de_bater_na_parede**2) * math.tanh((yr - mundo.right_lower[1])**2/self.medo_de_bater_na_parede**2) * math.tanh((yr - mundo.right_upper[1])**2/self.medo_de_bater_na_parede**2))/(1-math.exp(-(ro**2)/8000.0))/4.0
+ if ro < 100:
+ ret = 0
+ return ret
\ No newline at end of file
diff --git a/scripts/Player.pyc b/scripts/Player.pyc
deleted file mode 100644
index c788078..0000000
Binary files a/scripts/Player.pyc and /dev/null differ
diff --git a/scripts/PlayerAtaque.py b/scripts/PlayerAtaque.py
index c2aa1dd..9d381c2 100644
--- a/scripts/PlayerAtaque.py
+++ b/scripts/PlayerAtaque.py
@@ -1,18 +1,20 @@
-import Player
+from .Player import Player
import math
-import World
+from .World import World
import numpy as np
import cv2
-from lista_marcacoes import *
+from .lista_marcacoes import *
+
+class PlayerAtaque(Player):
+ def __init__(self):
+ Player.__init__(self)
-class PlayerAtaque(Player.Player):
def chuta(self, world):
#dados
distancia_pra_sair_da_parede = 3.5
ball = world.get_ball()
- #xb,yb = ball.getx(),ball.gety()
- xb, yb = ball.predict_ball_method_ofensive(self)
+ xb, yb = ball.predict_ball_method_ofensive(self, world)
xg, yg = world.get_enemy_goal()
adiciona_ponto(int(xb), int(yb), 127, 255, 60, 'bola')
@@ -41,8 +43,7 @@ def chuta(self, world):
if self.getx() > world.FIELD_RIGHT and xb < self.getx(): # nao invadir o campo do defensor
return self.getx() - 30, self.gety()
- if yb > world.FIELD_BOTTOM - distancia_pra_sair_da_parede or yb < world.FIELD_TOP + distancia_pra_sair_da_parede or xb > world.FIELD_RIGHT -distancia_pra_sair_da_parede or xb < world.FIELD_LEFT + distancia_pra_sair_da_parede:
- #print "aqui"
+ if yb > world.FIELD_BOTTOM - distancia_pra_sair_da_parede or yb < world.FIELD_TOP + distancia_pra_sair_da_parede or xb > world.FIELD_RIGHT -distancia_pra_sair_da_parede or xb < world.FIELD_LEFT + distancia_pra_sair_da_parede:
if self.gety() > world.FIELD_BOTTOM - distancia_pra_sair_da_parede and (theta_robo > 30 and theta_robo < 150) :
return self.getx(),self.gety() -15
elif self.gety() < world.FIELD_TOP + distancia_pra_sair_da_parede and (theta_robo > -150 and theta_robo < 30):
@@ -65,19 +66,13 @@ def chuta(self, world):
b = world.FIELD_TOP + 15
a = self.getx()
return a,b
- #if self.getx() > world.FIELD_RIGHT -distancia_pra_sair_da_parede:
- #a = world.FIELD_RIGHT - 15
- #b = self.gety()
- #return a,b
if self.getx() < world.FIELD_LEFT + distancia_pra_sair_da_parede:
a = world.FIELD_LEFT + 15
b = self.gety()
return a,b
- #acaba sair da parede
- #a = a -5
#nao pader no goleiro
- p = world.get_def_player()
+ p = world.get_def_player()[0]
x,y = p.getx(),p.gety()
adiciona_ponto(int(xg), int(yg+20),255,255,2555,'xg+20, yg')
@@ -88,9 +83,7 @@ def chuta(self, world):
x,y = self.getx()+5,self.gety()
return int(x),int(y)
return xb,yb
- #acaba aki
- #return a,b
#Quando o jogador se aproxima muito da bola, o setpoint deve ficar atras da bola, garantindo que ele chute a bola
sensibility = 1.5
distance_to_ball = math.sqrt((xb-self.getx())**2 + (yb-self.gety())**2)
@@ -106,30 +99,10 @@ def chuta(self, world):
if(yb < self.gety() and self.gety() > yg+20 ):#parte de baixo do campo
if(math.atan2(self.gety() - (yg+20),(self.getx()-xg)) - math.atan2(self.gety() -(yg-20),(self.getx()-xg)) > math.atan2((self.getx() - xb),(self.gety() - yb))):
return (xb + sensibility*(xb-self.getx())), (yb+ sensibility*(yb - self.gety()))
- #if(yb < yg -20 and yb < self.gety()):
- #return a , b-15
- #if(yb > yg +20 and yb > self.gety()):
- #return a, b+15
- #return a, b
-
- '''cm = (self.getx() + 5)
- raio = ((self.getx() - xb)**2 + (self.gety() - yb)**2)/2
- x_x0 = cm - (self.getx() + xb)/2
- y0 = (self.gety() + yb)/2
- c = x_x0**2 + y0**2-raio
- if(yb < self.gety()):
- y_final = y0 + (abs(y0**2 - c))**0.5
- else:
- y_final = y0 - (abs(y0**2 - c))**0.5
- #return a, b
- '''
#pega o teta para ir na frente da bola
cm = math.pi/6
raio = ((abs((self.getx() - xb)**2 + (self.gety() - yb)**2))**0.5)/2
- #if(not(self.gety() > yb)):
- #y_final = (self.gety() + yb)/2 + raio*math.sin(math.pi)
- #x_final = (self.getx() + xb)/2 + raio*math.cos(math.pi)
- #else:
+
if(self.gety() > yb):
teta = -math.atan2((xb - self.getx()),yb - self.gety()) -cm # roda pra cima
else:
@@ -147,7 +120,6 @@ def chuta(self, world):
return x_final , y_final
elif(self.getx() < xb and yb > self.gety() and yb > yg+20):
teta = math.pi/2 +math.atan2((xb - self.getx()),yb - self.gety())
- #teta = -math.atan2((xb - self.getx()),yb - self.gety()) -cm # roda pra cima
y_final = (self.gety() + yb)/2 + raio*math.sin(teta)
x_final = (self.getx() + xb)/2 + raio*math.cos(teta)
if(y_final > world.FIELD_BOTTOM):
@@ -196,35 +168,16 @@ def kalman(self,world):
def controle(self, world):
#xb e yb e a posicao onde o jogador atacante vai tentar ir
- pd = world.get_atk_player() #pega o atacante
+ pd = self #pega o atacante
xfront , yfront = pd.get_front() #unidade das coordenadas eh cm
xback , yback = pd.get_back() #unidade das coordenadas eh cm
pd_x , pd_y = pd.getx() , pd.gety() #unidade das coordenadas eh cm pega a posicao do atacante
xb, yb = world.get_ball().getxy() #unidade das coordenadas eh cm // pego a bola // usada para ver se o atacante vai direto para a bola
- #xb, yb = self.chuta(world) #Pega posicao para onde o atacante vai
- '''
- arq = open("posAtk.csv","a")
- arq.write(str(pd_x) + ", " + str(pd_y))
- arq.write("\n")
- arq.close()
-
- arq = open("ball.csv","a")
- arq.write(str(xb) + ", " + str(yb))
- arq.write("\n")
- arq.close()
- '''
- adiciona_ponto(int(pd_x),int(pd_y), 128, 200, 126, 'atacante',int(xb), int(yb)) # verde escuro
-
-
-
-
- #xb, yb = world.get_ball().predict_ball_method(self) #unidade das coordenadas eh cm
- #adiciona_ponto(int(xb), int(yb), 35, 100, 215, '')
+ adiciona_ponto(int(pd_x),int(pd_y), 128, 200, 126, 'atacante',int(xb), int(yb)) # verde escuro
theta_jog = self.get_theta()
theta_ball = math.atan2(yb,xb) # unidade rad
- #theta_ball = self.kalman(world)# funcao nao completa, nao chamar que da erro!
theta_gol = math.atan2(236,515)
@@ -286,15 +239,6 @@ def controle(self, world):
self.set_xe_old(erroy_atual)
self.set_xe_old(errot_atual)
- '''print("Matriz de Erro\n")
- print(Matriz_erro)
- print("Controlador\n")
- print(controladorPID)
- Matriz_erro = Matriz_erro*controladorPID
- print("Final\n")
- print(Matriz_erro)'''
-
-
y = pseudoA.dot(Matriz_erro)
vmax = max(abs(y[0][0]), abs(y[1][0])) # pega a maior velocidade
diff --git a/scripts/PlayerAtaque.pyc b/scripts/PlayerAtaque.pyc
deleted file mode 100644
index 4aa4004..0000000
Binary files a/scripts/PlayerAtaque.pyc and /dev/null differ
diff --git a/scripts/PlayerDefesa.py b/scripts/PlayerDefesa.py
index 686fa4d..e588749 100644
--- a/scripts/PlayerDefesa.py
+++ b/scripts/PlayerDefesa.py
@@ -1,10 +1,12 @@
-import Player
+from .Player import Player
import math
-import World
+from .World import World
import numpy as np
-from lista_marcacoes import *
+from .lista_marcacoes import *
-class PlayerDefesa(Player.Player):
+class PlayerDefesa(Player):
+ def __init__(self):
+ Player.__init__(self)
def chuta(self, world):
@@ -12,8 +14,7 @@ def chuta(self, world):
#captura de dados : bola, inimigo
ball = world.get_ball() #Pega bola
- #xb,yb = ball.getx(),ball.gety() #Pega posicoes x e y da bola
- xb, yb = ball.predict_ball_method(self) #Pega valor estimado de onde a bola estara
+ xb, yb = ball.predict_ball_method(self, world) #Pega valor estimado de onde a bola estara
xgi, ygi = world.get_enemy_goal() #Pega posicoes x e y do gol do oponente
xg, yg = world.get_team_goal() #Pega posicoes x e y do proprio gol
xd, yd = self.getxy() #Pega posicoes x e y do jogador defendor
@@ -43,7 +44,7 @@ def chuta(self, world):
#Calculo da distancia da defesa para o gol : FIM
#para impedir colicoes com o goleiro : INICIO
- p = world.get_goalkeeper()
+ p = world.get_goalkeeper()[0]
x,y = p.getx(),p.gety()
theta_robo = self.get_theta()
@@ -59,18 +60,9 @@ def chuta(self, world):
xm = xg - xgi#calculo do meio de campo X
ym = yg - ygi#calculo do meio de campo Y
- #NOVO
- xmeioRicardo = xg/2 + xgi/2#calculo do meio de campo X do Ricardo
- ymeioRicardo = yg/2 + ygi/2#calculo do meio de campo Y do Ricardo
-
- #Para nao passar do meio de campo : INICIO (Ricardo ta fazendo isto aqui :D)
- if xd > xmeioRicardo:
- return xmeioRicardo, yb
- #Para nao passar do meio de campo : FIM
-
#calculo da distancia da bola pro meio : INICIO
- vec_ball_meio_x = xb - xmeioRicardo
- vec_ball_meio_y = yb - ymeioRicardo
+ vec_ball_meio_x = xb
+ vec_ball_meio_y = yb
norm_vec_ball_meio = math.sqrt(vec_ball_meio_x**2 + vec_ball_meio_y**2)#distancia da bola pro meio
#calculo da distancia da bola pro meio : FIM
##########
@@ -103,27 +95,6 @@ def chuta(self, world):
#Tem que fazer novo :D (Ricardo) pra sair da parede
#Codigo para sair da parede!! : INICIO
- '''
- print world.FIELD_RIGHT, world.FIELD_BOTTOM, world.FIELD_TOP, world.FIELD_LEFT
- if self.getx() > world.FIELD_RIGHT and xb < self.getx():
- return self.getx() - 30, self.gety()
-
- if yb > world.FIELD_BOTTOM - distancia_pra_sair_da_parede or yb < world.FIELD_TOP + distancia_pra_sair_da_parede or xb > world.FIELD_RIGHT -distancia_pra_sair_da_parede or xb < world.FIELD_LEFT + distancia_pra_sair_da_parede:
- if self.gety() > world.FIELD_BOTTOM - distancia_pra_sair_da_parede and (theta_robo > 30 and theta_robo < 150) :
- return self.getx(),self.gety() -15
- elif self.gety() < world.FIELD_TOP + distancia_pra_sair_da_parede and (theta_robo > -150 and theta_robo < 30):
- return self.getx(),self.gety() +15
- if self.getx() > world.FIELD_RIGHT -distancia_pra_sair_da_parede:
- a = world.FIELD_RIGHT - 15
- return a,b
- elif self.getx() < world.FIELD_LEFT + distancia_pra_sair_da_parede:
- a = world.FIELD_LEFT + 15
- return a,b
-
- return xb, yb
- '''
- #Testar ||
- # \/
if self.gety() > world.FIELD_BOTTOM - distancia_pra_sair_da_parede and (theta_robo > 30 and theta_robo < 150):
b = world.FIELD_BOTTOM - 15
a = self.getx()
@@ -143,66 +114,20 @@ def chuta(self, world):
#Codigo para sair da parede!! : FIM
-
- distance_to_ball = math.sqrt((xb-self.getx())**2 + (yb-self.gety())**2)
- #distance_to_ball eh a mesma coisa que norm_vec_to_ball! Distancia do defensor para a bola
- '''
- if distance_to_ball < 20 and xb > self.getx(): #chuta a bola pro campo inimigo
- return (xb + 2*(xb-self.getx())), (yb + 2*(yb - self.gety()))
- if(not(yb+ (yb - self.gety()) > yg +20 or (yb+ (yb - self.gety()) < yg-20)) and xb < self.getx()): # caso esteja na do gol dar a volta
- if(yb < yg + 20 and yb < self.gety()): # dando a volta por cima (bjs recalque)############
- if(b+20 > world.FIELD_BOTTOM):
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , world.FIELD_BOTTOM -15
- else:
- return a-5 , world.FIELD_BOTTOM -15
- if(b+20 < world.FIELD_TOP):
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , world.FIELD_BOTTOM +15
- else:
- return a-5 , world.FIELD_BOTTOM +15
- else:
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , b+20
- else:
- return a-5 , b+20
- else: # dando a volta por baixo########################
- if(b-20 > world.FIELD_BOTTOM):
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , world.FIELD_BOTTOM -15
- else:
- return a-5 , world.FIELD_BOTTOM -15
- if(b-20 < world.FIELD_TOP):
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , world.FIELD_BOTTOM +15
- else:
- return a-5 , world.FIELD_BOTTOM +15
- else:
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , b-20
- else:
- return a-5 , b-20
- if(a -5 < world.FIELD_LEFT +15):
- return world.FIELD_LEFT +20 , b
- else:
- return a,b
- '''
-
def controle(self, world):
- pd = world.get_def_player()
+ pd = self
xfront , yfront = pd.get_front() #unidade das coordenadas eh cm
xback , yback = pd.get_back() #unidade das coordenadas eh cm
pd_x , pd_y = pd.getx() , pd.gety() #unidade das coordenadas eh cm
xb, yb = world.get_ball().getxy() #unidade das coordenadas eh cm // usada para ver se o zagueiro vai direto para a bola
- #xb, yb = self.chuta(world) #Retorna a posicao que o defensor deve ir
-
+
theta_jog = self.get_theta()
theta_ball = math.atan2(yb,xb) # unidade rad
theta_gol = math.atan2(236,515)
- # matriz de rotacao e matriz de translacao que colocar o eixo de coordanadas no robo alinhado com o theta, e calcula o angulo de erro
+ # matriz de rotacao e matriz de translacao que colocar o eixo de coordanadas no robo alinhado com o theta, e calcula o angulo de erro
M_rot = np.array([[math.cos(theta_jog), math.sin(theta_jog)], [-math.sin(theta_jog), math.cos(theta_jog)]])
M_trans = np.array([[pd_x], [pd_y]])
oldcoords_bola = np.array([[xb], [yb]])
@@ -212,27 +137,26 @@ def controle(self, world):
newcoords_gol = M_rot.dot(oldcoords_gol - M_trans)
# erro robo bola baseado
- #theta_erro = math.atan2(newcoords_bola[1][0], newcoords_bola[0][0])
theta_erro_bola = math.atan2(newcoords_bola[1][0], newcoords_bola[0][0])
theta_erro_gol = math.atan2(newcoords_gol[1][0], newcoords_gol[0][0])
theta_erro = theta_erro_bola + (theta_erro_bola - theta_erro_gol)/3
#distancia das rodas em metros
- D = 0.075
+ D = 0.075
#tempo de amostragem
T = 30
#dado o sistema y = pseudoA*Matriz_erro obtem-se y que eh a velocidade da roda direita e velocidade da roda esquerda
A = np.array([[math.cos(theta_jog)/2, math.cos(theta_jog)/2], [math.sin(theta_jog)/2, math.sin(theta_jog)/2],[1/D, -1/D]])
- pseudoA = np.linalg.pinv(A)
+ pseudoA = np.linalg.pinv(A)
Matriz_erro = (T)*np.array([[(xb - pd_x)/100], [(yb - pd_y)/100], [theta_erro]])
- y = pseudoA.dot(Matriz_erro)
+ y = pseudoA.dot(Matriz_erro)
vmax = max(abs(y[0][0]), abs(y[1][0])) # paga a maior velocidade
#como a velocidade foi parametrizada pela maior, K eh a maior velocidade que a roda pode assumir
K = 100
- vr, vl = y[0][0]*K/vmax, y[1][0]*K/vmax #mudei a constante para 255 antes era 100
+ vr, vl = y[0][0]*K/vmax, y[1][0]*K/vmax #mudei a constante para 255 antes era 100
return int(vr), int(vl)
\ No newline at end of file
diff --git a/scripts/PlayerDefesa.pyc b/scripts/PlayerDefesa.pyc
deleted file mode 100644
index 1173571..0000000
Binary files a/scripts/PlayerDefesa.pyc and /dev/null differ
diff --git a/scripts/VideoManager.pyc b/scripts/VideoManager.pyc
deleted file mode 100644
index 4bcc55e..0000000
Binary files a/scripts/VideoManager.pyc and /dev/null differ
diff --git a/scripts/World.py b/scripts/World.py
index 5f215ad..b9f19f0 100644
--- a/scripts/World.py
+++ b/scripts/World.py
@@ -1,10 +1,4 @@
-import PlayerAtaque
-import PlayerDefesa
-import Player
-from Ball import *
-import Goalkeeper
-import cv2
-
+from .Ball import *
class World:
#TODO: update field constants
@@ -39,23 +33,38 @@ def __init__(self):
# Frendly goal: 0 to left and 1 to right
self.goal = 0
- self.team = [PlayerAtaque.PlayerAtaque('3'), PlayerDefesa.PlayerDefesa('2') , Goalkeeper.Goalkeeper('1')]# TODO cuidado! Se mudar em baixo muda aki!!!
- self.enemies = [Player.Player(), Player.Player(), Player.Player()]
+ self.jogadores = {"Team" : {"GK" : list(), "DF" : list(), "FW" : list()}, "Enemies" : list()}
self.ball = Ball()
+
+ def remove_def_player(self, p):
+ self.jogadores["Team"]["DF"].remove(p)
+
+ def remove_atk_player(self, p):
+ self.jogadores["Team"]["FW"].remove(p)
+
+ def remove_gk_player(self, p):
+ self.jogadores["Team"]["GK"].remove(p)
+
+ def add_def_player(self, p):
+ self.jogadores["Team"]["DF"].append(p)
+
+ def add_atk_player(self, p):
+ self.jogadores["Team"]["FW"].append(p)
+
+ def add_gk_player(self, p):
+ self.jogadores["Team"]["GK"].append(p)
- # TODO: find information about game states
- self.game_state = None
def get_def_player(self):
- return self.team[1] # TODO cuidado! Se mudar acima muda aki!!!
+ return self.jogadores["Team"]["DF"]
def get_atk_player(self):
- return self.team[0] # TODO cuidado! Se mudar acima muda aki!!!
+ return self.jogadores["Team"]["FW"]
def get_goalkeeper(self):
- return self.team[2] # TODO cuidado! Se mudar acima muda aki!!!
+ return self.jogadores["Team"]["GK"]
def get_teammate(self, n):
- return self.team[n]
+ return self.jogadores["Team"][n]
def get_team_goal(self):
if self.goal == 0:
@@ -74,59 +83,6 @@ def get_ball(self):
def get_right_goal(self):
return self.right_goal
-
-
- def campo_potencial(self, player):
- #return (math.tanh((xr - right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_upper[1])**2/medo_de_bater_na_parede**2))/4.0
- xr, yr = player.getxy()
- dx = xr - self.left_goal[0]
- dy = yr - self.left_goal[1]
-
- ro = math.sqrt(dx**2+dy**2)
- ret = (math.tanh((xr - self.right_upper[0])**2/player.medo_de_bater_na_parede**2)* math.tanh((xr - self.left_upper[0])**2/player.medo_de_bater_na_parede**2) * math.tanh((yr - self.right_lower[1])**2/player.medo_de_bater_na_parede**2) * math.tanh((yr - self.right_upper[1])**2/player.medo_de_bater_na_parede**2))/(1-math.exp(-(ro**2)/8000.0))/4.0
- if ro < 100:
- ret = 0
- # print ret
- return ret
-
- def campo_potencial_g(self, xr, yr, medo_de_bater_na_parede):
- #return (math.tanh((xr - right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_upper[1])**2/medo_de_bater_na_parede**2))/4.0
- dx = xr - self.right_goal[0]
- dy = yr - self.right_goal[1]
- ro = math.sqrt(dx**2+dy**2)
- if ro < 100:
- return 0
- return (math.tanh((xr - self.right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - self.left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - self.right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - self.right_upper[1])**2/medo_de_bater_na_parede**2))/(1-math.exp(-(ro**2)/8000.0))/4.0
-
- @staticmethod
- def is_contour_outside_field(cnt):
- c = 35
- x,y,w,h = cv2.boundingRect(cnt)
- if x < World.FIELD_LEFT-c or y < World.FIELD_TOP-c or x+w > World.FIELD_RIGHT+c or y+h > World.FIELD_BOTTOM+c:
- return True
- else:
- return False
-
- """
- #Guilherme: Funcao criada para atualizar o world. substitui a funcao vm.process_frame(world)
- def update(self, p0_front, p0_back, p1_front, p1_back, p2_front, p2_back, pos_ball):
-
- #Goalkeeper
- p0 = self.get_teammate(0)
- p0.set_position(p0_front, p0_back)
-
- #Player 1
- p0 = self.get_teammate(1)
- p0.set_position(p1_front, p1_back)
-
- #Player 2
- p0 = self.get_teammate(2)
- p0.set_position(p2_front, p2_back)
-
- # Update Ball
- ball = self.get_ball()
- ball.set_position(pos_ball)
- """
#Guilherme: Versao para atualizacao de jogador usando, x,y,angle
def update(self, p0_x, p0_y, p0_theta, p1_x, p1_y, p1_theta, p2_x, p2_y, p2_theta, pos_ball):
@@ -169,3 +125,11 @@ def updateField(self, fieldRight, fieldLeft, fieldTop, fieldBottom):
print (self.FIELD_BOTTOM)
print ("ola1")
+ def campo_potencial_g(self, xr, yr, medo_de_bater_na_parede):
+ #return (math.tanh((xr - right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - right_upper[1])**2/medo_de_bater_na_parede**2))/4.0
+ dx = xr - self.right_goal[0]
+ dy = yr - self.right_goal[1]
+ ro = math.sqrt(dx**2+dy**2)
+ if ro < 100:
+ return 0
+ return (math.tanh((xr - self.right_upper[0])**2/medo_de_bater_na_parede**2)* math.tanh((xr - self.left_upper[0])**2/medo_de_bater_na_parede**2) * math.tanh((yr - self.right_lower[1])**2/medo_de_bater_na_parede**2) * math.tanh((yr - self.right_upper[1])**2/medo_de_bater_na_parede**2))/(1-math.exp(-(ro**2)/8000.0))/4.0
diff --git a/scripts/World.pyc b/scripts/World.pyc
deleted file mode 100644
index 88163fa..0000000
Binary files a/scripts/World.pyc and /dev/null differ
diff --git a/scripts/__init__.py b/scripts/__init__.py
index 501a6bb..e69de29 100644
--- a/scripts/__init__.py
+++ b/scripts/__init__.py
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/scripts/__pycache__/Communication.cpython-36.pyc b/scripts/__pycache__/Communication.cpython-36.pyc
deleted file mode 100644
index 4db2171..0000000
Binary files a/scripts/__pycache__/Communication.cpython-36.pyc and /dev/null differ
diff --git a/scripts/lista_marcacoes.py b/scripts/lista_marcacoes.py
index 9a3e2bb..09dedba 100644
--- a/scripts/lista_marcacoes.py
+++ b/scripts/lista_marcacoes.py
@@ -3,14 +3,14 @@
lista = []
def adiciona_ponto(x, y, r, g, b, nome = '',x0 = 0,y0=0):
- global lista
- lista = lista + [(x, y, r, g, b, nome,x0,y0)]
+ global lista
+ lista = lista + [(x, y, r, g, b, nome,x0,y0)]
def limpa_lista():
- global lista
- lista = []
+ global lista
+ lista = []
def pega_lista():
- global lista
- return copy.deepcopy(lista)
+ global lista
+ return copy.deepcopy(lista)
diff --git a/scripts/lista_marcacoes.pyc b/scripts/lista_marcacoes.pyc
deleted file mode 100644
index 0d229fb..0000000
Binary files a/scripts/lista_marcacoes.pyc and /dev/null differ
diff --git a/scripts/main.pyc b/scripts/main.pyc
deleted file mode 100644
index 24e5785..0000000
Binary files a/scripts/main.pyc and /dev/null differ
diff --git a/simulador.py b/simulador.py
new file mode 100644
index 0000000..f69ad9c
--- /dev/null
+++ b/simulador.py
@@ -0,0 +1,72 @@
+""" VSSS-o-Primeiro
+ Nome do módulo : simulador
+ Ano de criação : 2019/10
+ Descrição do módulo: Modulo para rodar o simulador no código do VSSS (segunda versão)
+ Versão: 2.0
+ Pré-requisitos : vsscorepy
+ Membros: Lorena Bassani
+
+"""
+from vsscorepy.communications.command_sender import CommandSender
+from vsscorepy.communications.debug_sender import DebugSender
+from vsscorepy.communications.state_receiver import StateReceiver
+from vsscorepy.domain.command import Command
+from vsscorepy.domain.wheels_command import WheelsCommand
+from vsscorepy.domain.point import Point
+from vsscorepy.domain.pose import Pose
+from vsscorepy.domain.debug import Debug
+
+from new_scripts.Mundo import Mundo
+from new_scripts.Inimigo import Inimigo
+from new_scripts.Aliado import Aliado
+from new_scripts.ComportamentosJogadores.Factory import COMPORTAMENTOS
+
+from enum import Enum
+import math as m
+
+class Team(Enum):
+ BLUE = 1
+ YELLOW = 1
+
+class kernel():
+
+ def __init__(self, team = Team.YELLOW):
+ self.state_receiver = StateReceiver()
+ self.state_receiver.create_socket()
+ self.command_sender = CommandSender()
+ self.command_sender.create_socket()
+ """ self.debug_sender = DebugSender()
+ self.debug_sender.create_socket() """
+
+ def envia_comando(self, comando_Player1, comando_Player2, comando_Player3):
+ command = Command()
+ command.wheels_commands.append(comando_Player1)
+ command.wheels_commands.append(comando_Player2)
+ command.wheels_commands.append(comando_Player3)
+ self.command_sender.send_command(command)
+
+ def recebe_estado(self):
+ state = self.state_receiver.receive_state()
+ return state
+
+
+k = kernel()
+mundo = Mundo()
+time = [Aliado(0, comportamento = COMPORTAMENTOS.GOLEIRO), Aliado(1, comportamento = COMPORTAMENTOS.ATACANTE), Aliado(2)]
+inimigo = [Inimigo(3), Inimigo(4), Inimigo(5)]
+mundo.inimigos = inimigo
+mundo.time = time
+while True:
+ state = k.recebe_estado()
+ mundo.ball.posicao = (state.ball.x, state.ball.y)
+ mundo.ball.theta = m.atan2(state.ball.speed_y, state.ball.speed_x)
+ for i in range(0, len(time)):
+ r = state.team_yellow[i]
+ e = state.team_blue[i]
+ time[i].posicao = (r.x, r.y)
+ time[i].theta = r.angle
+ inimigo[i].posicao = (e.x, e.y)
+ inimigo[i].theta = (e.angle)
+ listaComando = mundo.control()
+ listaComando = list(map(lambda vel: WheelsCommand(vel[0], vel[1]), listaComando))
+ k.envia_comando(listaComando[0], listaComando[1], listaComando[2])
diff --git a/Ball.cpp b/ui/Ball.cpp
similarity index 100%
rename from Ball.cpp
rename to ui/Ball.cpp
diff --git a/Ball.h b/ui/Ball.h
similarity index 100%
rename from Ball.h
rename to ui/Ball.h
diff --git a/BlobProcessor.cpp b/ui/BlobProcessor.cpp
similarity index 100%
rename from BlobProcessor.cpp
rename to ui/BlobProcessor.cpp
diff --git a/BlobProcessor.h b/ui/BlobProcessor.h
similarity index 100%
rename from BlobProcessor.h
rename to ui/BlobProcessor.h
diff --git a/Buffer.h b/ui/Buffer.h
similarity index 100%
rename from Buffer.h
rename to ui/Buffer.h
diff --git a/ui/Calibracao.cpp b/ui/Calibracao.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/CalibracaoArena.cpp b/ui/CalibracaoArena.cpp
similarity index 100%
rename from CalibracaoArena.cpp
rename to ui/CalibracaoArena.cpp
diff --git a/CalibracaoArena.h b/ui/CalibracaoArena.h
similarity index 100%
rename from CalibracaoArena.h
rename to ui/CalibracaoArena.h
diff --git a/CalibracaoArena.ui b/ui/CalibracaoArena.ui
similarity index 100%
rename from CalibracaoArena.ui
rename to ui/CalibracaoArena.ui
diff --git a/CalibracaoArenaThread.cpp b/ui/CalibracaoArenaThread.cpp
similarity index 100%
rename from CalibracaoArenaThread.cpp
rename to ui/CalibracaoArenaThread.cpp
diff --git a/CalibracaoArenaThread.h b/ui/CalibracaoArenaThread.h
similarity index 100%
rename from CalibracaoArenaThread.h
rename to ui/CalibracaoArenaThread.h
diff --git a/CaptureThread.cpp b/ui/CaptureThread.cpp
similarity index 100%
rename from CaptureThread.cpp
rename to ui/CaptureThread.cpp
diff --git a/CaptureThread.h b/ui/CaptureThread.h
similarity index 100%
rename from CaptureThread.h
rename to ui/CaptureThread.h
diff --git a/Color.cpp b/ui/Color.cpp
similarity index 100%
rename from Color.cpp
rename to ui/Color.cpp
diff --git a/Color.h b/ui/Color.h
similarity index 100%
rename from Color.h
rename to ui/Color.h
diff --git a/ColorManagement.cpp b/ui/ColorManagement.cpp
similarity index 100%
rename from ColorManagement.cpp
rename to ui/ColorManagement.cpp
diff --git a/ColorManagement.h b/ui/ColorManagement.h
similarity index 100%
rename from ColorManagement.h
rename to ui/ColorManagement.h
diff --git a/ColorManagement.ui b/ui/ColorManagement.ui
similarity index 100%
rename from ColorManagement.ui
rename to ui/ColorManagement.ui
diff --git a/ColorManagementThread.cpp b/ui/ColorManagementThread.cpp
similarity index 100%
rename from ColorManagementThread.cpp
rename to ui/ColorManagementThread.cpp
diff --git a/ColorManagementThread.h b/ui/ColorManagementThread.h
similarity index 100%
rename from ColorManagementThread.h
rename to ui/ColorManagementThread.h
diff --git a/Configuracao.cpp b/ui/Configuracao.cpp
similarity index 100%
rename from Configuracao.cpp
rename to ui/Configuracao.cpp
diff --git a/Configuracao.h b/ui/Configuracao.h
similarity index 100%
rename from Configuracao.h
rename to ui/Configuracao.h
diff --git a/MainWindow.cpp b/ui/MainWindow.cpp
similarity index 100%
rename from MainWindow.cpp
rename to ui/MainWindow.cpp
diff --git a/MainWindow.h b/ui/MainWindow.h
similarity index 100%
rename from MainWindow.h
rename to ui/MainWindow.h
diff --git a/MainWindow.ui b/ui/MainWindow.ui
similarity index 100%
rename from MainWindow.ui
rename to ui/MainWindow.ui
diff --git a/MeanShiftProcessor.cpp b/ui/MeanShiftProcessor.cpp
similarity index 100%
rename from MeanShiftProcessor.cpp
rename to ui/MeanShiftProcessor.cpp
diff --git a/MeanShiftProcessor.h b/ui/MeanShiftProcessor.h
similarity index 100%
rename from MeanShiftProcessor.h
rename to ui/MeanShiftProcessor.h
diff --git a/Player.cpp b/ui/Player.cpp
similarity index 100%
rename from Player.cpp
rename to ui/Player.cpp
diff --git a/Player.h b/ui/Player.h
similarity index 100%
rename from Player.h
rename to ui/Player.h
diff --git a/ProcessingThread.cpp b/ui/ProcessingThread.cpp
similarity index 100%
rename from ProcessingThread.cpp
rename to ui/ProcessingThread.cpp
diff --git a/ProcessingThread.h b/ui/ProcessingThread.h
similarity index 100%
rename from ProcessingThread.h
rename to ui/ProcessingThread.h
diff --git a/PythonAPI.cpp b/ui/PythonAPI.cpp
similarity index 100%
rename from PythonAPI.cpp
rename to ui/PythonAPI.cpp
diff --git a/PythonAPI.h b/ui/PythonAPI.h
similarity index 100%
rename from PythonAPI.h
rename to ui/PythonAPI.h
diff --git a/PythonThread.cpp b/ui/PythonThread.cpp
similarity index 100%
rename from PythonThread.cpp
rename to ui/PythonThread.cpp
diff --git a/PythonThread.h b/ui/PythonThread.h
similarity index 100%
rename from PythonThread.h
rename to ui/PythonThread.h
diff --git a/Settings.cpp b/ui/Settings.cpp
similarity index 100%
rename from Settings.cpp
rename to ui/Settings.cpp
diff --git a/Settings.h b/ui/Settings.h
similarity index 100%
rename from Settings.h
rename to ui/Settings.h
diff --git a/SoccerField.cpp b/ui/SoccerField.cpp
similarity index 100%
rename from SoccerField.cpp
rename to ui/SoccerField.cpp
diff --git a/SoccerField.h b/ui/SoccerField.h
similarity index 100%
rename from SoccerField.h
rename to ui/SoccerField.h
diff --git a/Utils.cpp b/ui/Utils.cpp
similarity index 100%
rename from Utils.cpp
rename to ui/Utils.cpp
diff --git a/Utils.h b/ui/Utils.h
similarity index 100%
rename from Utils.h
rename to ui/Utils.h
diff --git a/VideoProcessor.cpp b/ui/VideoProcessor.cpp
similarity index 100%
rename from VideoProcessor.cpp
rename to ui/VideoProcessor.cpp
diff --git a/VideoProcessor.h b/ui/VideoProcessor.h
similarity index 100%
rename from VideoProcessor.h
rename to ui/VideoProcessor.h
diff --git a/World.cpp b/ui/World.cpp
similarity index 100%
rename from World.cpp
rename to ui/World.cpp
diff --git a/World.h b/ui/World.h
similarity index 100%
rename from World.h
rename to ui/World.h
diff --git a/XMLSettingsEditor.cpp b/ui/XMLSettingsEditor.cpp
similarity index 100%
rename from XMLSettingsEditor.cpp
rename to ui/XMLSettingsEditor.cpp
diff --git a/XMLSettingsEditor.h b/ui/XMLSettingsEditor.h
similarity index 100%
rename from XMLSettingsEditor.h
rename to ui/XMLSettingsEditor.h
diff --git a/asd.cpp b/ui/asd.cpp
similarity index 100%
rename from asd.cpp
rename to ui/asd.cpp
diff --git a/asd.h b/ui/asd.h
similarity index 100%
rename from asd.h
rename to ui/asd.h
diff --git a/calibracao.h b/ui/calibracao.h
similarity index 100%
rename from calibracao.h
rename to ui/calibracao.h
diff --git a/certo.xml b/ui/certo.xml
similarity index 100%
rename from certo.xml
rename to ui/certo.xml
diff --git a/config.xml b/ui/config.xml
similarity index 100%
rename from config.xml
rename to ui/config.xml
diff --git a/configu.xml b/ui/configu.xml
similarity index 100%
rename from configu.xml
rename to ui/configu.xml
diff --git a/constants.h b/ui/constants.h
similarity index 100%
rename from constants.h
rename to ui/constants.h
diff --git a/deployment.pri b/ui/deployment.pri
similarity index 100%
rename from deployment.pri
rename to ui/deployment.pri
diff --git a/main.cpp b/ui/main.cpp
similarity index 100%
rename from main.cpp
rename to ui/main.cpp
diff --git a/ui/meanshift.cpp b/ui/meanshift.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/patch.diff b/ui/patch.diff
similarity index 100%
rename from patch.diff
rename to ui/patch.diff
diff --git a/tinyxml2.cpp b/ui/tinyxml2.cpp
similarity index 100%
rename from tinyxml2.cpp
rename to ui/tinyxml2.cpp
diff --git a/tinyxml2.h b/ui/tinyxml2.h
similarity index 100%
rename from tinyxml2.h
rename to ui/tinyxml2.h
diff --git a/vsss.pro b/ui/vsss.pro
similarity index 100%
rename from vsss.pro
rename to ui/vsss.pro
diff --git a/vsss.pro.user.LR5908 b/ui/vsss.pro.user.LR5908
similarity index 100%
rename from vsss.pro.user.LR5908
rename to ui/vsss.pro.user.LR5908
diff --git a/vss-simulator/.gitignore b/vss-simulator/.gitignore
new file mode 100644
index 0000000..496ee2c
--- /dev/null
+++ b/vss-simulator/.gitignore
@@ -0,0 +1 @@
+.DS_Store
\ No newline at end of file
diff --git a/vss-simulator/ListaComandos/ListaComandos.c b/vss-simulator/ListaComandos/ListaComandos.c
new file mode 100644
index 0000000..edd4f1c
--- /dev/null
+++ b/vss-simulator/ListaComandos/ListaComandos.c
@@ -0,0 +1,153 @@
+#include "ListaComandos.h"
+#include
+#include
+#include
+#include
+#include
+
+typedef struct cel Cel;
+
+struct cel{
+ char* comando;
+ char** argumentos;
+ int numArgs;
+ Cel* prox;
+ Cel* ant;
+};
+
+struct lComands{
+ Cel* prim;
+ Cel* ult;
+ int tam;
+};
+
+
+int separaComandos(ListaComandos* lista, char* linha ){
+ int i = 0, j = 0, pos =0, tam;
+ for(tam = 0; tam < strlen(linha); tam++){
+ if(linha[tam] == ' ' && linha[tam+1] == '@' && linha[tam+2] == ' ') {
+ linha[tam] = 0;
+ insereComandos(lista, &linha[pos]);
+ linha[tam] = ' ';
+ pos = tam+3;
+ i++; j = 0; tam=tam+3;
+ linha[tam];
+ }
+ j++;
+ }
+ insereComandos(lista, &linha[pos]);
+ return (i+1);
+}
+
+ListaComandos* newListaComandos(char* linha){
+ ListaComandos* nova = (ListaComandos*)malloc(sizeof(ListaComandos));
+ nova->prim = NULL;
+ nova->ult = NULL;
+ nova->tam = 0;
+ separaComandos(nova, linha);
+ return nova;
+}
+
+
+ListaComandos* deleteListaComandos(ListaComandos* comandos){
+ if(comandos != NULL){
+ Cel* aux1 = comandos->prim;
+ Cel* aux2;
+ while(aux1!=NULL){
+ aux2 = aux1->prox;
+ int i = 0;
+ while(aux1->argumentos[i] != NULL)
+ free(aux1->argumentos[i++]);
+ free(aux1->argumentos);
+ free(aux1);
+ aux1 = aux2;
+ }
+ free(comandos);
+ }
+ return NULL;
+}
+
+Cel* newCel(char* cmd){
+ Cel* newL = (Cel*)malloc(sizeof(Cel));
+ newL->comando = cmd;
+ newL->ant = NULL;
+ newL->prox = NULL;
+ return newL;
+}
+
+
+
+void insereComandos(ListaComandos* comandos, char* cmd){
+
+ Cel* m = newCel(cmd);
+ char auxiliarEstatico[500];
+ sscanf(cmd, "%s", auxiliarEstatico);
+ m->comando = (char*) malloc((strlen(auxiliarEstatico)+1)*sizeof(char));
+ strcpy(m->comando, auxiliarEstatico);
+ char** argumentos = (char**)malloc( 6 * sizeof(char*));
+ int i = 1, j = strlen(cmd), k = strlen(auxiliarEstatico)+1;
+ cmd = cmd+k;
+ while(k < j && i < 6){
+ sscanf(cmd, "%s", auxiliarEstatico);
+ argumentos[i] = (char*) malloc((strlen(auxiliarEstatico)+1)*sizeof(char));
+ strcpy(argumentos[i++], auxiliarEstatico);
+
+ cmd = cmd+strlen(auxiliarEstatico)+1;
+ k += strlen(auxiliarEstatico)+1;
+ }
+ argumentos[0] = m->comando;
+
+ argumentos[i] = NULL;
+ m->argumentos = argumentos;
+ m->numArgs = i;
+ if (comandos->ult == NULL){
+ comandos->prim = comandos->ult = m;
+ }else{
+ comandos->ult->prox= m;
+ m->ant = comandos->ult;
+ comandos->ult = m;
+ }
+ comandos->tam++;
+}
+
+int getNComandos(ListaComandos* comandos){
+ return comandos->tam;
+}
+
+char* getComando(ListaComandos* comandos, int Index){
+ if (comandos != NULL && Index < comandos->tam){
+ Cel* aux1 = comandos->prim;
+ int i;
+ for(i = 0;i < Index; i++){
+ aux1 = aux1->prox;
+ }
+ return aux1->comando;
+ }
+ return NULL;
+}
+
+char** getArgs(ListaComandos* comandos, int Index){
+ if (comandos != NULL && Index < comandos->tam){
+ Cel* aux1 = comandos->prim;
+ int i;
+ for(i = 0;i < Index; i++){
+ aux1 = aux1->prox;
+ }
+ return aux1->argumentos;
+ }
+ return NULL;
+}
+
+
+void imprime(char *ar[], int n){
+ int i;
+ for(i = 0; i%s\n", ar[i]);
+}
+
+int verificarComando(ListaComandos* lista){
+ if(lista->tam == 1){
+ if (strcmp(lista->prim->comando, "exit") == 0) return 1;
+ else if (strcmp(lista->prim->comando, "waitz") ==0 ) return -1;
+ else if (strcmp(lista->prim->comando, "cd") == 0) return 2;
+ }return 0;
+}
diff --git a/vss-simulator/ListaComandos/ListaComandos.h b/vss-simulator/ListaComandos/ListaComandos.h
new file mode 100644
index 0000000..a2ae903
--- /dev/null
+++ b/vss-simulator/ListaComandos/ListaComandos.h
@@ -0,0 +1,28 @@
+/*
+ * ListaComandos.c
+ *
+ * Created on: 27 de set de 2018
+ * Author: Lorena
+ */
+
+#ifndef LISTACOMANDOS_C_
+#define LISTACOMANDOS_C_
+
+
+typedef struct lComands ListaComandos;
+
+ListaComandos* newListaComandos(char* linha);
+
+ListaComandos* deleteListaComandos(ListaComandos* comandos);
+
+void insereComandos(ListaComandos* comandos, char* cmd);
+
+int getNComandos(ListaComandos* comandos);
+
+char* getComando(ListaComandos* comandos, int Index);
+
+char** getArgs(ListaComandos* comandos, int Index);
+
+int verificarComando(ListaComandos* lista);//1 para exit, -1 para waitz e 0 para comando normal
+
+#endif /* LISTACOMANDOS_C_ */
diff --git a/vss-simulator/Makefile b/vss-simulator/Makefile
new file mode 100644
index 0000000..3316122
--- /dev/null
+++ b/vss-simulator/Makefile
@@ -0,0 +1,8 @@
+### Makefile ###
+
+all:
+ g++ -o Simulador Simulador.cpp ListaComandos/ListaComandos.c
+
+run:
+ ./Simulador
+
diff --git a/vss-simulator/Simulador.cpp b/vss-simulator/Simulador.cpp
new file mode 100644
index 0000000..45d53b6
--- /dev/null
+++ b/vss-simulator/Simulador.cpp
@@ -0,0 +1,93 @@
+/*
+ ============================================================================
+ Name : Simulador.cpp
+ Author : Lorena
+ Version : V 1.0
+ Description : Programa que roda simulação do vsss
+ IMPORTANTE :
+ ============================================================================
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ListaComandos/ListaComandos.h"
+
+using namespace std;
+
+#define rodavelList {{"VSS-Simulator","./vss-simulator/VSS-Simulator/build/vss-simulator"}, /* {"VSS-Sample","./vss-simulator/VSS-SampleCpp/build/vss-sample"}, */ {"VSS-Sample","./vss-simulator/VSS-SampleCpp/build/vss-sample -t blue"}, {"VSSS-ERUS", "python3 simulador.py"}, /* {"VSSS-ERUS", "./build/vsss-erus"}, */ {"VSS-Viewer","./vss-simulator/VSS-Viewer/build/vss-viewer"}}
+#define tam 4
+
+bool desejaRodar();
+void roda(char*);
+
+int main(int argc, char const *argv[])
+{
+ chdir("..");
+ char* Rodavel[][2] = rodavelList;
+ pid_t filhos[tam];
+
+ cout << "VSS-Simulator by Rodetas e RobôCIn\n" << endl;
+ cout << "Verifique se todos os programas do simulador estão devidamente instalados" << endl;
+ cout << "Deseja rodar o Simulador?" << endl;
+
+ if(!desejaRodar()){
+ cout << "Finalizando.." << endl;
+ return 0;
+ }
+ FILE* log = fopen("log.txt", "w");
+ fprintf(log, "Simulação VSSS");
+ fclose(log);
+
+ for(int i = 0; i < tam; i++){
+ cout << "Deseja rodar "<< Rodavel[i][0] << "?" << endl;
+ if(desejaRodar()){
+ pid_t filho = filhos[i] = fork();
+ //O pai entra nesse bloco
+ if(filho > 0){
+ continue;
+ }
+ //O filho entra nesse bloco
+ else if(filho == 0){
+ freopen("log.txt", "a", stdout);
+ freopen("log.txt", "a", stderr);
+ roda((char *)Rodavel[i][1]);
+ }
+ //Erro de fork
+ else{
+ printf("Erro ao criar novo processo\n");
+ printf("Erro %d - %s\n", errno, strerror(errno));
+ }
+ }
+ }
+
+ while(wait(NULL) > 0);
+
+ return 0;
+}
+
+bool desejaRodar(){
+ char deseja;
+ do{
+ cout << "[s]/[n]: ";
+ cin >> deseja;
+ if(deseja == 's' || deseja == 'S') {return true;}
+ else if (deseja == 'n' || deseja == 'N'){return false;}
+ }while(true);
+}
+
+void roda(char* rodavel){
+ ListaComandos* lista = newListaComandos(rodavel);
+ execvp(getComando(lista, 0),getArgs(lista, 0));
+ printf("Erro de exec:\n");
+ printf("Erro %d - %s\n", ENOENT, strerror(ENOENT));
+ exit(-1);
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/.gitignore b/vss-simulator/VSS-Core/.gitignore
new file mode 100644
index 0000000..a2fb456
--- /dev/null
+++ b/vss-simulator/VSS-Core/.gitignore
@@ -0,0 +1,49 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Fortran module files
+*.mod
+*.smod
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# VSCode files
+*.vscode/.browse.VC.*
+
+# Protobuf files
+*.pb.cc
+*.pb.h
+*state.rs
+*command.rs
+*debug.rs
+
+# Rust files
+*target
+*.cargo
+*.lock
+
+# Executables
+*.exe
+*.out
+*.app
+
+.vscode/*
+.idea/*
+build/*
+cmake-build-debug/*
diff --git a/vss-simulator/VSS-Core/.gitmodules b/vss-simulator/VSS-Core/.gitmodules
new file mode 100644
index 0000000..3f127b8
--- /dev/null
+++ b/vss-simulator/VSS-Core/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "third-party/googletest"]
+ path = third-party/googletest
+ url = https://github.com/google/googletest.git
diff --git a/vss-simulator/VSS-Core/.travis.yml b/vss-simulator/VSS-Core/.travis.yml
new file mode 100644
index 0000000..7ccb8f1
--- /dev/null
+++ b/vss-simulator/VSS-Core/.travis.yml
@@ -0,0 +1,17 @@
+sudo: required
+
+language: cpp
+
+services:
+ - docker
+
+script:
+ - sudo docker build -f Dockerfile.ubuntu16 -t vss-core-ubuntu16 .
+ - sudo docker run vss-core-ubuntu16 test
+ - sudo docker build -f Dockerfile.debian9 -t vss-core-debian9 .
+ - sudo docker run vss-core-debian9 test
+ - sudo docker build -f Dockerfile.ubuntu18 -t vss-core-ubuntu18 .
+ - sudo docker run vss-core-ubuntu18 test
+
+notifications:
+ slack: vss-sdk:1bwlO40eKoIRA7l5yjLNqmjD
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/CMakeLists.txt b/vss-simulator/VSS-Core/CMakeLists.txt
new file mode 100644
index 0000000..e1f5f54
--- /dev/null
+++ b/vss-simulator/VSS-Core/CMakeLists.txt
@@ -0,0 +1,73 @@
+cmake_minimum_required(VERSION 2.8.9)
+set(Boost_USE_STATIC_LIBS OFF)
+set(Boost_USE_MULTITHREADED ON)
+set(Boost_USE_STATIC_RUNTIME OFF)
+
+project(vss-core)
+
+include_directories(src)
+include_directories(include)
+
+INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR})
+
+find_package(PkgConfig)
+FIND_PACKAGE(Boost 1.40 COMPONENTS program_options REQUIRED)
+INCLUDE(FindProtobuf)
+FIND_PACKAGE(Protobuf REQUIRED)
+
+find_path(ZeroMQ_INCLUDE_DIR
+ NAMES zmq.hpp
+ PATHS ${PC_ZeroMQ_INCLUDE_DIRS}
+ )
+
+find_library(ZeroMQ_LIBRARY
+ NAMES zmq
+ PATHS ${PC_ZeroMQ_LIBRARY_DIRS}
+ )
+
+include_directories(${Boost_INCLUDE_DIRS})
+
+file(GLOB_RECURSE CPP "src/*.cpp")
+file(GLOB_RECURSE CC "src/*.cc")
+file(GLOB_RECURSE H "include/*.h")
+
+set(CLION SOURCE ${CC} ${CPP} ${H})
+
+add_library(vss-core SHARED ${CPP} ${CC} ${H})
+
+target_link_libraries(vss-core ${Boost_PROGRAM_OPTIONS_LIBRARY})
+target_include_directories(vss-core PUBLIC ${ZeroMQ_INCLUDE_DIR})
+target_link_libraries(vss-core PUBLIC ${ZeroMQ_LIBRARY})
+target_link_libraries(vss-core ${PROTOBUF_LIBRARIES})
+
+IF(RELEASE)
+ set(CMAKE_BUILD_TYPE Release)
+ SET(CMAKE_CXX_FLAGS "-Wall -Werror -o2 -std=c++11")
+
+ install(TARGETS vss-core DESTINATION /usr/lib)
+ install(DIRECTORY include/ DESTINATION include/ FILES_MATCHING PATTERN "*.h")
+ELSE()
+ INCLUDE_DIRECTORIES(third-party)
+
+ enable_testing()
+
+ add_subdirectory(third-party/googletest)
+
+ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
+ include_directories(${gmock_SOURCE_DIR}/include ${gmock_SOURCE_DIR})
+
+ file(GLOB_RECURSE TEST test/*.cpp)
+
+ ADD_EXECUTABLE(tests ${TEST})
+
+ target_link_libraries(tests
+ pthread
+ gtest
+ gtest_main
+ vss-core
+ ${PROTOBUF_LIBRARIES})
+
+ SET(CMAKE_CXX_FLAGS "-g -Wall -Werror -std=c++11")
+ENDIF()
+
+
diff --git a/vss-simulator/VSS-Core/Dockerfile.debian9 b/vss-simulator/VSS-Core/Dockerfile.debian9
new file mode 100644
index 0000000..5a0ce07
--- /dev/null
+++ b/vss-simulator/VSS-Core/Dockerfile.debian9
@@ -0,0 +1,19 @@
+FROM debian:9
+
+# Instala o CMAKE
+RUN apt-get update
+
+# Copia tudo para o container
+COPY . /vss-core-debian9
+WORKDIR /vss-core-debian9
+
+# Adiciona permissão de execução dos shellscripts
+RUN chmod +x /vss-core-debian9/configure.sh
+RUN chmod +x /vss-core-debian9/entrypoint.sh
+RUN chmod +x /vss-core-debian9/scripts/protos.sh
+
+# Executa a instalação na criação dos containers
+RUN /vss-core-debian9/configure.sh development
+
+# Script executado no docker run
+ENTRYPOINT ["/vss-core-debian9/entrypoint.sh"]
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/Dockerfile.ubuntu16 b/vss-simulator/VSS-Core/Dockerfile.ubuntu16
new file mode 100644
index 0000000..e0ad260
--- /dev/null
+++ b/vss-simulator/VSS-Core/Dockerfile.ubuntu16
@@ -0,0 +1,19 @@
+FROM ubuntu:16.04
+
+# Instala o CMAKE
+RUN apt-get update
+
+# Copia tudo para o container
+COPY . /vss-core-ubuntu16
+WORKDIR /vss-core-ubuntu16
+
+# Adiciona permissão de execução dos shellscripts
+RUN chmod +x /vss-core-ubuntu16/configure.sh
+RUN chmod +x /vss-core-ubuntu16/entrypoint.sh
+RUN chmod +x /vss-core-ubuntu16/scripts/protos.sh
+
+# Executa a instalação na criação dos containers
+RUN /vss-core-ubuntu16/configure.sh development
+
+# Script executado no docker run
+ENTRYPOINT ["/vss-core-ubuntu16/entrypoint.sh"]
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/Dockerfile.ubuntu18 b/vss-simulator/VSS-Core/Dockerfile.ubuntu18
new file mode 100644
index 0000000..7800e70
--- /dev/null
+++ b/vss-simulator/VSS-Core/Dockerfile.ubuntu18
@@ -0,0 +1,19 @@
+FROM ubuntu:18.04
+
+# Instala o CMAKE
+RUN apt-get update
+
+# Copia tudo para o container
+COPY . /vss-core-ubuntu18
+WORKDIR /vss-core-ubuntu18
+
+# Adiciona permissão de execução dos shellscripts
+RUN chmod +x /vss-core-ubuntu18/configure.sh
+RUN chmod +x /vss-core-ubuntu18/entrypoint.sh
+RUN chmod +x /vss-core-ubuntu18/scripts/protos.sh
+
+# Executa a instalação na criação dos containers
+RUN /vss-core-ubuntu18/configure.sh development
+
+# Script executado no docker run
+ENTRYPOINT ["/vss-core-ubuntu18/entrypoint.sh"]
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/LICENSE.txt b/vss-simulator/VSS-Core/LICENSE.txt
new file mode 100644
index 0000000..9cecc1d
--- /dev/null
+++ b/vss-simulator/VSS-Core/LICENSE.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ {one line to give the program's name and a brief idea of what it does.}
+ Copyright (C) {year} {name of author}
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ {project} Copyright (C) {year} {fullname}
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+ .
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/vss-simulator/VSS-Core/README.md b/vss-simulator/VSS-Core/README.md
new file mode 100644
index 0000000..9487113
--- /dev/null
+++ b/vss-simulator/VSS-Core/README.md
@@ -0,0 +1,55 @@
+# VSS-Core [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)][gpl3] [![Build Status](https://api.travis-ci.com/VSS-SDK/VSS-Core.svg?branch=master)][travis]
+
+[![Trello](https://img.shields.io/badge/Trello-SDK-blue.svg)][vss-sdk-trello]
+[![Slack](https://img.shields.io/badge/Slack-Channel-551a8b.svg)][slack]
+
+O VSS-Core (C++) é uma biblioteca open-source que faz parte do VSS-SDK.
+Contém interfaces de comunicação entre os projetos do SDK, modelos que representam o domínio do problema de futebol de robôs e métodos uteis. Os pacotes trafegam utilizando ZeroMQ e são serializados utilizando Protobuf.
+
+Mais informações podem ser encontradas em [VSS-SDK][vss-sdk].
+
+## Instalação
+```
+$ sudo ./configure.sh
+```
+
+## Desenvolvimento
+Compilando
+```
+$ sudo ./configure.sh development
+$ cd build
+$ ./tests
+```
+
+## VSS-Samples
+> Versão em C++: [VSS-SampleCpp][samplecpp]
+
+> Versão em Python: [VSS-SamplePy][samplepy]
+
+> Versão em Rust: [VSS-SampleRust][samplerust]
+
+## VSS-Cores
+> Versão em C++: [VSS-CoreCpp][corecpp]
+
+>Versão em Python: [VSS-CorePy][corepy]
+
+> Versão em Rust: [VSS-CoreRust][corerust]
+
+# Licença
+
+Esse código está sob licença [GNU GENERAL PUBLIC LICENSE Version 3][gpl3], cujo uma cópia em texto pode ser encontrada em [LICENSE.txt](LICENSE.txt).
+
+Você pode utilizar esse código. Caso o faça, nos informe.
+
+[gpl3]: http://www.gnu.org/licenses/gpl-3.0/
+[vss-sdk]: https://vss-sdk.github.io
+[samplecpp]: https://github.com/VSS-SDK/VSS-SampleCpp
+[samplepy]: https://github.com/VSS-SDK/VSS-SamplePy
+[samplerust]: https://github.com/VSS-SDK/VSS-SampleRust
+[corecpp]: https://github.com/VSS-SDK/VSS-Core
+[corepy]: https://github.com/VSS-SDK/VSS-CorePy
+[corerust]: https://github.com/VSS-SDK/VSS-CoreRust
+[travis]: https://travis-ci.com/VSS-SDK/VSS-Core
+[vss-sdk-trello]: https://trello.com/b/b4dVV6ug/vss-sdk
+[slack]: https://vss-sdk.slack.com
+[wiki]: https://github.com/SIRLab/VSS-Core/wiki
diff --git a/vss-simulator/VSS-Core/configure.sh b/vss-simulator/VSS-Core/configure.sh
new file mode 100755
index 0000000..8818e11
--- /dev/null
+++ b/vss-simulator/VSS-Core/configure.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+CMAKE () {
+ bash scripts/protos.sh
+ rm -R build
+ mkdir -p build
+ cd build
+ cmake -D RELEASE=ON ..
+ make install
+ cd ..
+
+}
+
+CMAKE;
diff --git a/vss-simulator/VSS-Core/entrypoint.sh b/vss-simulator/VSS-Core/entrypoint.sh
new file mode 100644
index 0000000..4f0d809
--- /dev/null
+++ b/vss-simulator/VSS-Core/entrypoint.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+EXIT_IF_AN_ERROR_OCCURRED() {
+ LAST_CODE=$?;
+ echo "$LAST_CODE";
+ if [[ $LAST_CODE != 0 ]];
+ then
+ exit $LAST_CODE;
+ fi
+}
+
+TEST() {
+ cd build
+ ./tests
+ EXIT_IF_AN_ERROR_OCCURRED;
+ cd ..
+}
+
+if [[ $1 == "test" ]];
+then
+ TEST;
+else
+ echo "Only supports test"
+fi
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Builders/StdinInterpreterBuilder.h b/vss-simulator/VSS-Core/include/Builders/StdinInterpreterBuilder.h
new file mode 100644
index 0000000..7fe7c05
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Builders/StdinInterpreterBuilder.h
@@ -0,0 +1,50 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_FLUENTSTDININTERPRETERBUILDER_H
+#define VSS_CORE_FLUENTSTDININTERPRETERBUILDER_H
+
+#include
+
+namespace vss {
+
+ class StdinInterpreterBuilder : public IStdinInterpreterBuilder {
+ public:
+ StdinInterpreterBuilder();
+
+ IStdinInterpreter* buildInterpreter() override;
+
+ IStdinInterpreterBuilder* onStateRecvAddr() override;
+
+ IStdinInterpreterBuilder* onYellowCmdSendAddr() override;
+ IStdinInterpreterBuilder* onYellowDebugSendAddr() override;
+
+ IStdinInterpreterBuilder* onBlueCmdSendAddr() override;
+ IStdinInterpreterBuilder* onBlueDebugSendAddr() override;
+
+ IStdinInterpreterBuilder* onCtrlRecvAddr() override;
+
+ IStdinInterpreterBuilder* onStatePort() override;
+ IStdinInterpreterBuilder* onYellowCmdPort() override;
+ IStdinInterpreterBuilder* onYellowDebugPort() override;
+ IStdinInterpreterBuilder* onBlueCmdPort() override;
+ IStdinInterpreterBuilder* onBlueDebugPort() override;
+ IStdinInterpreterBuilder* onCtrlPort() override;
+
+ IStdinInterpreterBuilder* onTeamType() override;
+ IStdinInterpreterBuilder* onSideAttackType() override;
+ IStdinInterpreterBuilder* onTimeExecutionType() override;
+ IStdinInterpreterBuilder* onEnvironmentType() override;
+ IStdinInterpreterBuilder* onDurationType() override;
+ IStdinInterpreterBuilder* onMatchFinishType() override;
+
+ IStdinInterpreterBuilder* onTeamInitialPositionPath() override;
+
+ protected:
+ IStdinInterpreter *stdinInterpreter;
+ };
+
+};
+
+#endif //VSS_CORE_FLUENTSTDININTERPRETERBUILDER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/CommandReceiver.h b/vss-simulator/VSS-Core/include/Communications/CommandReceiver.h
new file mode 100644
index 0000000..d97b1e6
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/CommandReceiver.h
@@ -0,0 +1,35 @@
+//
+// Created by johnathan on 28/05/18.
+//
+
+#ifndef VSS_CORE_COMMANDRECEIVER_H
+#define VSS_CORE_COMMANDRECEIVER_H
+
+#include
+#include
+
+namespace vss {
+
+ class CommandReceiver : public ICommandReceiver {
+ public:
+ CommandReceiver();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket(TeamType) override;
+ void closeSocket() override;
+ Command receiveCommand() override;
+
+ protected:
+ void setupAddress(TeamType);
+ void setupAddress(ExecutionConfig&);
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_COMMANDRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/CommandSender.h b/vss-simulator/VSS-Core/include/Communications/CommandSender.h
new file mode 100644
index 0000000..6770ee7
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/CommandSender.h
@@ -0,0 +1,37 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_COMMANDSENDER_H
+#define VSS_CORE_COMMANDSENDER_H
+
+#include
+#include
+#include "Domain/TeamType.h"
+#include "Domain/Command.h"
+
+namespace vss {
+
+ class CommandSender : public ICommandSender {
+ public:
+ CommandSender();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket(TeamType) override;
+ void closeSocket() override;
+ void sendCommand(Command) override;
+
+ protected:
+ void setupAddress(TeamType);
+ void setupAddress(ExecutionConfig&);
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_COMMANDSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/ControlReceiver.h b/vss-simulator/VSS-Core/include/Communications/ControlReceiver.h
new file mode 100644
index 0000000..56351b5
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/ControlReceiver.h
@@ -0,0 +1,33 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_CONTROLRECEIVER_H
+#define VSS_CORE_CONTROLRECEIVER_H
+
+#include
+#include
+
+namespace vss {
+
+ class ControlReceiver : public IControlReceiver {
+ public:
+ ControlReceiver();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket() override;
+ void closeSocket() override;
+ Control receiveControl() override;
+
+ protected:
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_CONTROLRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/ControlSender.h b/vss-simulator/VSS-Core/include/Communications/ControlSender.h
new file mode 100644
index 0000000..a13dd6e
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/ControlSender.h
@@ -0,0 +1,33 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_CONTROLSENDER_H
+#define VSS_CORE_CONTROLSENDER_H
+
+#include
+#include
+
+namespace vss {
+
+ class ControlSender : public IControlSender {
+ public:
+ ControlSender();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket() override;
+ void closeSocket() override;
+ void sendControl(Control) override;
+
+ protected:
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_CONTROLSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/DebugReceiver.h b/vss-simulator/VSS-Core/include/Communications/DebugReceiver.h
new file mode 100644
index 0000000..6bd120b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/DebugReceiver.h
@@ -0,0 +1,37 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_DEBUGRECEIVER_H
+#define VSS_CORE_DEBUGRECEIVER_H
+
+
+#include
+#include
+#include
+
+namespace vss {
+
+ class DebugReceiver : public IDebugReceiver {
+ public:
+ DebugReceiver();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket(TeamType) override;
+ void closeSocket() override;
+ Debug receiveDebug() override;
+
+ protected:
+ void setupAddress(TeamType);
+ void setupAddress(ExecutionConfig&);
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_DEBUGRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/DebugSender.h b/vss-simulator/VSS-Core/include/Communications/DebugSender.h
new file mode 100644
index 0000000..d8abcdd
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/DebugSender.h
@@ -0,0 +1,35 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#ifndef VSS_CORE_DEBUGSENDER_H
+#define VSS_CORE_DEBUGSENDER_H
+
+#include
+#include
+
+namespace vss {
+
+ class DebugSender : public IDebugSender {
+ public:
+ DebugSender();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket(TeamType) override;
+ void closeSocket() override;
+ void sendDebug(Debug) override;
+
+ protected:
+ void setupAddress(TeamType);
+ void setupAddress(ExecutionConfig&);
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_DEBUGSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Communications/StateReceiver.h b/vss-simulator/VSS-Core/include/Communications/StateReceiver.h
new file mode 100644
index 0000000..0bc2196
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/StateReceiver.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+#ifndef _INTERFACE_CORE_H_
+#define _INTERFACE_CORE_H_
+
+#include
+#include
+#include "zmq.hpp"
+
+namespace vss{
+
+ class StateReceiver : public IStateReceiver {
+ public:
+ StateReceiver();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket() override;
+ void closeSocket() override;
+ State receiveState(FieldTransformationType) override;
+
+ protected:
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif // _INTERFACE_CORE_H_
diff --git a/vss-simulator/VSS-Core/include/Communications/StateSender.h b/vss-simulator/VSS-Core/include/Communications/StateSender.h
new file mode 100644
index 0000000..6d2d721
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Communications/StateSender.h
@@ -0,0 +1,33 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_STATESENDER_H
+#define VSS_CORE_STATESENDER_H
+
+#include
+#include
+
+namespace vss{
+
+ class StateSender : public IStateSender {
+ public:
+ StateSender();
+
+ void createSocket(ExecutionConfig&) override;
+ void createSocket(Address) override;
+ void createSocket() override;
+ void closeSocket() override;
+ void sendState(State) override;
+
+ protected:
+ void connect();
+
+ zmq::context_t *context;
+ zmq::socket_t *socket;
+ Address address;
+ };
+
+}
+
+#endif //VSS_CORE_STATESENDER_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Address.h b/vss-simulator/VSS-Core/include/Domain/Address.h
new file mode 100644
index 0000000..be53b9b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Address.h
@@ -0,0 +1,34 @@
+//
+// Created by johnathan on 23/06/18.
+//
+
+#ifndef VSS_CORE_ADDRESS_H
+#define VSS_CORE_ADDRESS_H
+
+#include
+#include
+
+namespace vss {
+
+ class Address {
+ public:
+ Address();
+ Address(std::string ip, int port);
+
+ friend std::ostream& operator<<(std::ostream& os, const Address& address);
+
+ void setIp(std::string ip);
+ void setPort(int port);
+
+ std::string getIp();
+ int getPort();
+
+ std::string getFullAddress();
+
+ std::string ip;
+ int port;
+ };
+
+}
+
+#endif //VSS_CORE_ADDRESS_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Ball.h b/vss-simulator/VSS-Core/include/Domain/Ball.h
new file mode 100644
index 0000000..d3a9250
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Ball.h
@@ -0,0 +1,25 @@
+#ifndef _BALL_H_
+#define _BALL_H_
+
+#include "Point.h"
+
+namespace vss {
+
+ class Ball : public Point {
+ public:
+ Ball();
+ Ball(float x, float y, float speedX, float speedY);
+
+ friend std::ostream& operator<<(std::ostream& os, const Ball& ball);
+ friend bool operator==(const Ball& lhs, const Ball& rhs);
+ friend bool operator!=(const Ball& lhs, const Ball& rhs);
+ friend Ball operator-(const Ball& lhs, const Ball& rhs);
+ friend Ball operator+(const Ball& lhs, const Ball& rhs);
+
+ float speedX;
+ float speedY;
+ };
+
+}
+
+#endif
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Domain/Command.h b/vss-simulator/VSS-Core/include/Domain/Command.h
new file mode 100644
index 0000000..01ec74a
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Command.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_COMMAND_H
+#define VSS_CORE_COMMAND_H
+
+#include
+#include "WheelsCommand.h"
+
+namespace vss {
+
+ class Command {
+ public:
+ Command();
+ Command(std::vector commands);
+
+ friend std::ostream& operator<<(std::ostream& os, const Command& command);
+
+ std::vector commands;
+ };
+
+}
+
+#endif //VSS_CORE_COMMAND_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Constants.h b/vss-simulator/VSS-Core/include/Domain/Constants.h
new file mode 100644
index 0000000..9c31870
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Constants.h
@@ -0,0 +1,60 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_CONSTANTS_H
+#define VSS_CORE_CONSTANTS_H
+
+#include "string"
+#include "Domain/TeamType.h"
+#include "Domain/SideAttackType.h"
+#include "Domain/TimeExecutionType.h"
+#include "Domain/EnvironmentType.h"
+#include "Domain/DurationType.h"
+#include "Domain/MatchFinishType.h"
+
+namespace vss {
+
+ // Space Constraints
+ const int MIN_COORDINATE_X = 0;
+ const int MAX_COORDINATE_X = 170;
+ const int MIN_COORDINATE_Y = 0;
+ const int MAX_COORDINATE_Y = 130;
+ const int MIN_ANGLE_VALUE = 0;
+ const int MAX_ANGLE_VALUE = 360;
+
+ // Randomization
+ const int MAX_RANDOM_VELOCITY = 5;
+ const int MAX_RANDOM_PATH_SIZE = 10;
+ const int MAX_RANDOM_TEAM_SIZE = 11;
+ const int MAX_RANDOM_WHEEL_COMMAND = 10;
+ const int MAX_RANDOM_IP_VALUE = 255;
+ const int MAX_RANDOM_PORT_VALUE = 20000;
+
+ // Communication
+ const int DEFAULT_STATE_PORT = 5555;
+ const int DEFAULT_CMD_YELLOW_PORT = 5556;
+ const int DEFAULT_CMD_BLUE_PORT = 5557;
+ const int DEFAULT_DEBUG_YELLOW_PORT = 5558;
+ const int DEFAULT_DEBUG_BLUE_PORT = 5559;
+ const int DEFAULT_CTRL_PORT = 5560;
+ const std::string DEFAULT_STATE_SEND_ADDR = "tcp://*";
+ const std::string DEFAULT_STATE_RECV_ADDR = "tcp://localhost";
+ const std::string DEFAULT_CMD_SEND_ADDR = "tcp://localhost";
+ const std::string DEFAULT_CMD_RECV_ADDR = "tcp://*";
+ const std::string DEFAULT_DEBUG_SEND_ADDR = "tcp://localhost";
+ const std::string DEFAULT_DEBUG_RECV_ADDR = "tcp://*";
+ const std::string DEFAULT_CTRL_SEND_ADDR = "tcp://*";
+ const std::string DEFAULT_CTRL_RECV_ADDR = "tcp://localhost";
+
+ // Enums
+ const TeamType DEFAULT_TEAM_TYPE = TeamType::Yellow;
+ const SideAttackType DEFAULT_SIDE_ATTACK_TYPE = SideAttackType::Left;
+ const TimeExecutionType DEFAULT_TIME_EXECUTION_TYPE = TimeExecutionType::Normal;
+ const EnvironmentType DEFAULT_ENVIRONMENT_TYPE = EnvironmentType::Simulation;
+ const DurationType DEFAULT_DURATION_TYPE = DurationType::TenMinutes;
+ const MatchFinishType DEFAULT_MATCH_FINISH_TYPE = MatchFinishType::TenGoalsDifference;
+
+}
+
+#endif //VSS_CORE_CONSTANTS_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Control.h b/vss-simulator/VSS-Core/include/Domain/Control.h
new file mode 100644
index 0000000..08ce26b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Control.h
@@ -0,0 +1,29 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_CONTROL_H
+#define VSS_CORE_CONTROL_H
+
+#include
+#include "Ball.h"
+#include "Robot.h"
+
+namespace vss {
+
+ class Control {
+ public:
+ Control();
+ Control(bool paused, Ball ball, std::vector teamYellow, std::vector teamBlue);
+
+ friend std::ostream& operator<<(std::ostream& os, const Control& control);
+
+ bool paused;
+ Ball ball;
+ std::vector teamYellow;
+ std::vector teamBlue;
+ };
+
+}
+
+#endif //VSS_CORE_CONTROL_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Debug.h b/vss-simulator/VSS-Core/include/Domain/Debug.h
new file mode 100644
index 0000000..d2fff81
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Debug.h
@@ -0,0 +1,29 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#ifndef VSS_CORE_DEBUGINFO_H
+#define VSS_CORE_DEBUGINFO_H
+
+#include
+#include "Point.h"
+#include "Pose.h"
+#include "Path.h"
+
+namespace vss {
+
+ class Debug {
+ public:
+ Debug();
+ Debug(std::vector stepPoints, std::vector finalPoses, std::vector paths);
+
+ friend std::ostream& operator<<(std::ostream& os, const Debug& debug);
+
+ std::vector stepPoints;
+ std::vector finalPoses;
+ std::vector paths;
+ };
+
+}
+
+#endif //VSS_CORE_DEBUGINFO_H
diff --git a/vss-simulator/VSS-Core/include/Domain/DurationType.h b/vss-simulator/VSS-Core/include/Domain/DurationType.h
new file mode 100644
index 0000000..ddb54e1
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/DurationType.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 06/07/18.
+//
+
+#ifndef VSS_CORE_EXECUTIONTYPE_H
+#define VSS_CORE_EXECUTIONTYPE_H
+
+#include
+
+namespace vss {
+
+ enum DurationType{
+ TenMinutes = 0,
+ UnlimitedMinutes = 1
+ };
+
+ std::string toDescription(DurationType);
+ DurationType toDurationType(std::string);
+
+}
+
+#endif //VSS_CORE_EXECUTIONTYPE_H
diff --git a/vss-simulator/VSS-Core/include/Domain/EnvironmentType.h b/vss-simulator/VSS-Core/include/Domain/EnvironmentType.h
new file mode 100644
index 0000000..be146ed
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/EnvironmentType.h
@@ -0,0 +1,20 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_ENVIRONMENTTYPE_H
+#define VSS_CORE_ENVIRONMENTTYPE_H
+
+namespace vss {
+
+ enum EnvironmentType{
+ Simulation = 0,
+ Real = 1
+ };
+
+ std::string toDescription(EnvironmentType);
+ EnvironmentType toEnvironmentType(std::string);
+
+};
+
+#endif //VSS_CORE_ENVIRONMENTTYPE_H
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Domain/ExecutionConfig.h b/vss-simulator/VSS-Core/include/Domain/ExecutionConfig.h
new file mode 100644
index 0000000..2eb6145
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/ExecutionConfig.h
@@ -0,0 +1,57 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_STDINCONFIGURATION_H
+#define VSS_CORE_STDINCONFIGURATION_H
+
+#include "Domain/Address.h"
+#include "Domain/TeamType.h"
+#include "Domain/SideAttackType.h"
+#include "Domain/TimeExecutionType.h"
+#include "Domain/EnvironmentType.h"
+#include "DurationType.h"
+#include "MatchFinishType.h"
+
+namespace vss {
+
+ class ExecutionConfig {
+ public:
+ ExecutionConfig();
+
+ friend std::ostream& operator<<(std::ostream& os, const ExecutionConfig& executionConfig);
+
+ // Communications
+ Address stateRecvAddr;
+ Address stateSendAddr;
+
+ Address cmdYellowRecvAddr;
+ Address cmdYellowSendAddr;
+ Address debugYellowRecvAddr;
+ Address debugYellowSendAddr;
+
+ Address cmdBlueRecvAddr;
+ Address cmdBlueSendAddr;
+ Address debugBlueRecvAddr;
+ Address debugBlueSendAddr;
+
+ Address ctrlRecvAddr;
+ Address ctrlSendAddr;
+
+ // Enums
+ TeamType teamType;
+ SideAttackType sideAttackType;
+ TimeExecutionType timeExecutionType;
+ EnvironmentType environmentType;
+ DurationType durationType;
+ MatchFinishType matchFinishType;
+
+ // Others
+ std::string teamInitialPositionPath;
+
+ bool isValidConfiguration;
+ };
+
+}
+
+#endif //VSS_CORE_STDINCONFIGURATION_H
diff --git a/vss-simulator/VSS-Core/include/Domain/FieldTransformationType.h b/vss-simulator/VSS-Core/include/Domain/FieldTransformationType.h
new file mode 100644
index 0000000..8b3b890
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/FieldTransformationType.h
@@ -0,0 +1,18 @@
+#ifndef FIELD_TRANSFORMATION_H_
+#define FIELD_TRANSFORMATION_H_
+
+#include
+
+namespace vss {
+
+ enum FieldTransformationType{
+ None = 0,
+ Flip180Degrees = 1
+ };
+
+ std::string toDescription(FieldTransformationType);
+ FieldTransformationType toFieldTransformationType(std::string);
+
+}
+
+#endif
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Domain/MatchFinishType.h b/vss-simulator/VSS-Core/include/Domain/MatchFinishType.h
new file mode 100644
index 0000000..42fc82d
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/MatchFinishType.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 06/07/18.
+//
+
+#ifndef VSS_CORE_MATCHFINISHTYPE_H
+#define VSS_CORE_MATCHFINISHTYPE_H
+
+#include
+
+namespace vss {
+
+ enum MatchFinishType{
+ TenGoalsDifference = 0,
+ TimeUp = 1
+ };
+
+ std::string toDescription(MatchFinishType);
+ MatchFinishType toMatchFinishType(std::string);
+
+}
+
+#endif //VSS_CORE_MATCHFINISHTYPE_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Path.h b/vss-simulator/VSS-Core/include/Domain/Path.h
new file mode 100644
index 0000000..f5e331b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Path.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#ifndef VSS_CORE_PATH_H
+#define VSS_CORE_PATH_H
+
+#include
+#include "Point.h"
+
+namespace vss {
+
+ class Path {
+ public:
+ Path();
+ Path(std::vector points);
+
+ friend std::ostream& operator<<(std::ostream& os, const Path& path);
+
+ std::vector points;
+ };
+
+}
+
+#endif //VSS_CORE_PATH_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Point.h b/vss-simulator/VSS-Core/include/Domain/Point.h
new file mode 100644
index 0000000..9e7d5d8
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Point.h
@@ -0,0 +1,29 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#ifndef VSS_CORE_POINT_H
+#define VSS_CORE_POINT_H
+
+#include
+
+namespace vss {
+
+ class Point {
+ public:
+ Point();
+ Point(float x, float y);
+
+ friend std::ostream& operator<<(std::ostream& os, const Point& point);
+ friend bool operator==(const Point& lhs, const Point& rhs);
+ friend bool operator!=(const Point& lhs, const Point& rhs);
+ friend Point operator-(const Point& lhs, const Point& rhs);
+ friend Point operator+(const Point& lhs, const Point& rhs);
+
+ float x;
+ float y;
+ };
+
+}
+
+#endif //VSS_CORE_POINT_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Pose.h b/vss-simulator/VSS-Core/include/Domain/Pose.h
new file mode 100644
index 0000000..b193dd4
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Pose.h
@@ -0,0 +1,28 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#ifndef VSS_CORE_POSE_H
+#define VSS_CORE_POSE_H
+
+#include "Point.h"
+
+namespace vss {
+
+ class Pose : public Point {
+ public:
+ Pose();
+ Pose(float x, float y, float angle);
+
+ friend std::ostream& operator<<(std::ostream& os, const Pose& pose);
+ friend bool operator==(const Pose& lhs, const Pose& rhs);
+ friend bool operator!=(const Pose& lhs, const Pose& rhs);
+ friend Pose operator-(const Pose& lhs, const Pose& rhs);
+ friend Pose operator+(const Pose& lhs, const Pose& rhs);
+
+ float angle;
+ };
+
+}
+
+#endif //VSS_CORE_POSE_H
diff --git a/vss-simulator/VSS-Core/include/Domain/Robot.h b/vss-simulator/VSS-Core/include/Domain/Robot.h
new file mode 100644
index 0000000..c1751cd
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/Robot.h
@@ -0,0 +1,26 @@
+#ifndef _ROBOT_H_
+#define _ROBOT_H_
+
+#include "Pose.h"
+
+namespace vss {
+
+ class Robot : public Pose {
+ public:
+ Robot();
+ Robot(float x, float y, float angle, float speedX, float speedY, float speedAngle);
+
+ friend std::ostream& operator<<(std::ostream& os, const Robot& robot);
+ friend bool operator==(const Robot& lhs, const Robot& rhs);
+ friend bool operator!=(const Robot& lhs, const Robot& rhs);
+ friend Robot operator-(const Robot& lhs, const Robot& rhs);
+ friend Robot operator+(const Robot& lhs, const Robot& rhs);
+
+ float speedX;
+ float speedY;
+ float speedAngle;
+ };
+
+}
+
+#endif
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Domain/SideAttackType.h b/vss-simulator/VSS-Core/include/Domain/SideAttackType.h
new file mode 100644
index 0000000..2c41a5d
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/SideAttackType.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_SIDEATTACKTYPE_H
+#define VSS_CORE_SIDEATTACKTYPE_H
+
+#include
+
+namespace vss {
+
+ enum SideAttackType{
+ Left = 0,
+ Right = 1
+ };
+
+ std::string toDescription(SideAttackType);
+ SideAttackType toSideAttackType(std::string);
+
+};
+
+#endif //VSS_CORE_SIDEATTACKTYPE_H
diff --git a/vss-simulator/VSS-Core/include/Domain/State.h b/vss-simulator/VSS-Core/include/Domain/State.h
new file mode 100644
index 0000000..cb2f7ff
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/State.h
@@ -0,0 +1,23 @@
+#ifndef _STATE_H_
+#define _STATE_H_
+
+#include "Domain/Ball.h"
+#include "Domain/Robot.h"
+#include
+
+namespace vss {
+
+ class State {
+ public:
+ State();
+ State(Ball ball, std::vector teamBlue, std::vector teamYellow);
+
+ friend std::ostream& operator<<(std::ostream& os, const State& state);
+
+ Ball ball;
+ std::vector teamBlue;
+ std::vector teamYellow;
+ };
+
+}
+#endif
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Domain/TeamType.h b/vss-simulator/VSS-Core/include/Domain/TeamType.h
new file mode 100644
index 0000000..0cc3846
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/TeamType.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_TEAMS_H
+#define VSS_CORE_TEAMS_H
+
+#include
+
+namespace vss {
+
+ enum TeamType{
+ Yellow = 0,
+ Blue = 1
+ };
+
+ std::string toDescription(TeamType);
+ TeamType toTeamType(std::string);
+
+}
+
+#endif //VSS_CORE_TEAMS_H
diff --git a/vss-simulator/VSS-Core/include/Domain/TimeExecutionType.h b/vss-simulator/VSS-Core/include/Domain/TimeExecutionType.h
new file mode 100644
index 0000000..8dd3e9a
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/TimeExecutionType.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_TIMEEXECUTIONTYPE_H
+#define VSS_CORE_TIMEEXECUTIONTYPE_H
+
+#include
+
+namespace vss {
+
+ enum TimeExecutionType {
+ Normal = 0,
+ Fast = 1
+ };
+
+ std::string toDescription(TimeExecutionType);
+ TimeExecutionType toTimeExecutionType(std::string);
+
+};
+
+#endif //VSS_CORE_TIMEEXECUTIONTYPE_H
diff --git a/vss-simulator/VSS-Core/include/Domain/WheelsCommand.h b/vss-simulator/VSS-Core/include/Domain/WheelsCommand.h
new file mode 100644
index 0000000..ebad10f
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Domain/WheelsCommand.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_WHEELSCOMMAND_H
+#define VSS_CORE_WHEELSCOMMAND_H
+
+#include
+
+namespace vss {
+
+ class WheelsCommand {
+ public:
+ WheelsCommand();
+ WheelsCommand(float leftVel, float rightVel);
+
+ friend std::ostream& operator<<(std::ostream& os, const WheelsCommand& wheelsCommand);
+
+ float leftVel;
+ float rightVel;
+ };
+
+}
+
+#endif //VSS_CORE_WHEELSCOMMAND_H
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Helpers/CommandMapper.h b/vss-simulator/VSS-Core/include/Helpers/CommandMapper.h
new file mode 100644
index 0000000..6da414f
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/CommandMapper.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_COMMANDMAPPER_H
+#define VSS_CORE_COMMANDMAPPER_H
+
+#include
+#include
+
+namespace vss {
+
+ namespace CommandMapper {
+
+ vss_command::Global_Commands commandToGlobalCommands(Command command);
+ void setupWheelCommand(vss_command::Robot_Command *robotCommand, WheelsCommand wheelsCommand);
+
+ Command globalCommandsToCommand(vss_command::Global_Commands);
+ WheelsCommand robotCommandToWheelsCommand(vss_command::Robot_Command robotCommand);
+
+ }
+
+}
+
+#endif //VSS_CORE_COMMANDMAPPER_H
diff --git a/vss-simulator/VSS-Core/include/Helpers/ControlMapper.h b/vss-simulator/VSS-Core/include/Helpers/ControlMapper.h
new file mode 100644
index 0000000..aab9fbd
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/ControlMapper.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_CONTROLMAPPER_H
+#define VSS_CORE_CONTROLMAPPER_H
+
+#include
+#include "protos/control.pb.h"
+
+namespace vss {
+
+ namespace ControlMapper {
+
+ vss_control::User_Control controlToUserControl(Control control);
+ void setupNewRobotPose(vss_control::Pose *pose, Robot robot);
+
+ Control userControlToControl(vss_control::User_Control);
+ Robot newRobotPoseToRobot(vss_control::Pose newRobotPose);
+
+ }
+
+}
+
+#endif //VSS_CORE_CONTROLMAPPER_H
diff --git a/vss-simulator/VSS-Core/include/Helpers/CoordinateTransformer.h b/vss-simulator/VSS-Core/include/Helpers/CoordinateTransformer.h
new file mode 100644
index 0000000..2109bb3
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/CoordinateTransformer.h
@@ -0,0 +1,20 @@
+#ifndef _COORDINATE_TRANSFORMER_H_
+#define _COORDINATE_TRANSFORMER_H_
+
+#include "Domain/State.h"
+#include "Domain/Robot.h"
+#include "Domain/Ball.h"
+
+namespace vss {
+
+ namespace CoordinateTransformer {
+
+ Ball spin180Degrees(Ball ball);
+ Robot spin180Degrees(Robot robot);
+ State spinField180Degrees(State state);
+
+ };
+
+}
+
+#endif
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Helpers/DebugMapper.h b/vss-simulator/VSS-Core/include/Helpers/DebugMapper.h
new file mode 100644
index 0000000..5d67f0b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/DebugMapper.h
@@ -0,0 +1,24 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#ifndef VSS_CORE_DEBUGMAPPER_H
+#define VSS_CORE_DEBUGMAPPER_H
+
+#include
+#include "protos/debug.pb.h"
+
+namespace vss {
+
+ namespace DebugMapper {
+
+ vss_debug::Global_Debug debugToGlobalDebug(Debug debug);
+ void setupStepPoint(vss_debug::Pose *stepPose, Point point);
+ void setupFinalPose(vss_debug::Pose *finalPose, Pose pose);
+ void setupPath(vss_debug::Path *vssPath, Path path);
+ Debug globalDebugToDebug(vss_debug::Global_Debug);
+ }
+
+}
+
+#endif //VSS_CORE_DEBUGMAPPER_H
diff --git a/vss-simulator/VSS-Core/include/Helpers/DomainRandomizer.h b/vss-simulator/VSS-Core/include/Helpers/DomainRandomizer.h
new file mode 100644
index 0000000..0b97901
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/DomainRandomizer.h
@@ -0,0 +1,42 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_DOMAINRANDOMIZER_H
+#define VSS_CORE_DOMAINRANDOMIZER_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace vss {
+
+ namespace DomainRandomizer {
+
+ Point createRandomPoint();
+ Pose createRandomPose();
+ Ball createRandomBall();
+ Robot createRandomRobot();
+ Path createRandomPath();
+ State createRandomState();
+ WheelsCommand createRandomWheelsCommand();
+ Command createRandomCommand();
+ Debug createRandomDebug();
+ Control createRandomControl();
+ Address createRandomAddress();
+
+ vss_command::Robot_Command createRandomRobotCommand();
+ vss_command::Global_Commands createRandomGlobalCommands();
+
+ }
+
+}
+
+#endif //VSS_CORE_DOMAINRANDOMIZER_H
diff --git a/vss-simulator/VSS-Core/include/Helpers/Math.h b/vss-simulator/VSS-Core/include/Helpers/Math.h
new file mode 100644
index 0000000..886562f
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/Math.h
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#ifndef VSS_CORE_MATH_H
+#define VSS_CORE_MATH_H
+
+#include
+
+namespace vss {
+
+ namespace Math {
+
+ float distance(const vss::Point &t1, const vss::Point &t2);
+ float angleBetween(const vss::Point &t1, const vss::Point &t2);
+ float radianBetween(const vss::Point &t1, const vss::Point &t2);
+
+ }
+
+}
+
+#endif //VSS_CORE_MATH_H
diff --git a/vss-simulator/VSS-Core/include/Helpers/StateMapper.h b/vss-simulator/VSS-Core/include/Helpers/StateMapper.h
new file mode 100644
index 0000000..57a6e1c
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Helpers/StateMapper.h
@@ -0,0 +1,28 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_STATEMAPPER_H
+#define VSS_CORE_STATEMAPPER_H
+
+#include
+#include "Domain/State.h"
+#include "Domain/Robot.h"
+#include "Domain/Ball.h"
+
+namespace vss {
+
+ namespace StateMapper {
+
+ State globalStateToState(vss_state::Global_State globalState);
+ Robot robotStateToRobot(vss_state::Robot_State robotState);
+ Ball ballStateToBall(vss_state::Ball_State ballState);
+ vss_state::Global_State stateToGlobalState(State state);
+ void setupRobotState(vss_state::Robot_State *robotState, Robot robot);
+ void setupBallState(vss_state::Ball_State *ballState, Ball ball);
+
+ }
+
+}
+
+#endif //VSS_CORE_STATEMAPPER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/ICommandReceiver.h b/vss-simulator/VSS-Core/include/Interfaces/ICommandReceiver.h
new file mode 100644
index 0000000..593846b
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/ICommandReceiver.h
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ICOMMANDRECEIVER_H
+#define VSS_CORE_ICOMMANDRECEIVER_H
+
+#include
+#include
+#include
+#include "Domain/Command.h"
+
+namespace vss {
+
+ class ICommandReceiver {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket(TeamType) = 0;
+ virtual void closeSocket() = 0;
+ virtual Command receiveCommand() = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ICOMMANDRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/ICommandSender.h b/vss-simulator/VSS-Core/include/Interfaces/ICommandSender.h
new file mode 100644
index 0000000..763f885
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/ICommandSender.h
@@ -0,0 +1,27 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ICOMMANDSENDER_H
+#define VSS_CORE_ICOMMANDSENDER_H
+
+#include
+#include
+#include "iostream"
+#include "Domain/TeamType.h"
+#include "Domain/Command.h"
+
+namespace vss {
+
+ class ICommandSender {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket(TeamType) = 0;
+ virtual void closeSocket() = 0;
+ virtual void sendCommand(Command) = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ICOMMANDSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IControlReceiver.h b/vss-simulator/VSS-Core/include/Interfaces/IControlReceiver.h
new file mode 100644
index 0000000..0910721
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IControlReceiver.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ICONTROLRECEIVER_H
+#define VSS_CORE_ICONTROLRECEIVER_H
+
+#include
+#include
+#include "Domain/Control.h"
+
+namespace vss {
+
+ class IControlReceiver {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket() = 0;
+ virtual void closeSocket() = 0;
+ virtual Control receiveControl() = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ICONTROLRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IControlSender.h b/vss-simulator/VSS-Core/include/Interfaces/IControlSender.h
new file mode 100644
index 0000000..ff2aacc
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IControlSender.h
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ICONTROLSENDER_H
+#define VSS_CORE_ICONTROLSENDER_H
+
+#include
+#include
+#include "Domain/Control.h"
+
+namespace vss {
+
+ class IControlSender {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket() = 0;
+ virtual void closeSocket() = 0;
+ virtual void sendControl(Control) = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ICONTROLSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IDebugReceiver.h b/vss-simulator/VSS-Core/include/Interfaces/IDebugReceiver.h
new file mode 100644
index 0000000..f909727
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IDebugReceiver.h
@@ -0,0 +1,27 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_IDEBUGRECEIVER_H
+#define VSS_CORE_IDEBUGRECEIVER_H
+
+#include
+#include
+#include
+#include
+#include "Domain/Debug.h"
+
+namespace vss {
+
+ class IDebugReceiver {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket(TeamType) = 0;
+ virtual void closeSocket() = 0;
+ virtual Debug receiveDebug() = 0;
+ };
+
+}
+
+#endif //VSS_CORE_IDEBUGRECEIVER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IDebugSender.h b/vss-simulator/VSS-Core/include/Interfaces/IDebugSender.h
new file mode 100644
index 0000000..90a1461
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IDebugSender.h
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_IDEBUGSENDER_H
+#define VSS_CORE_IDEBUGSENDER_H
+
+#include
+#include
+#include "Domain/TeamType.h"
+#include "Domain/Debug.h"
+
+namespace vss {
+
+ class IDebugSender {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket(TeamType) = 0;
+ virtual void closeSocket() = 0;
+ virtual void sendDebug(Debug) = 0;
+ };
+
+}
+
+#endif //VSS_CORE_IDEBUGSENDER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IStateReceiver.h b/vss-simulator/VSS-Core/include/Interfaces/IStateReceiver.h
new file mode 100644
index 0000000..e48e335
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IStateReceiver.h
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ISTATERECEIVER_H
+#define VSS_CORE_ISTATERECEIVER_H
+
+#include
+#include
+#include "Domain/State.h"
+#include "Domain/FieldTransformationType.h"
+
+namespace vss {
+
+ class IStateReceiver {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket() = 0;
+ virtual void closeSocket() = 0;
+ virtual State receiveState(FieldTransformationType) = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ISTATERECEIVER_H
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IStateSender.h b/vss-simulator/VSS-Core/include/Interfaces/IStateSender.h
new file mode 100644
index 0000000..2886ea8
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IStateSender.h
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#ifndef VSS_CORE_ISTATESENDER_H
+#define VSS_CORE_ISTATESENDER_H
+
+#include
+#include
+#include "Domain/State.h"
+#include "iostream"
+
+namespace vss {
+
+ class IStateSender {
+ public:
+ virtual void createSocket(ExecutionConfig&) = 0;
+ virtual void createSocket(Address) = 0;
+ virtual void createSocket() = 0;
+ virtual void closeSocket() = 0;
+ virtual void sendState(State) = 0;
+ };
+
+}
+
+#endif //VSS_CORE_ISTATESENDER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreter.h b/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreter.h
new file mode 100644
index 0000000..6aaf458
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreter.h
@@ -0,0 +1,45 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_ISTDININTERPRETER_H
+#define VSS_CORE_ISTDININTERPRETER_H
+
+#include
+
+namespace vss {
+
+ class IStdinInterpreter {
+ public:
+ virtual ExecutionConfig extractExecutionConfig(int argc, char **argv) = 0;
+
+ bool onStateRecvAddr;
+
+ bool onYellowCmdSendAddr;
+ bool onYellowDebugSendAddr;
+
+ bool onBlueCmdSendAddr;
+ bool onBlueDebugSendAddr;
+
+ bool onCtrlRecvAddr;
+
+ bool onStatePort;
+ bool onYellowCmdPort;
+ bool onYellowDebugPort;
+ bool onBlueCmdPort;
+ bool onBlueDebugPort;
+ bool onCtrlPort;
+
+ bool onTeamType;
+ bool onSideAttackType;
+ bool onTimeExecutionType;
+ bool onEnvironmentType;
+ bool onDurationType;
+ bool onMatchFinishType;
+
+ bool onTeamInitialPositionPath;
+ };
+
+};
+
+#endif //VSS_CORE_ISTDININTERPRETER_H
diff --git a/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreterBuilder.h b/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreterBuilder.h
new file mode 100644
index 0000000..ca947a3
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interfaces/IStdinInterpreterBuilder.h
@@ -0,0 +1,42 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_ISTDININTERPRETERBUILDER_H
+#define VSS_CORE_ISTDININTERPRETERBUILDER_H
+
+#include "Interfaces/IStdinInterpreter.h"
+
+namespace vss {
+
+ class IStdinInterpreterBuilder {
+ public:
+ virtual IStdinInterpreter* buildInterpreter() = 0;
+
+ virtual IStdinInterpreterBuilder* onStateRecvAddr() = 0;
+ virtual IStdinInterpreterBuilder* onYellowCmdSendAddr() = 0;
+ virtual IStdinInterpreterBuilder* onYellowDebugSendAddr() = 0;
+ virtual IStdinInterpreterBuilder* onBlueCmdSendAddr() = 0;
+ virtual IStdinInterpreterBuilder* onBlueDebugSendAddr() = 0;
+ virtual IStdinInterpreterBuilder* onCtrlRecvAddr() = 0;
+
+ virtual IStdinInterpreterBuilder* onStatePort() = 0;
+ virtual IStdinInterpreterBuilder* onYellowCmdPort() = 0;
+ virtual IStdinInterpreterBuilder* onYellowDebugPort() = 0;
+ virtual IStdinInterpreterBuilder* onBlueCmdPort() = 0;
+ virtual IStdinInterpreterBuilder* onBlueDebugPort() = 0;
+ virtual IStdinInterpreterBuilder* onCtrlPort() = 0;
+
+ virtual IStdinInterpreterBuilder* onTeamType() = 0;
+ virtual IStdinInterpreterBuilder* onSideAttackType() = 0;
+ virtual IStdinInterpreterBuilder* onTimeExecutionType() = 0;
+ virtual IStdinInterpreterBuilder* onEnvironmentType() = 0;
+ virtual IStdinInterpreterBuilder* onDurationType() = 0;
+ virtual IStdinInterpreterBuilder* onMatchFinishType() = 0;
+
+ virtual IStdinInterpreterBuilder* onTeamInitialPositionPath() = 0;
+ };
+
+};
+
+#endif //VSS_CORE_ISTDININTERPRETERBUILDER_H
diff --git a/vss-simulator/VSS-Core/include/Interpreters/StdinInterpreter.h b/vss-simulator/VSS-Core/include/Interpreters/StdinInterpreter.h
new file mode 100644
index 0000000..9ab8648
--- /dev/null
+++ b/vss-simulator/VSS-Core/include/Interpreters/StdinInterpreter.h
@@ -0,0 +1,28 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#ifndef VSS_CORE_STDININTERPRETER_H
+#define VSS_CORE_STDININTERPRETER_H
+
+#include
+#include
+
+namespace vss {
+
+ class StdinInterpreter : public IStdinInterpreter {
+ public:
+ StdinInterpreter();
+
+ ExecutionConfig extractExecutionConfig(int argc, char **argv) override;
+
+ protected:
+ ExecutionConfig stdinConfiguration;
+
+ boost::program_options::options_description buildOptions();
+ void buildConfiguration(boost::program_options::variables_map);
+ };
+
+};
+
+#endif //VSS_CORE_STDININTERPRETER_H
diff --git a/vss-simulator/VSS-Core/protos/command.proto b/vss-simulator/VSS-Core/protos/command.proto
new file mode 100644
index 0000000..cad12e3
--- /dev/null
+++ b/vss-simulator/VSS-Core/protos/command.proto
@@ -0,0 +1,18 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+package vss_command;
+
+message Robot_Command{
+ required float left_vel = 1;
+ required float right_vel = 2;
+}
+
+message Global_Commands{
+ repeated Robot_Command robot_commands = 1;
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/protos/control.proto b/vss-simulator/VSS-Core/protos/control.proto
new file mode 100644
index 0000000..4383d66
--- /dev/null
+++ b/vss-simulator/VSS-Core/protos/control.proto
@@ -0,0 +1,22 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+package vss_control;
+
+message Pose{
+ required float x = 1;
+ required float y = 2;
+ optional float yaw = 3;
+}
+
+message User_Control{
+ optional bool paused = 1;
+ optional Pose new_ball_pose = 2;
+ repeated Pose new_robots_blue_pose = 3;
+ repeated Pose new_robots_yellow_pose = 4;
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/protos/debug.proto b/vss-simulator/VSS-Core/protos/debug.proto
new file mode 100644
index 0000000..64d591e
--- /dev/null
+++ b/vss-simulator/VSS-Core/protos/debug.proto
@@ -0,0 +1,25 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+package vss_debug;
+
+message Pose{
+ required float x = 1;
+ required float y = 2;
+ optional float yaw = 3;
+}
+
+message Path{
+ repeated Pose poses = 1;
+}
+
+message Global_Debug{
+ repeated Pose step_poses = 1;
+ repeated Pose final_poses = 2;
+ repeated Path paths = 3;
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/protos/state.proto b/vss-simulator/VSS-Core/protos/state.proto
new file mode 100644
index 0000000..40cbcd8
--- /dev/null
+++ b/vss-simulator/VSS-Core/protos/state.proto
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+package vss_state;
+
+message Pose{
+ required float x = 1;
+ required float y = 2;
+ optional float yaw = 3;
+}
+
+message Ball_State{
+ required Pose pose = 1;
+ optional Pose v_pose = 2;
+}
+
+message Robot_State{
+ required Pose pose = 1;
+ optional Pose v_pose = 2;
+}
+
+message Global_State{
+ repeated Ball_State balls = 1;
+ repeated Robot_State robots_yellow = 2;
+ repeated Robot_State robots_blue = 3;
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/scripts/protos.sh b/vss-simulator/VSS-Core/scripts/protos.sh
new file mode 100755
index 0000000..a22fc05
--- /dev/null
+++ b/vss-simulator/VSS-Core/scripts/protos.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# This file is part of the VSS-SDK project.
+#
+# This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+# v. 3.0. If a copy of the GPL was not distributed with this
+# file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+#
+
+protoc -I=. --cpp_out=. protos/state.proto
+protoc -I=. --cpp_out=. protos/command.proto
+protoc -I=. --cpp_out=. protos/debug.proto
+protoc -I=. --cpp_out=. protos/control.proto
+
+mkdir -p src/protos
+mkdir -p include/protos
+
+mv protos/*.pb.cc src/protos
+mv protos/*.pb.h include/protos
diff --git a/vss-simulator/VSS-Core/src/Builders/StdinInterpreterBuilder.cpp b/vss-simulator/VSS-Core/src/Builders/StdinInterpreterBuilder.cpp
new file mode 100644
index 0000000..75f94dc
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Builders/StdinInterpreterBuilder.cpp
@@ -0,0 +1,113 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+
+namespace vss {
+
+ StdinInterpreterBuilder::StdinInterpreterBuilder() {
+ stdinInterpreter = new StdinInterpreter();
+ }
+
+ IStdinInterpreter* StdinInterpreterBuilder::buildInterpreter() {
+ return stdinInterpreter;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onStateRecvAddr() {
+ stdinInterpreter->onStateRecvAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onYellowCmdSendAddr() {
+ stdinInterpreter->onYellowCmdSendAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onYellowDebugSendAddr() {
+ stdinInterpreter->onYellowDebugSendAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onBlueCmdSendAddr() {
+ stdinInterpreter->onBlueCmdSendAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onBlueDebugSendAddr() {
+ stdinInterpreter->onBlueDebugSendAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onCtrlRecvAddr() {
+ stdinInterpreter->onCtrlRecvAddr = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onTeamType() {
+ stdinInterpreter->onTeamType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onYellowCmdPort() {
+ stdinInterpreter->onYellowCmdPort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onYellowDebugPort() {
+ stdinInterpreter->onYellowDebugPort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onBlueCmdPort() {
+ stdinInterpreter->onBlueCmdPort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onBlueDebugPort() {
+ stdinInterpreter->onBlueDebugPort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onCtrlPort() {
+ stdinInterpreter->onCtrlPort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onSideAttackType() {
+ stdinInterpreter->onSideAttackType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onTimeExecutionType() {
+ stdinInterpreter->onTimeExecutionType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onStatePort() {
+ stdinInterpreter->onStatePort = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onEnvironmentType() {
+ stdinInterpreter->onEnvironmentType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onDurationType() {
+ stdinInterpreter->onDurationType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onMatchFinishType() {
+ stdinInterpreter->onMatchFinishType = true;
+ return this;
+ }
+
+ IStdinInterpreterBuilder *StdinInterpreterBuilder::onTeamInitialPositionPath() {
+ stdinInterpreter->onTeamInitialPositionPath = true;
+ return this;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/CommandReceiver.cpp b/vss-simulator/VSS-Core/src/Communications/CommandReceiver.cpp
new file mode 100644
index 0000000..afb7e9e
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/CommandReceiver.cpp
@@ -0,0 +1,78 @@
+//
+// Created by johnathan on 28/05/18.
+//
+
+#include
+#include
+#include
+
+namespace vss{
+
+ CommandReceiver::CommandReceiver() {
+ address = Address();
+ }
+
+ void CommandReceiver::createSocket(ExecutionConfig &exeConfig) {
+ setupAddress(exeConfig);
+ connect();
+ }
+
+ void CommandReceiver::createSocket(Address address) {
+ this->address = address;
+ std::cout << "Team Receiver Connected: " << address.getFullAddress() << std::endl;
+ connect();
+ }
+
+ void CommandReceiver::createSocket(TeamType teamType) {
+ setupAddress(teamType);
+ connect();
+ }
+
+ Command CommandReceiver::receiveCommand() {
+ vss_command::Global_Commands globalCommands;
+ zmq::message_t request;
+ socket->recv( &request );
+
+ std::string msg_str( static_cast(request.data()), request.size());
+ globalCommands.ParseFromString( msg_str );
+
+ return CommandMapper::globalCommandsToCommand(globalCommands);
+ }
+
+ void CommandReceiver::setupAddress(TeamType teamType) {
+ if(teamType == TeamType::Yellow){
+ address = Address(DEFAULT_CMD_RECV_ADDR, DEFAULT_CMD_YELLOW_PORT);
+ std::cout << "Yellow Team Receiver Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = Address(DEFAULT_CMD_RECV_ADDR, DEFAULT_CMD_BLUE_PORT);
+ std::cout << "Blue Team Receiver Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void CommandReceiver::setupAddress(ExecutionConfig &exeConfig) {
+ if(exeConfig.teamType == TeamType::Yellow){
+ address = exeConfig.cmdYellowRecvAddr;
+ std::cout << "Yellow Team Receiver Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = exeConfig.cmdBlueRecvAddr;
+ std::cout << "Blue Team Receiver Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void CommandReceiver::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_PAIR );
+ socket->bind(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void CommandReceiver::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/CommandSender.cpp b/vss-simulator/VSS-Core/src/Communications/CommandSender.cpp
new file mode 100644
index 0000000..87d3cca
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/CommandSender.cpp
@@ -0,0 +1,80 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include
+#include
+#include
+
+#include "Communications/CommandSender.h"
+
+namespace vss{
+
+ CommandSender::CommandSender(){
+ address = Address();
+ }
+
+ void CommandSender::createSocket(ExecutionConfig &exeConfig) {
+ setupAddress(exeConfig);
+ connect();
+ }
+
+ void CommandSender::createSocket(Address address) {
+ this->address = address;
+ std::cout << "Team Sender Connected: " << address.getFullAddress() << std::endl;
+ connect();
+ }
+
+ void CommandSender::createSocket(TeamType teamType) {
+ setupAddress(teamType);
+ connect();
+ }
+
+ void CommandSender::sendCommand(Command command) {
+ auto globalCommands = CommandMapper::commandToGlobalCommands(command);
+
+ std::string msg_str;
+ globalCommands.SerializeToString( &msg_str );
+
+ zmq::message_t request ( msg_str.size());
+ memcpy ((void *) request.data (), msg_str.c_str(), msg_str.size());
+ socket->send( request );
+ }
+
+ void CommandSender::setupAddress(TeamType teamType) {
+ if(teamType == TeamType::Yellow){
+ address = Address(DEFAULT_CMD_SEND_ADDR, DEFAULT_CMD_YELLOW_PORT);
+ std::cout << "Yellow Team Sender Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = Address(DEFAULT_CMD_SEND_ADDR, DEFAULT_CMD_BLUE_PORT);
+ std::cout << "Blue Team Sender Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void CommandSender::setupAddress(ExecutionConfig &exeConfig) {
+ if(exeConfig.teamType == TeamType::Yellow){
+ address = exeConfig.cmdYellowSendAddr;
+ std::cout << "Yellow Team Sender Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = exeConfig.cmdBlueRecvAddr;
+ std::cout << "Blue Team Sender Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void CommandSender::connect() {
+ try {
+ context = new zmq::context_t(1);
+ socket = new zmq::socket_t(*context, ZMQ_PAIR);
+ socket->connect(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void CommandSender::closeSocket() {
+ socket->close();
+ }
+
+}
diff --git a/vss-simulator/VSS-Core/src/Communications/ControlReceiver.cpp b/vss-simulator/VSS-Core/src/Communications/ControlReceiver.cpp
new file mode 100644
index 0000000..87125ed
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/ControlReceiver.cpp
@@ -0,0 +1,60 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+#include
+#include
+
+namespace vss {
+
+ ControlReceiver::ControlReceiver() {
+ address = Address(DEFAULT_CTRL_RECV_ADDR, DEFAULT_CTRL_PORT);
+ }
+
+ void ControlReceiver::createSocket(ExecutionConfig &exeConfig) {
+ this->address = exeConfig.ctrlRecvAddr;
+ connect();
+ }
+
+ void ControlReceiver::createSocket(Address address) {
+ this->address = address;
+ connect();
+ }
+
+ void ControlReceiver::createSocket() {
+ connect();
+ }
+
+ Control ControlReceiver::receiveControl() {
+ vss_control::User_Control userControl;
+
+ zmq::message_t request;
+ socket->recv( &request, 0 );
+
+ std::string msg_str( static_cast(request.data()), request.size());
+ userControl.ParseFromString( msg_str );
+
+ return vss::ControlMapper::userControlToControl(userControl);
+ }
+
+ void ControlReceiver::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_SUB );
+
+ std::cout << "Control Receiver Connected: " << address << std::endl;
+ socket->connect(address.getFullAddress().c_str());
+ socket->setsockopt( ZMQ_SUBSCRIBE, "", 0 );
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void ControlReceiver::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/ControlSender.cpp b/vss-simulator/VSS-Core/src/Communications/ControlSender.cpp
new file mode 100644
index 0000000..2dbe997
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/ControlSender.cpp
@@ -0,0 +1,58 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+#include
+#include
+
+namespace vss {
+
+ ControlSender::ControlSender() {
+ address = Address(DEFAULT_CTRL_SEND_ADDR, DEFAULT_CTRL_PORT);
+ }
+
+ void ControlSender::createSocket(ExecutionConfig &exeConfig) {
+ this->address = exeConfig.ctrlSendAddr;
+ connect();
+ }
+
+ void ControlSender::createSocket(Address address) {
+ this->address = address;
+ connect();
+ }
+
+ void ControlSender::createSocket() {
+ connect();
+ }
+
+ void ControlSender::sendControl(Control control) {
+ auto userControl = vss::ControlMapper::controlToUserControl(control);
+ std::string msg_str;
+ userControl.SerializeToString( &msg_str );
+
+ zmq::message_t request ( msg_str.size());
+ memcpy ((void *) request.data (), msg_str.c_str(), msg_str.size());
+
+ socket->send( request );
+ }
+
+ void ControlSender::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_PUB );
+
+ std::cout << "Control Sender Connected: " << address << std::endl;
+ socket->bind(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void ControlSender::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/DebugReceiver.cpp b/vss-simulator/VSS-Core/src/Communications/DebugReceiver.cpp
new file mode 100644
index 0000000..0035801
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/DebugReceiver.cpp
@@ -0,0 +1,79 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+#include
+#include
+
+namespace vss {
+
+ DebugReceiver::DebugReceiver() {
+ address = Address();
+ }
+
+ void DebugReceiver::createSocket(ExecutionConfig &exeConfig) {
+ setupAddress(exeConfig);
+ connect();
+ }
+
+ void DebugReceiver::createSocket(Address address) {
+ this->address = address;
+ std::cout << "Debug Receiver Connected: " << address.getFullAddress() << std::endl;
+ connect();
+ }
+
+ void DebugReceiver::createSocket(TeamType teamType) {
+ setupAddress(teamType);
+ connect();
+ }
+
+ Debug DebugReceiver::receiveDebug() {
+ vss_debug::Global_Debug globalDebug;
+
+ zmq::message_t request;
+ socket->recv( &request );
+
+ std::string msg_str( static_cast(request.data()), request.size());
+ globalDebug.ParseFromString( msg_str );
+
+ return DebugMapper::globalDebugToDebug(globalDebug);
+ }
+
+ void DebugReceiver::setupAddress(TeamType teamType) {
+ if(teamType == TeamType::Yellow){
+ address = Address(DEFAULT_DEBUG_RECV_ADDR, DEFAULT_DEBUG_YELLOW_PORT);
+ std::cout << "Yellow Debug Receiver Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = Address(DEFAULT_DEBUG_RECV_ADDR, DEFAULT_DEBUG_BLUE_PORT);
+ std::cout << "Blue Debug Receiver Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void DebugReceiver::setupAddress(ExecutionConfig &exeConfig) {
+ if(exeConfig.teamType == TeamType::Yellow){
+ address = exeConfig.debugYellowRecvAddr;
+ std::cout << "Yellow Debug Receiver Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = exeConfig.debugBlueRecvAddr;
+ std::cout << "Blue Debug Receiver Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void DebugReceiver::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_PAIR );
+ socket->bind(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void DebugReceiver::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/DebugSender.cpp b/vss-simulator/VSS-Core/src/Communications/DebugSender.cpp
new file mode 100644
index 0000000..c0b4778
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/DebugSender.cpp
@@ -0,0 +1,82 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#include
+#include
+#include
+#include
+
+#include "Communications/DebugSender.h"
+
+namespace vss {
+
+ DebugSender::DebugSender() {
+ address = Address();
+ }
+
+ void DebugSender::createSocket(ExecutionConfig &exeConfig) {
+ setupAddress(exeConfig);
+ connect();
+ }
+
+ void DebugSender::createSocket(Address address) {
+ this->address = address;
+ std::cout << "Debug Sender Connected: " << address.getFullAddress() << std::endl;
+ connect();
+ }
+
+ void DebugSender::createSocket(TeamType teamType) {
+ setupAddress(teamType);
+ connect();
+ }
+
+ void DebugSender::sendDebug(Debug debug) {
+ std::string msg_str;
+ auto globalDebug = DebugMapper::debugToGlobalDebug(debug);
+
+ globalDebug.SerializeToString( &msg_str );
+
+ zmq::message_t request ( msg_str.size());
+ memcpy ((void *) request.data (), msg_str.c_str(), msg_str.size());
+ socket->send( request );
+ }
+
+ void DebugSender::setupAddress(TeamType teamType) {
+ if(teamType == TeamType::Yellow){
+ address = Address(DEFAULT_DEBUG_SEND_ADDR, DEFAULT_DEBUG_YELLOW_PORT);
+ std::cout << "Yellow Debug Sender Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = Address(DEFAULT_DEBUG_SEND_ADDR, DEFAULT_DEBUG_BLUE_PORT);
+ std::cout << "Blue Debug Sender Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void DebugSender::setupAddress(ExecutionConfig &exeConfig) {
+ if(exeConfig.teamType == TeamType::Yellow){
+ address = exeConfig.debugYellowSendAddr;
+ std::cout << "Yellow Debug Sender Connected: " << address.getFullAddress() << std::endl;
+ }else{
+ address = exeConfig.debugBlueSendAddr;
+ std::cout << "Blue Debug Sender Connected: " << address.getFullAddress() << std::endl;
+ }
+ }
+
+ void DebugSender::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_PAIR );
+
+ socket->connect(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void DebugSender::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/StateReceiver.cpp b/vss-simulator/VSS-Core/src/Communications/StateReceiver.cpp
new file mode 100644
index 0000000..0097dab
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/StateReceiver.cpp
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the VSS-SDK project.
+ *
+ * This Source Code Form is subject to the terms of the GNU GENERAL PUBLIC LICENSE,
+ * v. 3.0. If a copy of the GPL was not distributed with this
+ * file, You can obtain one at http://www.gnu.org/licenses/gpl-3.0/.
+ */
+
+#include
+#include
+#include
+
+#include "Communications/StateReceiver.h"
+#include "Helpers/StateMapper.h"
+
+namespace vss{
+
+ StateReceiver::StateReceiver(){
+ address = Address(DEFAULT_STATE_RECV_ADDR, DEFAULT_STATE_PORT);
+ }
+
+ void StateReceiver::createSocket(ExecutionConfig &exeConfig) {
+ this->address = exeConfig.stateRecvAddr;
+ connect();
+ }
+
+ void StateReceiver::createSocket(Address address) {
+ this->address = address;
+ connect();
+ }
+
+ void StateReceiver::createSocket(){
+ connect();
+ }
+
+ State StateReceiver::receiveState(FieldTransformationType userTransformation){
+ vss_state::Global_State globalState;
+ zmq::message_t request;
+
+ socket->recv(&request, 0);
+ std::string msg_str( static_cast(request.data()), request.size());
+
+ globalState.ParseFromString(msg_str);
+ auto state = StateMapper::globalStateToState(globalState);
+
+ if (userTransformation == FieldTransformationType::Flip180Degrees) {
+ state = CoordinateTransformer::spinField180Degrees(state);
+ }
+
+ return state;
+ }
+
+ void StateReceiver::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_SUB );
+
+ std::cout << "State Receiver Connected: " << address << std::endl;
+ socket->connect(address.getFullAddress().c_str());
+ socket->setsockopt( ZMQ_SUBSCRIBE, "", 0 );
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void StateReceiver::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Communications/StateSender.cpp b/vss-simulator/VSS-Core/src/Communications/StateSender.cpp
new file mode 100644
index 0000000..15a1ff9
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Communications/StateSender.cpp
@@ -0,0 +1,60 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include
+#include
+#include "Communications/StateSender.h"
+
+namespace vss{
+
+ StateSender::StateSender(){
+ address = Address(DEFAULT_STATE_SEND_ADDR, DEFAULT_STATE_PORT);
+ }
+
+ void StateSender::createSocket(ExecutionConfig &exeConfig) {
+ this->address = exeConfig.stateSendAddr;
+ connect();
+ }
+
+ void StateSender::createSocket(Address address) {
+ this->address = address;
+ connect();
+ }
+
+ void StateSender::createSocket(){
+ connect();
+ }
+
+ void StateSender::sendState(State state){
+ std::string msg_str;
+ vss_state::Global_State globalState;
+
+ globalState = StateMapper::stateToGlobalState(state);
+ globalState.SerializeToString( &msg_str );
+
+ zmq::message_t request ( msg_str.size());
+ memcpy ((void *) request.data (), msg_str.c_str(), msg_str.size());
+
+ socket->send( request );
+ }
+
+ void StateSender::connect() {
+ try {
+ context = new zmq::context_t( 1 );
+ socket = new zmq::socket_t( *context, ZMQ_PUB );
+
+ std::cout << "State Sender Connected: " << address << std::endl;
+ socket->bind(address.getFullAddress().c_str());
+ }
+ catch(zmq::error_t& e) {
+ std::cout << "Error: " << e.what() << " " << this->address.getFullAddress() << std::endl;
+ throw e;
+ }
+ }
+
+ void StateSender::closeSocket() {
+ socket->close();
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/Address.cpp b/vss-simulator/VSS-Core/src/Domain/Address.cpp
new file mode 100644
index 0000000..5510b4f
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Address.cpp
@@ -0,0 +1,45 @@
+//
+// Created by johnathan on 23/06/18.
+//
+
+#include
+
+namespace vss {
+
+ Address::Address() {
+ ip = "";
+ port = 0;
+ }
+
+ Address::Address(std::string ip, int port) {
+ this->ip = ip;
+ this->port = port;
+ }
+
+ void Address::setIp(std::string ip) {
+ this->ip = ip;
+ }
+
+ void Address::setPort(int port) {
+ this->port = port;
+ }
+
+ std::string Address::getIp() {
+ return ip;
+ }
+
+ int Address::getPort() {
+ return port;
+ }
+
+ std::string Address::getFullAddress() {
+ std::stringstream ss;
+ ss << ip << ":" << port;
+ return ss.str();
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Address &address) {
+ return os << address.ip << ":" << address.port;
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/Ball.cpp b/vss-simulator/VSS-Core/src/Domain/Ball.cpp
new file mode 100644
index 0000000..ee42544
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Ball.cpp
@@ -0,0 +1,66 @@
+
+#include
+
+#include "Domain/Ball.h"
+
+namespace vss{
+
+ Ball::Ball() {
+ x = 0;
+ y = 0;
+ speedX = 0;
+ speedY = 0;
+ }
+
+ Ball::Ball(float x, float y, float speedX, float speedY) {
+ this->x = x;
+ this->y = y;
+ this->speedX = speedX;
+ this->speedY = speedY;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Ball &ball) {
+ return os << "Ball(" << ball.x << ", " << ball.y << ", " << ball.speedX << ", " << ball.speedY << ")";
+ }
+
+ bool operator==(const Ball &lhs, const Ball &rhs) {
+ if(lhs.x != rhs.x)
+ return false;
+
+ if(lhs.y != rhs.y)
+ return false;
+
+ if(lhs.speedX != rhs.speedX)
+ return false;
+
+ if(lhs.speedY != rhs.speedY)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const Ball &lhs, const Ball &rhs) {
+ if(lhs.x != rhs.x)
+ return true;
+
+ if(lhs.y != rhs.y)
+ return true;
+
+ if(lhs.speedX != rhs.speedX)
+ return true;
+
+ if(lhs.speedY != rhs.speedY)
+ return true;
+
+ return false;
+ }
+
+ Ball operator-(const Ball &lhs, const Ball &rhs) {
+ return Ball(lhs.x - rhs.x, lhs.y - rhs.y, lhs.speedX - rhs.speedX, lhs.speedY - rhs.speedY);
+ }
+
+ Ball operator+(const Ball &lhs, const Ball &rhs) {
+ return Ball(lhs.x + rhs.x, lhs.y + rhs.y, lhs.speedX + rhs.speedX, lhs.speedY + rhs.speedY);
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/Command.cpp b/vss-simulator/VSS-Core/src/Domain/Command.cpp
new file mode 100644
index 0000000..f45af3f
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Command.cpp
@@ -0,0 +1,25 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include "Domain/Command.h"
+
+namespace vss {
+ Command::Command() = default;
+
+ Command::Command(std::vector commands) {
+ this->commands = commands;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Command &command) {
+ os << "Commands {" << std::endl;
+
+ for(unsigned int i = 0 ; i < command.commands.size() ; i++){
+ os << "\t" << command.commands[i] << std::endl;
+ }
+
+ os << "}";
+
+ return os;
+ }
+}
diff --git a/vss-simulator/VSS-Core/src/Domain/Control.cpp b/vss-simulator/VSS-Core/src/Domain/Control.cpp
new file mode 100644
index 0000000..7d7c9b1
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Control.cpp
@@ -0,0 +1,42 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+
+namespace vss {
+
+ Control::Control() {
+ paused = false;
+ }
+
+ Control::Control(bool paused, Ball ball, std::vector teamYellow, std::vector teamBlue) {
+ this->paused = paused;
+ this->ball = ball;
+ this->teamYellow = teamYellow;
+ this->teamBlue = teamBlue;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Control &control) {
+ os << "Control {" << std::endl;
+
+ os << "\tPaused: " << control.paused << std::endl;
+ os << "\tBall: " << control.ball << std::endl;
+ os << "\tTeamYellow:" << std::endl;
+
+ for(unsigned int i = 0 ; i < control.teamYellow.size() ; i++){
+ os << "\t\t" << control.teamYellow[i] << std::endl;
+ }
+
+ os << "\tTeamBlue:" << std::endl;
+
+ for(unsigned int i = 0 ; i < control.teamBlue.size() ; i++){
+ os << "\t\t" << control.teamBlue[i] << std::endl;
+ }
+
+ os << "}";
+
+ return os;
+ }
+
+}
diff --git a/vss-simulator/VSS-Core/src/Domain/Debug.cpp b/vss-simulator/VSS-Core/src/Domain/Debug.cpp
new file mode 100644
index 0000000..b813a86
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Debug.cpp
@@ -0,0 +1,40 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#include
+
+namespace vss{
+
+ Debug::Debug() {
+
+ }
+
+ Debug::Debug(std::vector stepPoints, std::vector finalPoses, std::vector paths) {
+ this->stepPoints = stepPoints;
+ this->finalPoses = finalPoses;
+ this->paths = paths;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Debug &debug) {
+ os << "Debug {" << std::endl;
+
+ for(unsigned int i = 0 ; i < debug.finalPoses.size() ; i++){
+ os << "\tRobot {" << std::endl;
+ os << "\t\tStep: " << debug.stepPoints[i] << std::endl;
+ os << "\t\tFinal: " << debug.finalPoses[i] << std::endl;
+ os << "\t\tPath {" << std::endl;
+ for(unsigned int j = 0 ; j < debug.paths[i].points.size() ; j++){
+ os << "\t\t\t" << debug.paths[i].points[j] << std::endl;
+ }
+ os << "\t\t}" << std::endl;
+ os << "\t}" << std::endl;
+ }
+
+ os << "}";
+
+ return os;
+ }
+
+}
+
diff --git a/vss-simulator/VSS-Core/src/Domain/DurationType.cpp b/vss-simulator/VSS-Core/src/Domain/DurationType.cpp
new file mode 100644
index 0000000..ecb1ee0
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/DurationType.cpp
@@ -0,0 +1,30 @@
+//
+// Created by johnathan on 06/07/18.
+//
+
+#include
+
+namespace vss {
+
+ std::string toDescription(DurationType durationType) {
+ switch(durationType){
+ case DurationType::TenMinutes:
+ return "TenMinutes";
+ case DurationType::UnlimitedMinutes:
+ return "UnlimitedMinutes";
+ default:
+ return "TenMinutes";
+ }
+ }
+
+ DurationType toDurationType(std::string durationType) {
+ if(durationType == "TenMinutes")
+ return DurationType::TenMinutes;
+
+ if(durationType == "UnlimitedMinutes")
+ return DurationType::UnlimitedMinutes;
+
+ return DurationType::TenMinutes;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/EnvironmentType.cpp b/vss-simulator/VSS-Core/src/Domain/EnvironmentType.cpp
new file mode 100644
index 0000000..6aba87c
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/EnvironmentType.cpp
@@ -0,0 +1,31 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+
+namespace vss {
+
+ std::string toDescription(EnvironmentType environmentType) {
+ switch (environmentType){
+ case EnvironmentType::Simulation:
+ return "Simulation";
+ case EnvironmentType::Real:
+ return "Real";
+ default:
+ return "Simulation";
+ }
+ }
+
+ EnvironmentType toEnvironmentType(std::string environmentType) {
+ if(environmentType == "Simulation")
+ return EnvironmentType::Simulation;
+
+ if(environmentType == "Real")
+ return EnvironmentType::Real;
+
+ return EnvironmentType::Simulation;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/ExecutionConfig.cpp b/vss-simulator/VSS-Core/src/Domain/ExecutionConfig.cpp
new file mode 100644
index 0000000..38a6e7a
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/ExecutionConfig.cpp
@@ -0,0 +1,67 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+
+namespace vss {
+
+ ExecutionConfig::ExecutionConfig() {
+ stateSendAddr = Address(DEFAULT_STATE_SEND_ADDR, DEFAULT_STATE_PORT);
+ stateRecvAddr = Address(DEFAULT_STATE_RECV_ADDR, DEFAULT_STATE_PORT);
+
+ cmdYellowSendAddr = Address(DEFAULT_CMD_SEND_ADDR, DEFAULT_CMD_YELLOW_PORT);
+ cmdYellowRecvAddr = Address(DEFAULT_CMD_RECV_ADDR, DEFAULT_CMD_YELLOW_PORT);
+ debugYellowSendAddr = Address(DEFAULT_DEBUG_SEND_ADDR, DEFAULT_DEBUG_YELLOW_PORT);
+ debugYellowRecvAddr = Address(DEFAULT_DEBUG_RECV_ADDR, DEFAULT_DEBUG_YELLOW_PORT);
+
+ cmdBlueSendAddr = Address(DEFAULT_CMD_SEND_ADDR, DEFAULT_CMD_BLUE_PORT);
+ cmdBlueRecvAddr = Address(DEFAULT_CMD_RECV_ADDR, DEFAULT_CMD_BLUE_PORT);
+ debugBlueSendAddr = Address(DEFAULT_DEBUG_SEND_ADDR, DEFAULT_DEBUG_BLUE_PORT);
+ debugBlueRecvAddr = Address(DEFAULT_DEBUG_RECV_ADDR, DEFAULT_DEBUG_BLUE_PORT);
+
+ ctrlSendAddr = Address(DEFAULT_CTRL_SEND_ADDR, DEFAULT_CTRL_PORT);
+ ctrlRecvAddr = Address(DEFAULT_CTRL_RECV_ADDR, DEFAULT_CTRL_PORT);
+
+ teamType = DEFAULT_TEAM_TYPE;
+ sideAttackType = DEFAULT_SIDE_ATTACK_TYPE;
+ timeExecutionType = DEFAULT_TIME_EXECUTION_TYPE;
+ environmentType = DEFAULT_ENVIRONMENT_TYPE;
+ durationType = DEFAULT_DURATION_TYPE;
+ matchFinishType = DEFAULT_MATCH_FINISH_TYPE;
+ teamInitialPositionPath = "";
+
+ isValidConfiguration = false;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const ExecutionConfig &executionConfig) {
+ os << "stateSendAddr: " << executionConfig.stateSendAddr.ip << ":" << executionConfig.stateSendAddr.port << std::endl;
+ os << "stateRecvAddr: " << executionConfig.stateRecvAddr.ip << ":" << executionConfig.stateRecvAddr.port << std::endl;
+
+ os << "cmdYellowSendAddr: " << executionConfig.cmdYellowSendAddr.ip << ":" << executionConfig.cmdYellowSendAddr.port << std::endl;
+ os << "cmdYellowRecvAddr: " << executionConfig.cmdYellowRecvAddr.ip << ":" << executionConfig.cmdYellowRecvAddr.port << std::endl;
+ os << "debugYellowSendAddr: " << executionConfig.debugYellowSendAddr.ip << ":" << executionConfig.debugYellowSendAddr.port << std::endl;
+ os << "debugYellowRecvAddr: " << executionConfig.debugYellowRecvAddr.ip << ":" << executionConfig.debugYellowRecvAddr.port << std::endl;
+
+ os << "cmdBlueSendAddr: " << executionConfig.cmdBlueSendAddr.ip << ":" << executionConfig.cmdBlueSendAddr.port << std::endl;
+ os << "cmdBlueRecvAddr: " << executionConfig.cmdBlueRecvAddr.ip << ":" << executionConfig.cmdBlueRecvAddr.port << std::endl;
+ os << "debugBlueSendAddr: " << executionConfig.debugBlueSendAddr.ip << ":" << executionConfig.debugBlueSendAddr.port << std::endl;
+ os << "debugBlueRecvAddr: " << executionConfig.debugBlueRecvAddr.ip << ":" << executionConfig.debugBlueRecvAddr.port << std::endl;
+
+ os << "ctrlSendAddr: " << executionConfig.ctrlSendAddr.ip << ":" << executionConfig.ctrlSendAddr.port << std::endl;
+ os << "ctrlRecvAddr: " << executionConfig.ctrlRecvAddr.ip << ":" << executionConfig.ctrlRecvAddr.port << std::endl;
+
+ os << "teamType: " << toDescription(executionConfig.teamType) << std::endl;
+ os << "sideAttackType: " << toDescription(executionConfig.sideAttackType) << std::endl;
+ os << "timeExecutionType: " << toDescription(executionConfig.timeExecutionType) << std::endl;
+ os << "environmentType: " << toDescription(executionConfig.environmentType) << std::endl;
+ os << "durationType: " << toDescription(executionConfig.durationType) << std::endl;
+ os << "matchFinishType: " << toDescription(executionConfig.matchFinishType) << std::endl;
+
+ os << "teamInitialPositionPath: " << executionConfig.teamInitialPositionPath << std::endl;
+
+ return os;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/FieldTransformationType.cpp b/vss-simulator/VSS-Core/src/Domain/FieldTransformationType.cpp
new file mode 100644
index 0000000..9edca5f
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/FieldTransformationType.cpp
@@ -0,0 +1,30 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+
+namespace vss {
+
+ std::string toDescription(FieldTransformationType fieldTransformationType) {
+ switch (fieldTransformationType){
+ case FieldTransformationType::None:
+ return "None";
+ case FieldTransformationType::Flip180Degrees:
+ return "Flip180Degrees";
+ default:
+ return "None";
+ }
+ }
+
+ FieldTransformationType toFieldTransformationType(std::string fieldTransformationType) {
+ if(fieldTransformationType == "None")
+ return FieldTransformationType::None;
+
+ if(fieldTransformationType == "Flip180Degrees")
+ return FieldTransformationType::Flip180Degrees;
+
+ return FieldTransformationType::None;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/MatchFinishType.cpp b/vss-simulator/VSS-Core/src/Domain/MatchFinishType.cpp
new file mode 100644
index 0000000..6f02c68
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/MatchFinishType.cpp
@@ -0,0 +1,31 @@
+//
+// Created by johnathan on 06/07/18.
+//
+
+#include
+#include
+
+namespace vss {
+
+ std::string toDescription(MatchFinishType matchFinishType) {
+ switch(matchFinishType){
+ case MatchFinishType::TenGoalsDifference:
+ return "TenGoalsDifference";
+ case MatchFinishType::TimeUp:
+ return "TimeUp";
+ default:
+ return "TenGoalsDifference";
+ }
+ }
+
+ MatchFinishType toMatchFinishType(std::string matchFinishType) {
+ if(matchFinishType == "TenGoalsDifference")
+ return MatchFinishType::TenGoalsDifference;
+
+ if(matchFinishType == "TimeUp")
+ return MatchFinishType::TimeUp;
+
+ return MatchFinishType::TenGoalsDifference;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/Path.cpp b/vss-simulator/VSS-Core/src/Domain/Path.cpp
new file mode 100644
index 0000000..da2ecdb
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Path.cpp
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#include
+
+namespace vss {
+
+ Path::Path() {}
+
+ Path::Path(std::vector points) {
+ this->points = points;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Path &path) {
+ os << "Path {" << std::endl;
+
+ for(unsigned int i = 0 ; i < path.points.size() ; i++){
+ os << "\t" << path.points[i] << std::endl;
+ }
+
+ os << "}";
+
+ return os;
+ }
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/Point.cpp b/vss-simulator/VSS-Core/src/Domain/Point.cpp
new file mode 100644
index 0000000..d103960
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Point.cpp
@@ -0,0 +1,52 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#include
+
+namespace vss {
+
+ Point::Point() {
+ x = 0;
+ y = 0;
+ }
+
+ Point::Point(float x, float y) {
+ this->x = x;
+ this->y = y;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Point &point) {
+ return os << "Point(" << point.x << ", " << point.y << ")";
+ }
+
+ bool operator==(const Point &lhs, const Point &rhs) {
+ if(lhs.x != rhs.x)
+ return false;
+
+ if(lhs.y != rhs.y)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const Point &lhs, const Point &rhs) {
+ if(lhs.x != rhs.x)
+ return true;
+
+ if(lhs.y != rhs.y)
+ return true;
+
+ return false;
+ }
+
+ Point operator-(const Point &lhs, const Point &rhs) {
+ return Point(lhs.x - rhs.x, lhs.y - rhs.y);
+ }
+
+ Point operator+(const Point &lhs, const Point &rhs) {
+ return Point(lhs.x + rhs.x, lhs.y + rhs.y);
+ }
+
+}
+
diff --git a/vss-simulator/VSS-Core/src/Domain/Pose.cpp b/vss-simulator/VSS-Core/src/Domain/Pose.cpp
new file mode 100644
index 0000000..dbcfe84
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Pose.cpp
@@ -0,0 +1,60 @@
+//
+// Created by johnathan on 30/05/18.
+//
+
+#include
+
+namespace vss {
+
+ Pose::Pose() {
+ x = 0;
+ y = 0;
+ angle = 0;
+ }
+
+ Pose::Pose(float x, float y, float angle) {
+ this->x = x;
+ this->y = y;
+ this->angle = angle;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Pose &pose) {
+ return os << "Pose(" << pose.x << ", " << pose.y << ", " << pose.angle << ")";
+ }
+
+ bool operator==(const Pose &lhs, const Pose &rhs) {
+ if(lhs.x != rhs.x)
+ return false;
+
+ if(lhs.y != rhs.y)
+ return false;
+
+ if(lhs.angle != rhs.angle)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const Pose &lhs, const Pose &rhs) {
+ if(lhs.x != rhs.x)
+ return true;
+
+ if(lhs.y != rhs.y)
+ return true;
+
+ if(lhs.angle != rhs.angle)
+ return true;
+
+ return false;
+ }
+
+ Pose operator-(const Pose &lhs, const Pose &rhs) {
+ return Pose(lhs.x - rhs.x, lhs.y - rhs.y, lhs.angle - rhs.angle);
+ }
+
+ Pose operator+(const Pose &lhs, const Pose &rhs) {
+ return Pose(lhs.x + rhs.x, lhs.y + rhs.y, lhs.angle + rhs.angle);
+ }
+
+}
+
diff --git a/vss-simulator/VSS-Core/src/Domain/Robot.cpp b/vss-simulator/VSS-Core/src/Domain/Robot.cpp
new file mode 100644
index 0000000..c61271f
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/Robot.cpp
@@ -0,0 +1,82 @@
+
+#include
+
+#include "Domain/Robot.h"
+
+namespace vss{
+
+ Robot::Robot() {
+ x = 0;
+ y = 0;
+ angle = 0;
+ speedX = 0;
+ speedY = 0;
+ speedAngle = 0;
+ }
+
+ Robot::Robot(float x, float y, float angle, float speedX, float speedY, float speedAngle) {
+ this->x = x;
+ this->y = y;
+ this->angle = angle;
+ this->speedX = speedX;
+ this->speedY = speedY;
+ this->speedAngle = speedAngle;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const Robot &robot) {
+ return os << "Robot(" << robot.x << ", " << robot.y << ", " << robot.angle << ", " << robot.speedX << ", " << robot.speedY << ", " << robot.speedAngle << ")";
+ }
+
+ bool operator==(const Robot &lhs, const Robot &rhs) {
+ if(lhs.x != rhs.x)
+ return false;
+
+ if(lhs.y != rhs.y)
+ return false;
+
+ if(lhs.angle != rhs.angle)
+ return false;
+
+ if(lhs.speedX != rhs.speedX)
+ return false;
+
+ if(lhs.speedY != rhs.speedY)
+ return false;
+
+ if(lhs.speedAngle != rhs.speedAngle)
+ return false;
+
+ return true;
+ }
+
+ bool operator!=(const Robot &lhs, const Robot &rhs) {
+ if(lhs.x != rhs.x)
+ return true;
+
+ if(lhs.y != rhs.y)
+ return true;
+
+ if(lhs.angle != rhs.angle)
+ return true;
+
+ if(lhs.speedX != rhs.speedX)
+ return true;
+
+ if(lhs.speedY != rhs.speedY)
+ return true;
+
+ if(lhs.speedAngle != rhs.speedAngle)
+ return true;
+
+ return false;
+ }
+
+ Robot operator-(const Robot &lhs, const Robot &rhs) {
+ return Robot(lhs.x - rhs.x, lhs.y - rhs.y, lhs.angle - rhs.angle, lhs.speedX - rhs.speedX, lhs.speedY - rhs.speedY, lhs.speedAngle - rhs.speedAngle);
+ }
+
+ Robot operator+(const Robot &lhs, const Robot &rhs) {
+ return Robot(lhs.x + rhs.x, lhs.y + rhs.y, lhs.angle + rhs.angle, lhs.speedX + rhs.speedX, lhs.speedY + rhs.speedY, lhs.speedAngle + rhs.speedAngle);
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/SideAttackType.cpp b/vss-simulator/VSS-Core/src/Domain/SideAttackType.cpp
new file mode 100644
index 0000000..0ffeeba
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/SideAttackType.cpp
@@ -0,0 +1,30 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+
+namespace vss {
+
+ std::string toDescription(SideAttackType sideAttackType) {
+ switch (sideAttackType){
+ case SideAttackType::Left:
+ return "Left";
+ case SideAttackType::Right:
+ return "Right";
+ default:
+ return "Left";
+ }
+ }
+
+ SideAttackType toSideAttackType(std::string sideAttackType) {
+ if(sideAttackType == "Left")
+ return SideAttackType::Left;
+
+ if(sideAttackType == "Right")
+ return SideAttackType::Right;
+
+ return SideAttackType::Left;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/State.cpp b/vss-simulator/VSS-Core/src/Domain/State.cpp
new file mode 100644
index 0000000..48d1636
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/State.cpp
@@ -0,0 +1,32 @@
+#include "Domain/State.h"
+
+namespace vss{
+ State::State() { }
+
+ State::State(Ball ball, std::vector teamYellow, std::vector teamBlue) {
+ this->ball = ball;
+ this->teamBlue = teamBlue;
+ this->teamYellow = teamYellow;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const State &state) {
+ os << "State {" << std::endl;
+
+ os << "\t" << state.ball << std::endl;
+ os << "\tTeamYellow:" << std::endl;
+
+ for(unsigned int i = 0 ; i < state.teamYellow.size() ; i++){
+ os << "\t\t" << state.teamYellow[i] << std::endl;
+ }
+
+ os << "\tTeamBlue:" << std::endl;
+
+ for(unsigned int i = 0 ; i < state.teamBlue.size() ; i++){
+ os << "\t\t" << state.teamBlue[i] << std::endl;
+ }
+
+ os << "}";
+
+ return os;
+ }
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/TeamType.cpp b/vss-simulator/VSS-Core/src/Domain/TeamType.cpp
new file mode 100644
index 0000000..142f53e
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/TeamType.cpp
@@ -0,0 +1,32 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+#include
+
+namespace vss {
+
+ std::string toDescription(TeamType teamType) {
+ switch (teamType){
+ case TeamType::Yellow:
+ return "Yellow";
+ case TeamType::Blue:
+ return "Blue";
+ default:
+ return "Yellow";
+ }
+ }
+
+ TeamType toTeamType(std::string teamType) {
+ if(teamType == "Yellow")
+ return TeamType::Yellow;
+
+ if(teamType == "Blue")
+ return TeamType::Blue;
+
+ return TeamType::Yellow;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/TimeExecutionType.cpp b/vss-simulator/VSS-Core/src/Domain/TimeExecutionType.cpp
new file mode 100644
index 0000000..c4c2368
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/TimeExecutionType.cpp
@@ -0,0 +1,31 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+
+namespace vss {
+
+ std::string toDescription(TimeExecutionType timeExecutionType) {
+ switch (timeExecutionType){
+ case TimeExecutionType::Normal:
+ return "Normal";
+ case TimeExecutionType::Fast:
+ return "Fast";
+ default:
+ return "Normal";
+ }
+ }
+
+ TimeExecutionType toTimeExecutionType(std::string timeExecutionType) {
+ if(timeExecutionType == "Normal")
+ return TimeExecutionType::Normal;
+
+ if(timeExecutionType == "Fast")
+ return TimeExecutionType::Fast;
+
+ return TimeExecutionType::Normal;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Domain/WheelsCommand.cpp b/vss-simulator/VSS-Core/src/Domain/WheelsCommand.cpp
new file mode 100644
index 0000000..b0370af
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Domain/WheelsCommand.cpp
@@ -0,0 +1,22 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include "Domain/WheelsCommand.h"
+
+namespace vss{
+ WheelsCommand::WheelsCommand(){
+ leftVel = 0;
+ rightVel = 0;
+ }
+
+ WheelsCommand::WheelsCommand(float leftVel, float rightVel) {
+ this->leftVel = leftVel;
+ this->rightVel = rightVel;
+ }
+
+ std::ostream &operator<<(std::ostream &os, const WheelsCommand &wheelsCommand) {
+ return os << "WheelsCommand(" << wheelsCommand.leftVel << ", " << wheelsCommand.rightVel << ")";;
+ }
+}
+
diff --git a/vss-simulator/VSS-Core/src/Helpers/CommandMapper.cpp b/vss-simulator/VSS-Core/src/Helpers/CommandMapper.cpp
new file mode 100644
index 0000000..68c238c
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/CommandMapper.cpp
@@ -0,0 +1,51 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include
+#include "Helpers/CommandMapper.h"
+
+namespace vss {
+
+ namespace CommandMapper {
+
+ vss_command::Global_Commands commandToGlobalCommands(Command command) {
+ vss_command::Global_Commands commands;
+
+ for (unsigned int i = 0; i < command.commands.size() ; i++) {
+ auto ref = commands.add_robot_commands();
+ setupWheelCommand(ref, command.commands[i]);
+ }
+
+ return commands;
+ }
+
+ void setupWheelCommand(vss_command::Robot_Command *robotCommand, WheelsCommand wheelsCommand) {
+ robotCommand->set_left_vel(wheelsCommand.leftVel);
+ robotCommand->set_right_vel(wheelsCommand.rightVel);
+ }
+
+ Command globalCommandsToCommand(vss_command::Global_Commands globalCommands) {
+ Command command;
+
+ for (int i = 0 ; i < globalCommands.robot_commands_size() ; i++){
+ auto wheelsCommand = robotCommandToWheelsCommand(globalCommands.robot_commands(i));
+ command.commands.push_back(wheelsCommand);
+ }
+
+ return command;
+ }
+
+ WheelsCommand robotCommandToWheelsCommand(vss_command::Robot_Command robotCommand){
+ WheelsCommand wheelsCommand;
+
+ wheelsCommand.rightVel = robotCommand.right_vel();
+ wheelsCommand.leftVel = robotCommand.left_vel();
+
+ return wheelsCommand;
+ }
+
+ }
+
+}
+
diff --git a/vss-simulator/VSS-Core/src/Helpers/ControlMapper.cpp b/vss-simulator/VSS-Core/src/Helpers/ControlMapper.cpp
new file mode 100644
index 0000000..690517c
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/ControlMapper.cpp
@@ -0,0 +1,68 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include "Helpers/ControlMapper.h"
+
+namespace vss {
+
+ namespace ControlMapper {
+
+ vss_control::User_Control controlToUserControl(Control control) {
+ vss_control::User_Control userControl;
+
+ userControl.set_paused(control.paused);
+ userControl.mutable_new_ball_pose()->set_x( control.ball.x );
+ userControl.mutable_new_ball_pose()->set_y( control.ball.y );
+
+ for(unsigned int i = 0 ; i < control.teamYellow.size() ; i++){
+ auto yellowRobot = userControl.add_new_robots_yellow_pose();
+ setupNewRobotPose(yellowRobot, control.teamYellow[i]);
+ }
+
+ for(unsigned int i = 0 ; i < control.teamBlue.size() ; i++){
+ auto blueRobot = userControl.add_new_robots_blue_pose();
+ setupNewRobotPose(blueRobot, control.teamBlue[i]);
+ }
+
+ return userControl;
+ }
+
+ void setupNewRobotPose(vss_control::Pose *pose, Robot robot){
+ pose->set_x(robot.x);
+ pose->set_y(robot.y);
+ pose->set_yaw(robot.angle);
+ }
+
+ Control userControlToControl(vss_control::User_Control userControl) {
+ Control control;
+
+ control.paused = userControl.paused();
+ control.ball.x = userControl.mutable_new_ball_pose()->x();
+ control.ball.y = userControl.mutable_new_ball_pose()->y();
+
+ for(int i = 0; i < userControl.new_robots_yellow_pose_size(); i++) {
+ auto robot = newRobotPoseToRobot(userControl.new_robots_yellow_pose(i));
+ control.teamYellow.push_back(robot);
+ }
+
+ for(int i = 0; i < userControl.new_robots_blue_pose_size(); i++) {
+ auto robot = newRobotPoseToRobot(userControl.new_robots_blue_pose(i));
+ control.teamBlue.push_back(robot);
+ }
+
+ return control;
+ }
+
+ Robot newRobotPoseToRobot(vss_control::Pose newRobotPose){
+ Robot robot;
+
+ robot.x = newRobotPose.x();
+ robot.y = newRobotPose.y();
+ robot.angle = newRobotPose.yaw();
+
+ return robot;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Helpers/CoordinateTransformer.cpp b/vss-simulator/VSS-Core/src/Helpers/CoordinateTransformer.cpp
new file mode 100644
index 0000000..d0d12ab
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/CoordinateTransformer.cpp
@@ -0,0 +1,52 @@
+#include
+#include "Helpers/CoordinateTransformer.h"
+
+namespace vss{
+
+ namespace CoordinateTransformer{
+
+ State spinField180Degrees(State state){
+
+ state.ball = spin180Degrees(state.ball);
+
+ for (unsigned int i = 0; i < state.teamYellow.size(); i++) {
+ state.teamYellow[i] = spin180Degrees(state.teamYellow[i]);
+ }
+
+ for (unsigned int i = 0; i < state.teamBlue.size(); i++) {
+ state.teamBlue[i] = spin180Degrees(state.teamBlue[i]);
+ }
+
+ return state;
+ }
+
+ Robot spin180Degrees(Robot robot){
+ robot.x = vss::MAX_COORDINATE_X - robot.x;
+ robot.y = vss::MAX_COORDINATE_Y - robot.y;
+
+ if (robot.angle + (vss::MAX_ANGLE_VALUE/2) > vss::MAX_ANGLE_VALUE){
+ robot.angle = robot.angle - (vss::MAX_ANGLE_VALUE/2);
+ } else {
+ robot.angle = robot.angle + (vss::MAX_ANGLE_VALUE/2);
+ }
+
+ robot.speedX = -robot.speedX;
+ robot.speedY = -robot.speedY;
+ robot.speedAngle = -robot.speedAngle;
+
+ return robot;
+ }
+
+ Ball spin180Degrees(Ball ball){
+ ball.x = vss::MAX_COORDINATE_X - ball.x;
+ ball.y = vss::MAX_COORDINATE_Y - ball.y;
+
+ ball.speedX = -ball.speedX;
+ ball.speedY = -ball.speedY;
+
+ return ball;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Helpers/DebugMapper.cpp b/vss-simulator/VSS-Core/src/Helpers/DebugMapper.cpp
new file mode 100644
index 0000000..2dc06b0
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/DebugMapper.cpp
@@ -0,0 +1,78 @@
+//
+// Created by johnathan on 29/05/18.
+//
+
+#include "Helpers/DebugMapper.h"
+
+namespace vss {
+
+ namespace DebugMapper {
+
+ vss_debug::Global_Debug debugToGlobalDebug(Debug debug) {
+ vss_debug::Global_Debug globalDebug;
+
+ for(unsigned int i = 0 ; i < debug.stepPoints.size() ; i++){
+ auto stepPose = globalDebug.add_step_poses();
+ setupStepPoint(stepPose, debug.stepPoints[i]);
+ }
+
+ for(unsigned int i = 0 ; i < debug.finalPoses.size() ; i++){
+ auto finalPose = globalDebug.add_final_poses();
+ setupFinalPose(finalPose, debug.finalPoses[i]);
+ }
+
+ for(unsigned int i = 0 ; i < debug.paths.size() ; i++){
+ auto path = globalDebug.add_paths();
+ setupPath(path, debug.paths[i]);
+ }
+
+ return globalDebug;
+ }
+
+ void setupStepPoint(vss_debug::Pose *stepPose, Point point) {
+ stepPose->set_x(point.x);
+ stepPose->set_y(point.y);
+ stepPose->set_yaw(0);
+ }
+
+ void setupFinalPose(vss_debug::Pose *finalPose, Pose pose) {
+ finalPose->set_x(pose.x);
+ finalPose->set_y(pose.y);
+ finalPose->set_yaw(pose.angle);
+ }
+
+ void setupPath(vss_debug::Path *vssPath, Path path) {
+ for(unsigned int i = 0 ; i < path.points.size() ; i++){
+ auto pose = vssPath->add_poses();
+ setupStepPoint(pose, path.points[i]);
+ }
+ }
+
+ Debug globalDebugToDebug(vss_debug::Global_Debug globalDebug) {
+ Debug debug;
+
+ for(int i = 0 ; i < globalDebug.step_poses_size() ; i++){
+ debug.stepPoints.push_back(Point(globalDebug.step_poses(i).x(), globalDebug.step_poses(i).y()));
+ }
+
+ for(int i = 0 ; i < globalDebug.final_poses_size() ; i++){
+ debug.finalPoses.push_back(Pose(globalDebug.final_poses(i).x(), globalDebug.final_poses(i).y(), globalDebug.final_poses(i).yaw()));
+ }
+
+ for(int i = 0 ; i < globalDebug.paths_size() ; i++){
+ Path path;
+ auto vssPath = globalDebug.paths(i);
+
+ for(int j = 0 ; j < vssPath.poses_size() ; j++){
+ path.points.push_back(Point(vssPath.poses(j).x(), vssPath.poses(j).y()));
+ }
+
+ debug.paths.push_back(path);
+ }
+
+ return debug;
+ }
+
+ }
+
+}
diff --git a/vss-simulator/VSS-Core/src/Helpers/DomainRandomizer.cpp b/vss-simulator/VSS-Core/src/Helpers/DomainRandomizer.cpp
new file mode 100644
index 0000000..800a77e
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/DomainRandomizer.cpp
@@ -0,0 +1,193 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace vss {
+
+ namespace DomainRandomizer {
+
+ Point createRandomPoint() {
+ srand(static_cast(time(NULL)));
+
+ Point point;
+
+ point.x = rand() % MAX_COORDINATE_X;
+ point.y = rand() % MAX_COORDINATE_Y;
+
+ return point;
+ }
+
+ Pose createRandomPose() {
+ srand(static_cast(time(NULL)));
+
+ Pose pose;
+
+ pose.x = rand() % MAX_COORDINATE_X;
+ pose.y = rand() % MAX_COORDINATE_Y;
+ pose.angle = rand() % MAX_ANGLE_VALUE;
+
+ return pose;
+ }
+
+ Ball createRandomBall() {
+ srand(static_cast(time(NULL)));
+
+ Ball ball;
+
+ ball.x = rand() % MAX_COORDINATE_X;
+ ball.y = rand() % MAX_COORDINATE_Y;
+ ball.speedX = (rand() % MAX_RANDOM_VELOCITY) * (rand()%2 == 0 ? -1 : 1);
+ ball.speedY = (rand() % MAX_RANDOM_VELOCITY) * (rand()%2 == 0 ? -1 : 1);
+
+ return ball;
+ }
+
+ Robot createRandomRobot() {
+ srand(static_cast(time(NULL)));
+
+ Robot robot;
+
+ robot.x = rand() % MAX_COORDINATE_X;
+ robot.y = rand() % MAX_COORDINATE_Y;
+ robot.angle = rand() % MAX_ANGLE_VALUE;
+ robot.speedX = (rand() % MAX_RANDOM_VELOCITY) * (rand()%2 == 0 ? -1 : 1);
+ robot.speedY = (rand() % MAX_RANDOM_VELOCITY) * (rand()%2 == 0 ? -1 : 1);
+ robot.speedAngle = (rand() % MAX_RANDOM_VELOCITY) * (rand()%2 == 0 ? -1 : 1);
+
+ return robot;
+ }
+
+ Path createRandomPath() {
+ srand(static_cast(time(NULL)));
+ Path path;
+
+ auto size = static_cast(rand() % MAX_RANDOM_PATH_SIZE);
+
+ for(unsigned int i = 0 ; i < size ; i++){
+ path.points.push_back(createRandomPoint());
+ }
+
+ return path;
+ }
+
+ State createRandomState(){
+ srand(static_cast(time(NULL)));
+ State state;
+
+ auto sizeTeamYellow = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+ auto sizeTeamBlue = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+ state.ball = createRandomBall();
+
+ for(unsigned int i = 0 ; i < sizeTeamYellow ; i++){
+ state.teamYellow.push_back(createRandomRobot());
+ }
+
+ for(unsigned int i = 0 ; i < sizeTeamBlue ; i++){
+ state.teamBlue.push_back(createRandomRobot());
+ }
+
+ return state;
+ }
+
+ WheelsCommand createRandomWheelsCommand() {
+ srand(static_cast(time(NULL)));
+ WheelsCommand wheelsCommand;
+
+ wheelsCommand.leftVel = (rand() % MAX_RANDOM_WHEEL_COMMAND) * (rand()%2 == 0 ? -1 : 1);
+ wheelsCommand.rightVel = (rand() % MAX_RANDOM_WHEEL_COMMAND) * (rand()%2 == 0 ? -1 : 1);
+
+ return wheelsCommand;
+ }
+
+ Command createRandomCommand() {
+ srand(static_cast(time(NULL)));
+ Command command;
+
+ auto size = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+
+ for(unsigned int i = 0 ; i < size ; i++){
+ command.commands.push_back(createRandomWheelsCommand());
+ }
+
+ return command;
+ }
+
+ Debug createRandomDebug() {
+ srand(static_cast(time(NULL)));
+ Debug debug;
+
+ auto robotsAmount = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+
+ for(unsigned int i = 0 ; i < robotsAmount ; i++){
+ debug.stepPoints.push_back(createRandomPoint());
+ debug.finalPoses.push_back(createRandomPose());
+ debug.paths.push_back(createRandomPath());
+ }
+
+ return debug;
+ }
+
+ Control createRandomControl() {
+ srand(static_cast(time(NULL)));
+ Control control;
+
+ control.paused = (rand()%2 == 0);
+ control.ball = createRandomBall();
+
+ auto robotsAmount = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+
+ for(unsigned int i = 0 ; i < robotsAmount ; i++){
+ control.teamYellow.push_back(createRandomRobot());
+ control.teamBlue.push_back(createRandomRobot());
+ }
+
+ return control;
+ }
+
+ Address createRandomAddress() {
+ srand(static_cast(time(NULL)));
+ std::stringstream ss;
+
+ ss << (rand() % MAX_RANDOM_IP_VALUE) << "." << (rand() % MAX_RANDOM_IP_VALUE) << "." << (rand() % MAX_RANDOM_IP_VALUE) << "." << (rand() % MAX_RANDOM_IP_VALUE);
+
+ return Address(ss.str(), (rand() % MAX_RANDOM_PORT_VALUE));
+ }
+
+ vss_command::Robot_Command createRandomRobotCommand(){
+ vss_command::Robot_Command robotCommand;
+
+ robotCommand.set_left_vel((rand() % MAX_RANDOM_WHEEL_COMMAND) * (rand()%2 == 0 ? -1 : 1));
+ robotCommand.set_right_vel((rand() % MAX_RANDOM_WHEEL_COMMAND) * (rand()%2 == 0 ? -1 : 1));
+
+ return robotCommand;
+ }
+
+ vss_command::Global_Commands createRandomGlobalCommands(){
+ srand(static_cast(time(NULL)));
+ vss_command::Global_Commands globalCommands;
+
+ auto size = static_cast(rand() % MAX_RANDOM_TEAM_SIZE);
+
+ for(unsigned int i = 0 ; i < size ; i++){
+ auto robot_command = globalCommands.add_robot_commands();
+ *robot_command = createRandomRobotCommand();
+ }
+
+ return globalCommands;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Helpers/Math.cpp b/vss-simulator/VSS-Core/src/Helpers/Math.cpp
new file mode 100644
index 0000000..41d1569
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/Math.cpp
@@ -0,0 +1,26 @@
+//
+// Created by johnathan on 31/05/18.
+//
+
+#include
+#include "Helpers/Math.h"
+
+namespace vss {
+
+ namespace Math {
+
+ float distance( const vss::Point &t1, const vss::Point &t2 ){
+ return std::sqrt(((t1.x - t2.x) * (t1.x - t2.x)) + ((t1.y - t2.y) * (t1.y - t2.y)));
+ }
+
+ float angleBetween(const vss::Point &t1, const vss::Point &t2) {
+ return static_cast(std::atan2(t2.x - t1.x, t2.y - t1.y) * (180.0 / M_PI));
+ }
+
+ float radianBetween(const vss::Point &t1, const vss::Point &t2) {
+ return static_cast(std::atan2(t2.x - t1.x, t2.y - t1.y));
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Helpers/StateMapper.cpp b/vss-simulator/VSS-Core/src/Helpers/StateMapper.cpp
new file mode 100644
index 0000000..0b5a512
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Helpers/StateMapper.cpp
@@ -0,0 +1,92 @@
+//
+// Created by johnathan on 27/05/18.
+//
+
+#include "Helpers/StateMapper.h"
+
+namespace vss {
+
+ namespace StateMapper {
+
+ State globalStateToState(vss_state::Global_State _globalState){
+ State state;
+
+ state.ball = ballStateToBall(_globalState.balls(0));
+
+ for (int i = 0; i < _globalState.robots_blue_size(); i++) {
+ state.teamBlue.push_back(robotStateToRobot(_globalState.robots_blue(i)));
+ }
+
+ for (int i = 0; i < _globalState.robots_yellow_size(); i++) {
+ state.teamYellow.push_back(robotStateToRobot(_globalState.robots_yellow(i)));
+ }
+
+ return state;
+ }
+
+ Robot robotStateToRobot(vss_state::Robot_State robot_state) {
+ Robot robot;
+
+ robot.x = robot_state.pose().x();
+ robot.y = robot_state.pose().y();
+ robot.angle = robot_state.pose().yaw();
+
+ robot.speedX = robot_state.v_pose().x();
+ robot.speedY = robot_state.v_pose().y();
+ robot.speedAngle = robot_state.v_pose().yaw();
+
+ return robot;
+ }
+
+ Ball ballStateToBall(vss_state::Ball_State ball_state) {
+ Ball ball;
+
+ ball.x = ball_state.pose().x();
+ ball.y = ball_state.pose().y();
+
+ ball.speedX = ball_state.v_pose().x();
+ ball.speedY = ball_state.v_pose().y();
+
+ return ball;
+ }
+
+ vss_state::Global_State stateToGlobalState(State state){
+ vss_state::Global_State globalState;
+
+ auto ball = globalState.add_balls();
+ setupBallState(ball, state.ball);
+
+ for(unsigned int i = 0 ; i < state.teamYellow.size() ; i++){
+ auto robot = globalState.add_robots_yellow();
+ setupRobotState(robot, state.teamYellow[i]);
+ }
+
+ for(unsigned int i = 0 ; i < state.teamBlue.size() ; i++){
+ auto robot = globalState.add_robots_blue();
+ setupRobotState(robot, state.teamBlue[i]);
+ }
+
+ return globalState;
+ }
+
+ void setupRobotState(vss_state::Robot_State *robotState, Robot robot){
+ robotState->mutable_pose()->set_x(robot.x);
+ robotState->mutable_pose()->set_y(robot.y);
+ robotState->mutable_pose()->set_yaw(robot.angle);
+
+ robotState->mutable_v_pose()->set_x(robot.speedX);
+ robotState->mutable_v_pose()->set_y(robot.speedY);
+ robotState->mutable_v_pose()->set_yaw(robot.speedAngle);
+ }
+
+ void setupBallState(vss_state::Ball_State *ballState, Ball ball){
+ ballState->mutable_pose()->set_x(ball.x);
+ ballState->mutable_pose()->set_y(ball.y);
+
+ ballState->mutable_v_pose()->set_x(ball.speedX);
+ ballState->mutable_v_pose()->set_y(ball.speedY);
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/src/Interpreters/StdinInterpreter.cpp b/vss-simulator/VSS-Core/src/Interpreters/StdinInterpreter.cpp
new file mode 100644
index 0000000..2100015
--- /dev/null
+++ b/vss-simulator/VSS-Core/src/Interpreters/StdinInterpreter.cpp
@@ -0,0 +1,223 @@
+//
+// Created by johnathan on 01/07/18.
+//
+
+#include
+#include
+#include
+#include
+
+namespace vss {
+
+ StdinInterpreter::StdinInterpreter() {
+ onStateRecvAddr = false;
+
+ onYellowCmdSendAddr = false;
+ onYellowDebugSendAddr = false;
+
+ onBlueCmdSendAddr = false;
+ onBlueDebugSendAddr = false;
+
+ onCtrlRecvAddr = false;
+
+ onStatePort = false;
+ onYellowCmdPort = false;
+ onYellowDebugPort = false;
+ onBlueCmdPort = false;
+ onBlueDebugPort = false;
+ onCtrlPort = false;
+
+ onTeamType = false;
+ onSideAttackType = false;
+ onTimeExecutionType = false;
+ onEnvironmentType = false;
+ onDurationType = false;
+ onMatchFinishType = false;
+
+ onTeamInitialPositionPath = false;
+
+ stdinConfiguration.isValidConfiguration = false;
+ }
+
+ ExecutionConfig StdinInterpreter::extractExecutionConfig(int argc, char **argv) {
+ try
+ {
+ auto desc = buildOptions();
+
+ boost::program_options::variables_map vm;
+ store(parse_command_line(argc, argv, desc), vm);
+ notify(vm);
+
+ if (vm.count("help")){
+ std::cout << desc << '\n';
+ return stdinConfiguration;
+ }
+
+ buildConfiguration(vm);
+
+ return stdinConfiguration;
+ }
+ catch (const boost::program_options::error &ex)
+ {
+ std::cerr << ex.what() << '\n';
+ }
+
+
+ return stdinConfiguration;
+ }
+
+ boost::program_options::options_description StdinInterpreter::buildOptions() {
+ boost::program_options::options_description desc{"Options"};
+
+ desc.add_options()("help,h", "");
+
+ // ADDRESS
+ if(onStateRecvAddr)
+ desc.add_options()("state_recv_addr", boost::program_options::value()->default_value(DEFAULT_STATE_RECV_ADDR), "");
+
+ if(onYellowCmdSendAddr)
+ desc.add_options()("yellow_cmd_send_addr", boost::program_options::value()->default_value(DEFAULT_CMD_SEND_ADDR), "");
+
+ if(onYellowDebugSendAddr)
+ desc.add_options()("yellow_debug_send_addr", boost::program_options::value()->default_value(DEFAULT_DEBUG_SEND_ADDR), "");
+
+ if(onBlueCmdSendAddr)
+ desc.add_options()("blue_cmd_send_addr", boost::program_options::value()->default_value(DEFAULT_CMD_SEND_ADDR), "");
+
+ if(onBlueDebugSendAddr)
+ desc.add_options()("blue_debug_send_addr", boost::program_options::value()->default_value(DEFAULT_DEBUG_SEND_ADDR), "");
+
+ if(onCtrlRecvAddr)
+ desc.add_options()("ctrl_recv_addr", boost::program_options::value()->default_value(DEFAULT_CTRL_RECV_ADDR), "");
+
+
+ // PORTS
+ if(onStatePort)
+ desc.add_options()("state_port", boost::program_options::value()->default_value(DEFAULT_STATE_PORT), "");
+
+ if(onYellowCmdPort)
+ desc.add_options()("yellow_cmd_port", boost::program_options::value()->default_value(DEFAULT_CMD_YELLOW_PORT), "");
+
+ if(onBlueCmdPort)
+ desc.add_options()("blue_cmd_port", boost::program_options::value()->default_value(DEFAULT_CMD_BLUE_PORT), "");
+
+ if(onYellowDebugPort)
+ desc.add_options()("yellow_debug_port", boost::program_options::value()->default_value(DEFAULT_DEBUG_YELLOW_PORT), "");
+
+ if(onBlueDebugPort)
+ desc.add_options()("blue_debug_port", boost::program_options::value()->default_value(DEFAULT_DEBUG_BLUE_PORT), "");
+
+ if(onCtrlPort)
+ desc.add_options()("ctrl_port", boost::program_options::value()->default_value(DEFAULT_CTRL_PORT), "");
+
+
+ // Types
+ if(onTeamType)
+ desc.add_options()("team_type", boost::program_options::value()->default_value(toDescription(DEFAULT_TEAM_TYPE)), "");
+
+ if(onSideAttackType)
+ desc.add_options()("side_attack_type", boost::program_options::value()->default_value(toDescription(DEFAULT_SIDE_ATTACK_TYPE)), "");
+
+ if(onTimeExecutionType)
+ desc.add_options()("time_execution_type", boost::program_options::value()->default_value(toDescription(DEFAULT_TIME_EXECUTION_TYPE)), "");
+
+ if(onEnvironmentType)
+ desc.add_options()("environment_type", boost::program_options::value()->default_value(toDescription(DEFAULT_ENVIRONMENT_TYPE)), "");
+
+ if(onDurationType)
+ desc.add_options()("duration_type", boost::program_options::value()->default_value(toDescription(DEFAULT_DURATION_TYPE)), "");
+
+ if(onMatchFinishType)
+ desc.add_options()("match_finish_type", boost::program_options::value()->default_value(toDescription(DEFAULT_MATCH_FINISH_TYPE)), "");
+
+
+ // Others
+ if(onTeamInitialPositionPath)
+ desc.add_options()("initial_position_path", boost::program_options::value()->default_value("file.csv"), "");
+
+
+ return desc;
+ }
+
+ void StdinInterpreter::buildConfiguration(boost::program_options::variables_map vm) {
+ // ADDRESS
+ if(vm.count("state_recv_addr"))
+ stdinConfiguration.stateRecvAddr.setIp(vm["state_recv_addr"].as());
+
+ if(vm.count("yellow_cmd_send_addr"))
+ stdinConfiguration.cmdYellowSendAddr.setIp(vm["yellow_cmd_send_addr"].as());
+
+ if(vm.count("yellow_debug_send_addr"))
+ stdinConfiguration.debugYellowSendAddr.setIp(vm["yellow_debug_send_addr"].as());
+
+ if(vm.count("blue_cmd_send_addr"))
+ stdinConfiguration.cmdBlueSendAddr.setIp(vm["blue_cmd_send_addr"].as());
+
+ if(vm.count("blue_debug_send_addr"))
+ stdinConfiguration.debugBlueSendAddr.setIp(vm["blue_debug_send_addr"].as());
+
+ if(vm.count("ctrl_recv_addr"))
+ stdinConfiguration.ctrlRecvAddr.setIp(vm["ctrl_recv_addr"].as());
+
+
+ // PORTS
+ if(vm.count("state_port")){
+ stdinConfiguration.stateSendAddr.setPort(vm["state_port"].as());
+ stdinConfiguration.stateRecvAddr.setPort(vm["state_port"].as());
+ }
+
+ if(vm.count("yellow_cmd_port")){
+ stdinConfiguration.cmdYellowSendAddr.setPort(vm["yellow_cmd_port"].as());
+ stdinConfiguration.cmdYellowRecvAddr.setPort(vm["yellow_cmd_port"].as());
+ }
+
+ if(vm.count("blue_cmd_port")){
+ stdinConfiguration.cmdBlueSendAddr.setPort(vm["blue_cmd_port"].as());
+ stdinConfiguration.cmdBlueRecvAddr.setPort(vm["blue_cmd_port"].as());
+ }
+
+ if(vm.count("yellow_debug_port")){
+ stdinConfiguration.debugYellowSendAddr.setPort(vm["yellow_debug_port"].as());
+ stdinConfiguration.debugYellowRecvAddr.setPort(vm["yellow_debug_port"].as());
+ }
+
+ if(vm.count("blue_debug_port")){
+ stdinConfiguration.debugBlueSendAddr.setPort(vm["blue_debug_port"].as());
+ stdinConfiguration.debugBlueRecvAddr.setPort(vm["blue_debug_port"].as());
+ }
+
+ if(vm.count("ctrl_port")){
+ stdinConfiguration.ctrlSendAddr.setPort(vm["ctrl_port"].as());
+ stdinConfiguration.ctrlRecvAddr.setPort(vm["ctrl_port"].as());
+ }
+
+
+ // TYPES
+ if(vm.count("team_type"))
+ stdinConfiguration.teamType = toTeamType(vm["team_type"].as());
+
+ if(vm.count("side_attack_type"))
+ stdinConfiguration.sideAttackType = toSideAttackType(vm["side_attack_type"].as());
+
+ if(vm.count("time_execution_type"))
+ stdinConfiguration.timeExecutionType = toTimeExecutionType(vm["time_execution_type"].as());
+
+ if(vm.count("environment_type"))
+ stdinConfiguration.environmentType = toEnvironmentType(vm["environment_type"].as());
+
+ if(vm.count("duration_type"))
+ stdinConfiguration.durationType = toDurationType(vm["duration_type"].as());
+
+ if(vm.count("match_finish_type"))
+ stdinConfiguration.matchFinishType = toMatchFinishType(vm["match_finish_type"].as());
+
+
+ // OTHERS
+ if(vm.count("initial_position_path"))
+ stdinConfiguration.teamInitialPositionPath = vm["initial_position_path"].as();
+
+
+ stdinConfiguration.isValidConfiguration = true;
+ }
+
+};
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/test/Builders/StdinInterpreterBuilderTests.cpp b/vss-simulator/VSS-Core/test/Builders/StdinInterpreterBuilderTests.cpp
new file mode 100644
index 0000000..f6e4b09
--- /dev/null
+++ b/vss-simulator/VSS-Core/test/Builders/StdinInterpreterBuilderTests.cpp
@@ -0,0 +1,239 @@
+//
+// Created by johnathan on 03/07/18.
+//
+
+#include
+#include
+
+TEST(StdinInterpreterBuilder_buildInterpreter, ShouldReturnAllFalse){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto stdinInterpreter = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_FALSE(stdinInterpreter->onStateRecvAddr);
+
+ EXPECT_FALSE(stdinInterpreter->onYellowCmdSendAddr);
+ EXPECT_FALSE(stdinInterpreter->onYellowDebugSendAddr);
+
+ EXPECT_FALSE(stdinInterpreter->onBlueCmdSendAddr);
+ EXPECT_FALSE(stdinInterpreter->onBlueDebugSendAddr);
+
+ EXPECT_FALSE(stdinInterpreter->onCtrlRecvAddr);
+
+ EXPECT_FALSE(stdinInterpreter->onStatePort);
+ EXPECT_FALSE(stdinInterpreter->onYellowCmdPort);
+ EXPECT_FALSE(stdinInterpreter->onYellowDebugPort);
+ EXPECT_FALSE(stdinInterpreter->onBlueCmdPort);
+ EXPECT_FALSE(stdinInterpreter->onBlueDebugPort);
+ EXPECT_FALSE(stdinInterpreter->onCtrlPort);
+
+ EXPECT_FALSE(stdinInterpreter->onTeamType);
+ EXPECT_FALSE(stdinInterpreter->onSideAttackType);
+ EXPECT_FALSE(stdinInterpreter->onTimeExecutionType);
+ EXPECT_FALSE(stdinInterpreter->onEnvironmentType);
+ EXPECT_FALSE(stdinInterpreter->onDurationType);
+ EXPECT_FALSE(stdinInterpreter->onMatchFinishType);
+
+ EXPECT_FALSE(stdinInterpreter->onTeamInitialPositionPath);
+}
+
+TEST(StdinInterpreterBuilder_onStateRecvAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onStateRecvAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onStateRecvAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onStateRecvAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onYellowCmdSendAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onYellowCmdSendAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onYellowCmdSendAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onYellowCmdSendAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onYellowDebugSendAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onYellowDebugSendAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onYellowDebugSendAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onYellowDebugSendAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onBlueCmdSendAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onBlueCmdSendAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onBlueCmdSendAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onBlueCmdSendAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onBlueDebugSendAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onBlueDebugSendAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onBlueDebugSendAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onBlueDebugSendAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onCtrlRecvAddr, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onCtrlRecvAddr, false);
+
+ auto configured = stdinInterpreterBuilder.onCtrlRecvAddr()->buildInterpreter();
+ EXPECT_EQ(configured->onCtrlRecvAddr, true);
+}
+
+TEST(StdinInterpreterBuilder_onYellowCmdPort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onYellowCmdPort, false);
+
+ auto configured = stdinInterpreterBuilder.onYellowCmdPort()->buildInterpreter();
+ EXPECT_EQ(configured->onYellowCmdPort, true);
+}
+
+TEST(StdinInterpreterBuilder_onYellowDebugPort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onYellowDebugPort, false);
+
+ auto configured = stdinInterpreterBuilder.onYellowDebugPort()->buildInterpreter();
+ EXPECT_EQ(configured->onYellowDebugPort, true);
+}
+
+TEST(StdinInterpreterBuilder_onBlueCmdPort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onBlueCmdPort, false);
+
+ auto configured = stdinInterpreterBuilder.onBlueCmdPort()->buildInterpreter();
+ EXPECT_EQ(configured->onBlueCmdPort, true);
+}
+
+TEST(StdinInterpreterBuilder_onBlueDebugPort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onBlueDebugPort, false);
+
+ auto configured = stdinInterpreterBuilder.onBlueDebugPort()->buildInterpreter();
+ EXPECT_EQ(configured->onBlueDebugPort, true);
+}
+
+TEST(StdinInterpreterBuilder_onCtrlPort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onCtrlPort, false);
+
+ auto configured = stdinInterpreterBuilder.onCtrlPort()->buildInterpreter();
+ EXPECT_EQ(configured->onCtrlPort, true);
+}
+
+TEST(StdinInterpreterBuilder_onTeamType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onTeamType, false);
+
+ auto configured = stdinInterpreterBuilder.onTeamType()->buildInterpreter();
+ EXPECT_EQ(configured->onTeamType, true);
+}
+
+TEST(StdinInterpreterBuilder_onSideAttackType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onSideAttackType, false);
+
+ auto configured = stdinInterpreterBuilder.onSideAttackType()->buildInterpreter();
+ EXPECT_EQ(configured->onSideAttackType, true);
+}
+
+TEST(StdinInterpreterBuilder_onTimeExecutionType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onTimeExecutionType, false);
+
+ auto configured = stdinInterpreterBuilder.onTimeExecutionType()->buildInterpreter();
+ EXPECT_EQ(configured->onTimeExecutionType, true);
+}
+
+TEST(StdinInterpreterBuilder_onDurationType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onDurationType, false);
+
+ auto configured = stdinInterpreterBuilder.onDurationType()->buildInterpreter();
+ EXPECT_EQ(configured->onDurationType, true);
+}
+
+TEST(StdinInterpreterBuilder_onMatchFinishType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onMatchFinishType, false);
+
+ auto configured = stdinInterpreterBuilder.onMatchFinishType()->buildInterpreter();
+ EXPECT_EQ(configured->onMatchFinishType, true);
+}
+
+TEST(StdinInterpreterBuilder_onTeamInitialPositionPath, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onTeamInitialPositionPath, false);
+
+ auto configured = stdinInterpreterBuilder.onTeamInitialPositionPath()->buildInterpreter();
+ EXPECT_EQ(configured->onTeamInitialPositionPath, true);
+}
+
+TEST(StdinInterpreterBuilder_onStatePort, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onStatePort, false);
+
+ auto configured = stdinInterpreterBuilder.onStatePort()->buildInterpreter();
+ EXPECT_EQ(configured->onStatePort, true);
+}
+
+TEST(StdinInterpreterBuilder_onEnvironmentType, ShouldReturnThisAndSetValue){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onEnvironmentType, false);
+
+ auto configured = stdinInterpreterBuilder.onEnvironmentType()->buildInterpreter();
+ EXPECT_EQ(configured->onEnvironmentType, true);
+}
+
+TEST(StdinInterpreterBuilder_TwoFluents, ShouldReturnThisAndSetValues){
+ vss::StdinInterpreterBuilder stdinInterpreterBuilder;
+
+ auto raw = stdinInterpreterBuilder.buildInterpreter();
+ EXPECT_EQ(raw->onEnvironmentType, false);
+ EXPECT_EQ(raw->onStatePort, false);
+
+ auto configured = stdinInterpreterBuilder.onStatePort()->onEnvironmentType()->buildInterpreter();
+ EXPECT_EQ(configured->onEnvironmentType, true);
+ EXPECT_EQ(configured->onStatePort, true);
+}
\ No newline at end of file
diff --git a/vss-simulator/VSS-Core/test/Domain/AddressTests.cpp b/vss-simulator/VSS-Core/test/Domain/AddressTests.cpp
new file mode 100644
index 0000000..560e215
--- /dev/null
+++ b/vss-simulator/VSS-Core/test/Domain/AddressTests.cpp
@@ -0,0 +1,38 @@
+//
+// Created by johnathan on 03/07/18.
+//
+
+#include
+#include