Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/pheromones
14 changes: 6 additions & 8 deletions src/visualisation_tool/DataUpdater.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import threading
import time

from Graph2D import Graph2D
from NeighborCoordinateTable import NeighborCoordinateTable
from PyQt5.QtCore import QObject, QThread, pyqtSignal, pyqtSlot
from src.visualisation_tool.Graph2D import Graph2D
from src.visualisation_tool.NeighborCoordinateTable import NeighborCoordinateTable
from PyQt5.QtCore import QObject, pyqtSignal
import numpy as np
import sys

sys.path.insert(0, "../hiveboard")
from HiveBoard import HiveBoard
from usb_stream import UsbStream
from proto import message_pb2
from proto.ethernet_stream import EthernetStream
from src.hiveboard.HiveBoard import HiveBoard
from src.hiveboard.usb_stream import UsbStream
from src.hiveboard.proto.ethernet_stream import EthernetStream

use_serial = True
COM_PORT = "/dev/ttyACM0"
Expand Down
6 changes: 3 additions & 3 deletions src/visualisation_tool/DummyHiveBoard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

sys.path.insert(0, "../hiveboard")

from proto.message_pb2 import Greeting, Message, InterlocState, UNSUPORTED, STANDBY, ANGLE_CALIB_RECEIVER
from src.hiveboard.proto.message_pb2 import Greeting, Message
from src.hiveboard.proto.message_pb2 import GetNeighborsListResponse, HiveMindHostApiResponse, Response, \
GetNeighborResponse, NeighborPosition
from src.hiveboard.proto.message_pb2 import GetNeighborsListRequest, GetNeighborRequest, HiveMindHostApiRequest, Request
from proto.proto_stream import ProtoStream
from src.hiveboard.proto.message_pb2 import Request
from src.hiveboard.proto.proto_stream import ProtoStream


class DummyHiveBoard(ProtoStream):
Expand Down
13 changes: 7 additions & 6 deletions src/visualisation_tool/Graph2D.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSlot
from pyqtgraph import PlotWidget, plot, GridItem, LegendItem
from pyqtgraph import GridItem
import pyqtgraph as pg

COLOR_OFFSET = 15
Expand All @@ -24,14 +24,15 @@ def create_2d_plot(self):
#self.graphWidget.setBackground("w")
self.graphWidget.hideAxis('bottom')
self.graphWidget.hideAxis('left')
self.graphWidget.setXRange(-7, 7)
self.graphWidget.setYRange(-7, 7)
self.graphWidget.setXRange(-5, 5)
self.graphWidget.setYRange(-5, 5)
self.graphWidget.setMouseEnabled(x=False, y=False)
self.graphWidget.addLegend()
self.graphWidget.addLegend(labelTextSize='24pt')
self.layout.addWidget(self.graphWidget)

def create_grid(self):
self.grid = GridItem(pen='white', textPen='white')
self.grid.setTickSpacing([1.0], [1.0])
self.graphWidget.addItem(self.grid)

def create_scatter_element(self):
Expand All @@ -40,7 +41,7 @@ def create_scatter_element(self):
'pen': {'color': 'w', 'width': 1},
'brush': pg.intColor(10, 100), # Orange
'symbol': 'd',
'size': 30}
'size': 50}
self.base.addPoints([base_symbol])
self.graphWidget.addItem(self.base)

Expand All @@ -57,7 +58,7 @@ def update_point(self, neighbor_id: int, x: float, y: float):
# 100 is the number int values for the color spectrum,
# COLOR_OFFSET is the offset to apply to have 6 different values for points
'brush': pg.intColor(neighbor_id * COLOR_OFFSET, 100),
'size': 20}
'size': 50}
self.scatters[neighbor_id]["scatter"].setData(spots=[self.scatters[neighbor_id]["spot"]],
name=f"Agent {neighbor_id}")

Expand Down
6 changes: 3 additions & 3 deletions src/visualisation_tool/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import time

from PyQt5.QtWidgets import *
from Graph2D import Graph2D
from src.visualisation_tool.Graph2D import Graph2D
from PyQt5.QtCore import QThread, pyqtSlot, Qt, pyqtSignal
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import numpy as np
from NeighborCoordinateTable import NeighborCoordinateTable
from DataUpdater import DataUpdater
from src.visualisation_tool.NeighborCoordinateTable import NeighborCoordinateTable
from src.visualisation_tool.DataUpdater import DataUpdater


class MainWindow(QMainWindow):
Expand Down
3 changes: 0 additions & 3 deletions src/visualisation_tool/NeighborCoordinateTable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from PyQt5.QtWidgets import QTableWidget, QTableWidgetItem, QSizePolicy
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QThread, QObject
from threading import Lock
import PyQt5
import sys


class NeighborCoordinateTableWorker(QObject):
Expand Down