Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Protobuf): creates protobuf packets, protobuf files generator and paths include in cmake, receiver code for tests, #27

Merged
merged 34 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4e76827
added protobuf v0
bmmuc Feb 4, 2023
6a5ccf4
fix: undefined reference
ersaraujo Feb 8, 2023
d44985e
wip
ersaraujo Feb 8, 2023
f38c2a5
fix: add Protobuf package on CMakeLists.txt
joseviccruz Feb 8, 2023
a5c9d79
feat(protobuf): created protobuf packet
ersaraujo Feb 15, 2023
206bd48
fix (protobuf): fix cm to mm
bmmuc Feb 15, 2023
311b7d3
Merge branch 'change-origin' into add_protobuf
bmmuc Feb 15, 2023
494e167
fix field packet
ersaraujo Feb 17, 2023
5f8e3dc
fix entities vector
ersaraujo Feb 17, 2023
1ebbc67
wip
ersaraujo Feb 19, 2023
19232eb
Fix protobuf generation
joseviccruz Feb 19, 2023
f375a92
fix entities
ersaraujo Feb 19, 2023
9cc053b
removed unnecessary prints and comments
ersaraujo Feb 20, 2023
1f7c46c
Update docker_run
ersaraujo Feb 22, 2023
3287eb4
adjust server.h
ersaraujo Feb 22, 2023
6109ba2
fix(server): fix team check
ersaraujo Feb 22, 2023
9434c98
added dependecies
ersaraujo Feb 22, 2023
502dd56
added args for cam
ersaraujo Feb 22, 2023
f6fc0cb
removes changes
ersaraujo Feb 22, 2023
72e61a4
Update src/Network/visionServer/server.h
ersaraujo Feb 22, 2023
7034fae
removes unnecessary files
ersaraujo Feb 22, 2023
0fb4a21
include protobuf generation
ersaraujo Feb 22, 2023
1b2eb38
Update src/Network/visionServer/server.cpp
ersaraujo Feb 22, 2023
eb4f8d8
fixed devconatiner
ersaraujo Feb 22, 2023
1f2a4cc
adding .cache in gitignore
ersaraujo Feb 22, 2023
ee8c9bc
Merge branch 'add_protobuf' of github.com:robocin/vss-vision into add…
ersaraujo Feb 22, 2023
f1e90b6
Update multicast ip
ersaraujo Feb 22, 2023
49d5b86
update dependencies
ersaraujo Feb 22, 2023
5b54a21
add cmake extension to devcontainer
FelipeMartins96 Feb 16, 2023
2b941e7
remove useless and buggy position processing
FelipeMartins96 Feb 16, 2023
d2c7863
remove bug for findEnemies which was removed on previous commit
FelipeMartins96 Feb 16, 2023
38750f5
update missed origin translation conversion values
FelipeMartins96 Feb 16, 2023
4edfb9a
wip
bmmuc Feb 22, 2023
41c76e8
Update client/python/receiver.py
ersaraujo Feb 23, 2023
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 .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \

# [Optional] Uncomment this section to install additional packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends qt5-default libsfml-dev libopencv-dev freeglut3-dev
&& apt-get -y install --no-install-recommends qt5-default libsfml-dev libopencv-dev freeglut3-dev protobuf-compiler libprotobuf-dev
ersaraujo marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},

