Use ID instead of username
This commit is contained in:
parent
1dcc9ebf66
commit
a24e11ef18
8
controller-client/camshader.glsl
Normal file
8
controller-client/camshader.glsl
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma lannguage glsl1
|
||||
|
||||
vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords)
|
||||
{
|
||||
vec4 textureColor = Texel(tex, texture_coords);
|
||||
vec4 result = vec4(textureColor[2], textureColor[1], textureColor[0], textureColor[3]);
|
||||
return result * color;
|
||||
}
|
@ -22,11 +22,13 @@ function love.draw2()
|
||||
local scaledWidth = imageWidth * scale
|
||||
local scaledHeight = imageHeight * scale
|
||||
|
||||
love.graphics.setShader(CamShader)
|
||||
love.graphics.draw(BotState.camfeed,
|
||||
(width - scaledWidth) / 2, (height - scaledHeight) / 2,
|
||||
0,
|
||||
scale, scale
|
||||
)
|
||||
love.graphics.setShader(nil)
|
||||
end
|
||||
|
||||
-- Draw time
|
||||
|
@ -2,6 +2,8 @@ package.loaded["draw"] = nil
|
||||
|
||||
require("draw")
|
||||
|
||||
CamShader = nil
|
||||
|
||||
BotState = {
|
||||
lastMessage = 0,
|
||||
cpuBattery = nil,
|
||||
@ -38,6 +40,8 @@ function formatSafe(format, value, ...)
|
||||
end
|
||||
|
||||
function love.load()
|
||||
CamShader = love.graphics.newShader("client/camshader.glsl")
|
||||
|
||||
love.graphics.setFont(love.graphics.newFont(20))
|
||||
love.window.setFullscreen(true)
|
||||
love.mqtt.subscribe("telemetry/#")
|
||||
|
@ -48,7 +48,7 @@ end
|
||||
local function main()
|
||||
client = mqtt.client {
|
||||
uri = "mqtt.seeseepuff.be",
|
||||
username = "mqtt_controller-" .. math.random(0, maxClientId),
|
||||
id = "mqtt_controller-" .. math.random(0, maxClientId),
|
||||
clean = true,
|
||||
reconnect = 5,
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ end
|
||||
|
||||
client = mqtt.client {
|
||||
uri = "mqtt.seeseepuff.be",
|
||||
username = "tools",
|
||||
clean = true,
|
||||
username = "tool-get-image",
|
||||
id = true,
|
||||
reconnect = 5,
|
||||
version = mqtt.v311,
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ end
|
||||
|
||||
client = mqtt.client {
|
||||
uri = "mqtt.seeseepuff.be",
|
||||
username = "tools",
|
||||
id = "tool-get-ip",
|
||||
clean = true,
|
||||
reconnect = 5,
|
||||
}
|
||||
|
@ -21,15 +21,16 @@ def handle_camera_event(cm):
|
||||
def sendImage(plane):
|
||||
image = Image.frombytes("RGBA", (800, 600), plane.tobytes())
|
||||
pngBytes = io.BytesIO()
|
||||
image.save(pngBytes, "png")
|
||||
image.convert("RGB").save(pngBytes, "jpeg")
|
||||
mqttc.publish("spider/telemetry/camfeed", pngBytes.getvalue())
|
||||
#mqttc.publish("spider/telemetry/camfeed", plane.tobytes())
|
||||
|
||||
def process_request(request):
|
||||
global camera, image_count
|
||||
global mqttc
|
||||
|
||||
image_count += 1
|
||||
if image_count > 1:
|
||||
if image_count > 0:
|
||||
image_count = 0
|
||||
print(f'Request completed: {request}')
|
||||
|
||||
|
@ -1,34 +1,33 @@
|
||||
package.path = package.path .. ';./controller-host/?/init.lua;./controller-host/?.lua'
|
||||
local mqtt = require("mqtt")
|
||||
local socket = require("socket")
|
||||
local client
|
||||
|
||||
local fh = io.open("spider-image.bin", "rb")
|
||||
local contents = fh:read("a")
|
||||
fh:close()
|
||||
|
||||
local function onConnect(connack)
|
||||
if connack.rc ~= 0 then
|
||||
print("Connection to broker failed:", connack:reason_string())
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
--local length = 1000000
|
||||
-- 500000
|
||||
local length = 1000000
|
||||
-- 100000
|
||||
--while true do
|
||||
local payload = string.rep("b", length)
|
||||
--length = length + 100000
|
||||
|
||||
assert(client:publish {
|
||||
topic = "spider/telemetry/camfeed",
|
||||
payload = payload,
|
||||
qos = 0
|
||||
})
|
||||
--end
|
||||
while true do
|
||||
assert(client:publish {
|
||||
topic = "spider/telemetry/camfeed",
|
||||
payload = contents,
|
||||
qos = 0
|
||||
})
|
||||
socket.sleep(1)
|
||||
end
|
||||
|
||||
print("Connected and subscribed")
|
||||
end
|
||||
|
||||
client = mqtt.client {
|
||||
uri = "mqtt.seeseepuff.be",
|
||||
username = "tools",
|
||||
id = "tool-test-image",
|
||||
clean = true,
|
||||
reconnect = 5,
|
||||
version = mqtt.v311,
|
||||
|
@ -41,7 +41,7 @@ end
|
||||
|
||||
client = mqtt.client {
|
||||
uri = "mqtt.seeseepuff.be",
|
||||
username = "mqtt_controller",
|
||||
username = "tool-upload-controller",
|
||||
clean = true,
|
||||
reconnect = 5,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user