Browse Source

Fixing main and viewer script.

master
Georgios Gerontakis 5 years ago
parent
commit
b9e098bfc5
  1. BIN
      camera module/__pycache__/servo.cpython-37.pyc
  2. 7
      camera module/main.py
  3. BIN
      tracking and telemetry/Client/.vs/Client/v16/.suo
  4. BIN
      tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide-shm
  5. BIN
      tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide-wal
  6. 34
      tracking and telemetry/Client/add_module.Designer.cs
  7. 10
      tracking and telemetry/Client/add_module.cs
  8. BIN
      tracking and telemetry/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  9. 3
      tracking and telemetry/viewer/README.md
  10. BIN
      tracking and telemetry/viewer/src/__pycache__/viewer.cpython-37.pyc
  11. 9
      tracking and telemetry/viewer/src/viewer.py
  12. BIN
      tracking and telemetry/viewer/viewer_exe/base_library.zip
  13. BIN
      tracking and telemetry/viewer/viewer_exe/viewer.exe

BIN
camera module/__pycache__/servo.cpython-37.pyc

Binary file not shown.

7
camera module/main.py

@ -4,7 +4,7 @@ import zmq
import servo import servo
# Constant variables definition. # Constant variables definition.
MAJOR_VERSION = cv2.getVersionMajor() MAJOR_VERSION = 3
SERVO_INITIAL_X_ANGLE = 90 # The initial horizontal angle of the camera. SERVO_INITIAL_X_ANGLE = 90 # The initial horizontal angle of the camera.
SERVO_INITIAL_Y_ANGLE = 90 # The initial vertical angle of the camera. SERVO_INITIAL_Y_ANGLE = 90 # The initial vertical angle of the camera.
SERVO_STEP_ANGLE = 5 # The angle at which the servo motors move each frame. SERVO_STEP_ANGLE = 5 # The angle at which the servo motors move each frame.
@ -149,15 +149,13 @@ while True:
footage_socket = context.socket(zmq.PUB) footage_socket = context.socket(zmq.PUB)
footage_socket.connect('tcp://' + client_ip.decode() + ':5555') footage_socket.connect('tcp://' + client_ip.decode() + ':5555')
#camera = cv2.VideoCapture(0) # init the camera
servoX = SERVO_INITIAL_X_ANGLE servoX = SERVO_INITIAL_X_ANGLE
servoY = SERVO_INITIAL_Y_ANGLE servoY = SERVO_INITIAL_Y_ANGLE
servo.SetAngleUp(servoY) servo.SetAngleUp(servoY)
servo.SetAngleDown(servoX) servo.SetAngleDown(servoX)
cap = cv2.VideoCapture('drone_test.mp4') cap = cv2.VideoCapture(0)
if (cap.isOpened() == False): if (cap.isOpened() == False):
print('Error opening stream.') print('Error opening stream.')
quit() quit()
@ -196,7 +194,6 @@ while (cap.isOpened()):
elif xDir == -1: elif xDir == -1:
servoX = servoX - SERVO_STEP_ANGLE servoX = servoX - SERVO_STEP_ANGLE
servo.SetAngleDown(servoX) servo.SetAngleDown(servoX)
else: else:
break break
except KeyboardInterrupt: except KeyboardInterrupt:

BIN
tracking and telemetry/Client/.vs/Client/v16/.suo

Binary file not shown.

BIN
tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide-shm

Binary file not shown.

BIN
tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide-wal

Binary file not shown.

34
tracking and telemetry/Client/add_module.Designer.cs

