Skip to content

Commit

Permalink
feat(PositionProcessing): Change pattern detection and robot id calcu…
Browse files Browse the repository at this point in the history
…late (robocin#36)

* fix(PositionProcessing): removes old pattern detection

* wip: prints

* feat(videos): add new static video

* feat(PositionProcessing): add new robot id detection

* fix(RobotWidget): remove "gambiarra"

* fix(server): remove "gambiarra" id

* feat(PositionProcessing): Add old pattern detection possibility

* Revert "Merge branch 'new-pattern' into first-version"

This reverts commit 040de64.

* feat(Videos): add new video

* fix(RobotWidget): fix robot color at interface

* feat(PositionProcessing): add new filter for pattern detection

* fix(RobotWidget): adjusting color ids order

* fix(PositionProcessing): regions with less than three blobs skipped

* fix(Receiver): Multicast configuration

* fix(PositionProcessing): adjusting robot id (pink,green)

* fix(PositionProcessing): Checking valid id

* chore(videos): adding new tag pattern videos

* refactor(RobotWidget): update pattern draw

* refactor(PositionProcessing): update findTeam

* [wip] fix filterPattern

* [wip] fix id

* feat(PositionProcessing): add kalman filter

* fix(RobotWiget): adjust pattern draw

---------

Co-authored-by: acrucha <[email protected]>
  • Loading branch information
ersaraujo and acrucha authored Sep 7, 2023
1 parent 78b6461 commit 5d6d9a9
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 150 deletions.
10 changes: 4 additions & 6 deletions client/python/receiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ def __init__(self,
self.vision_ip = vision_ip
self.vision_port = vision_port

self.vision_sock = socket.socket(
socket.AF_INET, socket.SOCK_DGRAM)
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.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 128)
self.vision_sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_LOOP, 1)
self.vision_sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, struct.pack("=4sl", socket.inet_aton(self.vision_ip), socket.INADDR_ANY))
self.vision_sock.bind((self.vision_ip, self.vision_port))

# self.vision_sock.setblocking(True)
Expand Down
8 changes: 4 additions & 4 deletions src/Config/PositionProcessing.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0"?>
<opencv_storage>
<Default>
<minSize>95</minSize>
<maxSize>1000</maxSize>
<minSizeBall>784</minSizeBall>
<minSize>18</minSize>
<maxSize>760</maxSize>
<minSizeBall>52</minSizeBall>
<maxSizeBall>733</maxSizeBall>
<blobMaxDist>100</blobMaxDist>
<blobMaxDist>500</blobMaxDist>
<myTeam>2</myTeam>
<enemyTeam>3</enemyTeam>
<enemySearch>0</enemySearch>
Expand Down
6 changes: 3 additions & 3 deletions src/Config/Segmentation/MaggicSegmentation.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Maggic
17 45
45
30 216
53
-1 4
7 1
43 3
97 5
140 7
168 2
151 2
235 6
2 changes: 1 addition & 1 deletion src/Config/Video.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<opencv_storage>
<VIDEO_URL>/workspaces/vss-vision/videos/static5v5.mp4</VIDEO_URL>
<VIDEO_URL>/home/robocin_vss/Videos/grav3.mp4</VIDEO_URL>
</opencv_storage>
4 changes: 2 additions & 2 deletions src/Network/visionServer/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void VisionServer::send(std::vector<Entity> &entities) {
} else{
if((int)entities[i].team() == Color::YELLOW){
SSL_DetectionRobot *robot = frame->mutable_robots_yellow()->Add();
robot->set_robot_id(entities[i].id()-200);
robot->set_robot_id(entities[i].id());
robot->set_x(entities[i].position().x * 10);
robot->set_y(entities[i].position().y * 10);
robot->set_orientation(entities[i].angle());
Expand All @@ -52,7 +52,7 @@ void VisionServer::send(std::vector<Entity> &entities) {
robot->set_pixel_y(robot->y()*100);
}else if((int)entities[i].team() == Color::BLUE){
SSL_DetectionRobot *robot = frame->mutable_robots_blue()->Add();
robot->set_robot_id(entities[i].id()-100);
robot->set_robot_id(entities[i].id());
robot->set_x(entities[i].position().x * 10);
robot->set_y(entities[i].position().y * 10);
robot->set_orientation(entities[i].angle());
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ double Utils::double_dif(double x, double y) {
return ((x-y)*(x-y));
}

double Utils::euclideanDistance(cv::Point alfa, cv::Point beta) {
return sqrt((pow(alfa.x - beta.x, 2) + pow(alfa.y - beta.y, 2)));
double Utils::sumOfSquares(cv::Point alfa, cv::Point beta) {
return (pow(alfa.x - beta.x, 2) + pow(alfa.y - beta.y, 2));
}

double Utils::angle(cv::Point alfa,cv::Point beta) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Utils {
*
* @return Sum of squares between the two points
*/
double euclideanDistance(cv::Point alfa, cv::Point beta);
double sumOfSquares(cv::Point alfa, cv::Point beta);

/**
* @brief Return the ajusted angle
Expand Down
1 change: 0 additions & 1 deletion src/Vision/PositionProcessing/BlobDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void BlobDetection::findBlobs(cv::Mat& debugFrame) {
blob[i][j].valid = false;
blob[i][j].position = cv::Point(0,0);
blob[i][j].area = 0;
blob[i][j].distance = INT_MAX;
}
}

Expand Down
Loading

0 comments on commit 5d6d9a9

Please sign in to comment.