main
alex 2023-10-08 23:52:52 +02:00
parent 577ff4f4e3
commit e4f9eee319
7 changed files with 23 additions and 34 deletions

View File

@ -1,35 +1,14 @@
{
"category": "RexRobots",
"name": "Produktionstask 1",
"globalInputs": [
{
"parameterName": "kundenname",
"type": "text",
"displayName": "Name des Kunden"
}
],
"globalInputs": [],
"tasks": [
{
"name": "Bild zu Label konvertieren",
"onFinish": "pause",
"undoPossible": true,
"repeatPossible": true,
"scriptPath": "test1.py",
"parameters": [
{
"parameterName": "labelformat",
"type": "text",
"displayName": "Format des Labels",
"global": false
}
]
},
{
"name": "Label drucken",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": false,
"scriptPath": "test2.py",
"repeatPossible": true,
"scriptPath": "test.py",
"parameters": []
}
]

View File

@ -6,6 +6,6 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')
from libs.robots import rex
rexRobot = rex.Rex("rexRobot")
rexRobot = rex.Rex("rexRobot", "Drucker leeren")
rexRobot.move(1, 2, 3)

View File

@ -1,9 +1,12 @@
import requests
class Rex:
"""
This class represents a rex robot.
"""
def __init__(self, name):
self.name = name
def __init__(self, rexName, jobName):
self.rexName = rexName
self.jobName = jobName
self.x = 0
self.y = 0
self.z = 0
@ -16,7 +19,14 @@ class Rex:
self.y = y
self.z = z
print("Robot: " + self.name + " moved to (" + str(self.x) + ", " + str(self.y) + ")")
print("Robot: " + self.rexName + " moved to (" + str(self.x) + ", " + str(self.y) + ")")
def __str__(self):
return "Robot: " + self.name + " (" + str(self.x) + ", " + str(self.y) + ")"
requests.post("http://localhost:50055/v1/control/move", json={"x": self.x, "y": self.y, "z": self.z})
def finish():
"""
Finish the robot.
"""
print("Robot finished")
# TODO: request to the server to finish the robot and update the robot status to free

View File

@ -33,7 +33,7 @@ import (
"git.ex.umbach.dev/Alex/roese-utils/rslogger"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
flogger "github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/fiber/v2/middleware/logger"
"github.com/gofiber/websocket/v2"
"github.com/rs/zerolog/log"
)
@ -111,7 +111,7 @@ func main() {
app.Use(cors.New())
if config.Cfg.Debug {
app.Use(flogger.New(flogger.Config{
app.Use(logger.New(logger.Config{
Format: "${pid} ${locals:requestid} ${status} - ${latency} ${method} ${path}\n",
}))
}

View File

@ -11,7 +11,7 @@ import (
var socketClients []*structs.SocketClient
var mu sync.RWMutex
func AddSocketClient(sessionId string, socketClient *structs.SocketClient) {
func AddSocketClient(socketClient *structs.SocketClient) {
mu.Lock()
socketClients = append(socketClients, socketClient)
mu.Unlock()

View File

@ -40,7 +40,7 @@ func RunHub() {
newSocketClient.SessionId = sessionId
newSocketClient.UserId = userId
cache.AddSocketClient(sessionId, newSocketClient)
cache.AddSocketClient(newSocketClient)
// check that user session is not expired
var userSession structs.UserSession