@ -34,12 +34,14 @@
this.txt_moduleIP = new System.Windows.Forms.TextBox(); this.txt_moduleIP = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.txt_hostIP = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
// //
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(12, 89); this.button1.Location = new System.Drawing.Point(12, 117);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(353, 40); this.button1.Size = new System.Drawing.Size(353, 40);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
@ -68,7 +70,7 @@
// txt_moduleIP // txt_moduleIP
// //
this.txt_moduleIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txt_moduleIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txt_moduleIP.Location = new System.Drawing.Point(168, 54); this.txt_moduleIP.Location = new System.Drawing.Point(168, 82);
this.txt_moduleIP.Name = "txt_moduleIP"; this.txt_moduleIP.Name = "txt_moduleIP";
this.txt_moduleIP.Size = new System.Drawing.Size(197, 29); this.txt_moduleIP.Size = new System.Drawing.Size(197, 29);
this.txt_moduleIP.TabIndex = 4; this.txt_moduleIP.TabIndex = 4;
@ -77,7 +79,7 @@
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(8, 54); this.label2.Location = new System.Drawing.Point(8, 82);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(154, 24); this.label2.Size = new System.Drawing.Size(154, 24);
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
@ -88,15 +90,35 @@
this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBox1.Location = new System.Drawing.Point(371, 9); this.richTextBox1.Location = new System.Drawing.Point(371, 9);
this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(472, 119); this.richTextBox1.Size = new System.Drawing.Size(472, 148);
this.richTextBox1.TabIndex = 7; this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = ""; this.richTextBox1.Text = "";
// //
// txt_hostIP
//
this.txt_hostIP.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txt_hostIP.Location = new System.Drawing.Point(168, 46);
this.txt_hostIP.Name = "txt_hostIP";
this.txt_hostIP.Size = new System.Drawing.Size(197, 29);
this.txt_hostIP.TabIndex = 9;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(34, 49);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(128, 24);
this.label3.TabIndex = 8;
this.label3.Text = "Host Address:";
//
// add_module // add_module
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(855, 134); this.ClientSize = new System.Drawing.Size(855, 169);
this.Controls.Add(this.txt_hostIP);
this.Controls.Add(this.label3);
this.Controls.Add(this.richTextBox1); this.Controls.Add(this.richTextBox1);
this.Controls.Add(this.txt_moduleIP); this.Controls.Add(this.txt_moduleIP);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@ -119,5 +141,7 @@
private System.Windows.Forms.TextBox txt_moduleIP; private System.Windows.Forms.TextBox txt_moduleIP;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.RichTextBox richTextBox1; private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.TextBox txt_hostIP;
private System.Windows.Forms.Label label3;
} }
} }

10
tracking and telemetry/Client/add_module.cs

@ -1,13 +1,6 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
namespace Client namespace Client
@ -42,7 +35,8 @@ namespace Client
try try
{ {
string viewer_path = System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\..\tracking and telemetry\viewer\viewer_exe\viewer.exe")); string viewer_path = System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\..\tracking and telemetry\viewer\viewer_exe\viewer.exe"));
var proc = System.Diagnostics.Process.Start(viewer_path,txt_moduleIP.Text); string args = txt_moduleIP.Text + " " + txt_hostIP;
var proc = Process.Start(viewer_path,args);
} }
catch (Exception ex) catch (Exception ex)
{ {

BIN
tracking and telemetry/Client/obj/Debug/DesignTimeResolveAssemblyReferences.cache

Binary file not shown.

3
tracking and telemetry/viewer/README.md

@ -1,3 +0,0 @@
# Talos_Drones_Tracking_and_Telemetry
![enter image description here](https://scontent.fath7-1.fna.fbcdn.net/v/t1.0-9/74674993_115153423241475_4772277731842850816_n.jpg?_nc_cat=103&_nc_ohc=fl0TAVjHIzoAQn0zfYrt0L-uHNcVjRjos4qpfN2RWaFryHpJ41NLYKVnA&_nc_ht=scontent.fath7-1.fna&oh=0b9912eb666fd830d18fce5fb9205b5b&oe=5ED97648)

BIN
tracking and telemetry/viewer/src/__pycache__/viewer.cpython-37.pyc

Binary file not shown.

9
tracking and telemetry/viewer/src/viewer.py

@ -10,13 +10,15 @@ context = zmq.Context()
module_ip = str(sys.argv[1]) module_ip = str(sys.argv[1])
client_ip = str(sys.argv[2])
print("Connecting to module…") print("Connecting to module…")
socket = context.socket(zmq.REQ) socket = context.socket(zmq.REQ)
socket.connect("tcp://" + module_ip + ":4444") socket.connect("tcp://"+ module_ip +":4444")
socket.send(str.encode(module_ip)) socket.send(str.encode(client_ip))
footage_socket = context.socket(zmq.SUB) footage_socket = context.socket(zmq.SUB)
footage_socket.bind('tcp://*:5555') footage_socket.bind("tcp://0.0.0.0:5555")
footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode('')) footage_socket.setsockopt_string(zmq.SUBSCRIBE, np.unicode(''))
while True: while True:
@ -24,6 +26,7 @@ while True:
frame = footage_socket.recv_string() frame = footage_socket.recv_string()
img = base64.b64decode(frame) img = base64.b64decode(frame)
npimg = np.fromstring(img, dtype=np.uint8) npimg = np.fromstring(img, dtype=np.uint8)
source = cv2.imdecode(npimg, 1) source = cv2.imdecode(npimg, 1)
cv2.imshow("Stream", source) cv2.imshow("Stream", source)
cv2.waitKey(1) cv2.waitKey(1)

BIN
tracking and telemetry/viewer/viewer_exe/base_library.zip

Binary file not shown.

BIN
tracking and telemetry/viewer/viewer_exe/viewer.exe

Binary file not shown.
Loading…
Cancel
Save