"runArgs": [
"--device=/dev:/dev/video0",
"-e", "DISPLAY=${env:DISPLAY}",
"-v", "/tmp/.X11-unix:/tmp/.X11-unix",
"--network=host"
Expand All @@ -26,7 +27,8 @@
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools-extension-pack"
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cmake-tools"
],
"settings": {
"C_Cpp.default.includePath": ["${workspaceFolder}/**"],
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ src/Utils/dest.txt
build/
bin/
*avi
.cache/

#All logging files (including rotative)
src/Log/*
Expand Down
31 changes: 22 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/src")


set(SOURCES
src/main.cpp
src/Utils/Utils.cpp
Expand Down Expand Up @@ -48,6 +47,7 @@ set(SOURCES
src/Windows/RobotWidget.cpp
src/trackconfigdialog.cpp
src/Network/Network.cpp
src/Network/visionServer/server.cpp
)

set(HEADERS
Expand Down Expand Up @@ -90,26 +90,39 @@ set(HEADERS
src/trackconfigdialog.h
src/Windows/FileConstants.h
src/Network/Network.h
src/Network/visionServer/server.h
)

set(RESOURCES
src/image.qrc
src/iconTools/icontools.qrc
)

add_executable(VSS-VISION ${SOURCES} ${HEADERS} ${RESOURCES})
set(PROTOS
src/Network/protobuf/proto/messages_robocup_ssl_detection.proto
src/Network/protobuf/proto/messages_robocup_ssl_geometry.proto
src/Network/protobuf/proto/wrapper.proto
)

find_package(Protobuf REQUIRED)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTOS})

target_include_directories(VSS-VISION PUBLIC "${PROJECT_SOURCE_DIR}/src")
target_include_directories(VSS-VISION PUBLIC "${PROJECT_SOURCE_DIR}/include")
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${RESOURCES} ${PROTO_SRCS} ${PROTO_HDRS})

find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui)
target_link_libraries(VSS-VISION Qt5::Core Qt5::Widgets Qt5::Gui)
target_include_directories(${PROJECT_NAME} PUBLIC "${PROJECT_SOURCE_DIR}/src")
target_include_directories(${PROJECT_NAME} PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets Qt5::Gui Qt5::Network)

find_package(OpenCV REQUIRED)
target_link_libraries(VSS-VISION ${OpenCV_LIBS})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})

find_package(TBB REQUIRED)
target_link_libraries(VSS-VISION TBB::tbb)
target_link_libraries(${PROJECT_NAME} TBB::tbb)

find_package(SFML REQUIRED COMPONENTS network system)
target_link_libraries(VSS-VISION sfml-network sfml-system)
target_link_libraries(${PROJECT_NAME} sfml-network sfml-system)

target_link_libraries(${PROJECT_NAME} ${Protobuf_LIBRARIES})
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
libsfml-dev \
libopencv-dev \
freeglut3-dev \
protobuf-compiler \
libprotobuf-dev \
ersaraujo marked this conversation as resolved.
Show resolved Hide resolved
cmake

COPY . /opt/vss-vision

WORKDIR /opt/vss-vision/build

RUN cmake clean .. && make -j4
RUN cmake clean .. -Wno-dev && make -j4

WORKDIR /opt/vss-vision/src

Expand Down
6 changes: 5 additions & 1 deletion InstallDependencies
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ sudo apt install libopencv-dev -y
sudo apt install freeglut3-dev -y

# Install QT5
sudo apt install qt5-default -y
sudo apt install qt5-default -y

# Intall Protobuf
sudo apt install libprotobuf -y
sudo apt install protobuf-compiler -y
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Qt5
OpenCV
SFML
TBB
Protobuf
```
## Running with docker
1. Build the vss-vision image using the shell script
Expand Down
57 changes: 57 additions & 0 deletions client/python/receiver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import socket
import struct
from time import time
import wrapper_pb2 as wr

class FiraClient:

def __init__(self,
vision_ip="224.5.23.2",
vision_port=10015):
"""
Init SSLClient object.
Extended description of function.
Parameters
----------
vision_ip : str
Multicast Vision IP in format '255.255.255.255'.
vision_port : int
Vision Port up to 1024.
"""

self.vision_ip = vision_ip
self.vision_port = vision_port

self.vision_sock = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
self.vision_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.vision_sock.setsockopt(socket.IPPROTO_IP,
socket.IP_MULTICAST_TTL, 128)
self.vision_sock.setsockopt(socket.IPPROTO_IP,
socket.IP_MULTICAST_LOOP, 1)
self.vision_sock.bind((self.vision_ip, self.vision_port))

# self.vision_sock.setblocking(True)
self.frame = None
self.det_frame = None

def receive_frame(self):
"""Receive package and decode."""
data = None
while True:
try:
data, _ = self.vision_sock.recvfrom(1024)
except Exception as e:
print(e)
if data != None:
break

if data != None:
decoded_data = wr.SSL_WrapperPacket().FromString(data)
print(decoded_data)
# return self.frame, self.det_frame

a = FiraClient()
while(1):
a.receive_frame()

9 changes: 1 addition & 8 deletions docker_run
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ then
else
echo "setting camera /dev/video$1"
# Camera id argument supplied
docker run \
--rm \
--device=/dev/video$1:/dev/video0 \ # Mount camera device
-v vss-vision-config:/opt/vss-vision/src/Config \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
--network=host \
vss-vision
docker run --rm --device=/dev/video$1:/dev/video0 -v vss-vision-config:/opt/vss-vision/src/Config -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --network=host vss-vision
ersaraujo marked this conversation as resolved.
Show resolved Hide resolved
fi
xhost -
Loading