Skip to content
Snippets Groups Projects
Commit 2eb0d04c authored by REMY Laurent's avatar REMY Laurent
Browse files

Deleted MapSaver/__pycache__/mapio.cpython-38.pyc, MapSaver/MapSaver.py,...

Deleted MapSaver/__pycache__/mapio.cpython-38.pyc, MapSaver/MapSaver.py, MapSaver/aip2021.map, MapSaver/aip_in.map, MapSaver/aip_out.map, MapSaver/mainARCL.py, MapSaver/mainGenerator.py, MapSaver/mapio.py, maps/aip_in.png, maps/aip_in.svg
parent 2a8d88aa
Branches main
No related tags found
No related merge requests found
# Python program to
# modify a map for Omron AIP
# Author Laurent REMY
# Date 14/02/2022
from mapio import *
#Exemple de point sur la map
#Entête: Type PosX PosY PosZ "Description" ICON "Name"
# Cairn: Goal 953 3925 0.000000 "Description" ICON "TELMA"
path = ""
mapFileName = "aip_in.map"
header = "Cairn:"
type = ["Goal", "GoalWithHeading",
"StandbyGoal", "StandbyGoalWithHeading"
"ForbiddenArea",
"SlowSector",
"OneWaySector",]
map = []
read_map(path, mapFileName, map)
#Chercher la ligne last pour ajouter un Crain
# i = 0
# while i < len(map):
# if("LINES\n" == map[i]):
# #print(i)
# last = i-1
# break
# i=i+1
#print(map[last],end='')
#Créé un point
unPoint = [header,type[0],str(1000),str(5000),str(0),'"UneDesc"',"ICON",'"blavla"']
#Ajouter un point
line = (" ".join(unPoint)+ "\n")
#print(line,end="")
map.insert(10,line)
#Sauvegader le ficher map
write_map("aip_out.map",map)
\ No newline at end of file
File deleted
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/env python
from computeDataFunc import *
from paho.mqtt import client as mqtt
import json
# Debut = {"COM" : "La demande a été lancée"}
# Fin = {"COM" : "Fin, la map est à jour"}
# ARCL = {"COM" : "ARCL COMMANDE","ARCL" : "Mapobjectupdate GoalWithHeading 1000 2000 90 Update_by_AipSAC_4.0 ICON FANUC1"}
# print(json.dumps(Debut))
# #print(sys.argv[1])
class MyMQTTClass(mqtt.Client):
def on_connect(self, mqttc, obj, flags, rc):
print("rc: "+str(rc))
self.subscribe("/AIP/DWM/" + self.ID1, 0)
self.data = []
# def on_connect_fail(self, mqttc, obj):
# print("Connect failed")
def on_message(self, mqttc, obj, msg):
#print(str(msg.payload))
self.data.append(json.loads(msg.payload))
# def on_publish(self, mqttc, obj, mid):
# print("mid: "+str(mid))
#def on_subscribe(self, mqttc, obj, mid, granted_qos):
# print("Subscribed: "+str(mid)+" "+str(granted_qos))
# def on_log(self, mqttc, obj, level, string):
# print(string)
def run(self,ID1:str,ID2:str):
self.connect("127.0.0.1", 1883, 60)
self.ID1 = ID1
self.ID2 = ID2
rc = 0
while rc == 0:
rc = self.loop()
#print(len(self.data))
return rc
if __name__ == '__main__':
mqttc = MyMQTTClass()
rc = mqttc.run("43A0","2CE5")
#print("rc: "+str(rc))
#!/usr/bin/env python
import time,sys, json
Debut = {"COM" : "La demande a été lancée"}
Fin = {"COM" : "Fin, la map est à jour"}
ARCL = {"COM" : "ARCL COMMANDE","ARCL" : "Mapobjectupdate GoalWithHeading 1000 2000 90 Update_by_AipSAC_4.0 ICON FANUC1"}
print(json.dumps(Debut))
#print(sys.argv[1])
time.sleep(5)
#print(json.dumps(Fin))
print(json.dumps(ARCL))
def read_map(path,name,list):
print("Ouverture de la maps: " + name + " ...")
file = open(path + name, 'r')
count = 0
while True:
count += 1
# Get next line from file
line = file.readline()
if not line:
break
list.append(line)
file.close()
def write_map(name, list):
print("Sauvegarde de la maps: " + name + " ...")
save = open(name, "w")
for line in list:
save.writelines(line)
save.close()
print("Sauvegarde terminer")
class Cairn:
def __init__(self, type, PosX, PosY, PosZ, Desc, Name) -> None:
self.type = type
self.PosX = PosX
self.PosY = PosY
self.PosZ = PosZ
self.Desc = Desc
self.ICON = "ICON"
self.Name = Name
def show(self):
print(self.Name)
#unPoint = Point("Goal", 100, 100, 0, "UneDesciption", "Telma")
#unPoint.show()
maps/aip_in.png

986 KiB

This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment