Compare commits
7 Commits
0d4bcb7413
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ab27edbe8 | |||
| f9696979cf | |||
| 476458303b | |||
| 88f9f183bd | |||
| 649a31c467 | |||
| 7110f8fa59 | |||
| d11f3ec243 |
File diff suppressed because one or more lines are too long
24244
NasoScope/get-pip.py
24244
NasoScope/get-pip.py
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2",
|
"version": "0.3",
|
||||||
"logFile": "./Nasoscope.log",
|
"logFile": "/home/briq/logs/nasoscopio-grande.log",
|
||||||
"logFormat": "%(asctime)s|%(levelname)-7s|%(funcName)-10s|%(lineno)-3d: %(message)-50s",
|
"logFormat": "%(asctime)s|%(levelname)-7s|%(funcName)-10s|%(lineno)-3d: %(message)-50s",
|
||||||
"logTimeFormat": "%m-%d %H:%M:%S",
|
"logTimeFormat": "%m-%d %H:%M:%S",
|
||||||
"URL": "http://localhost:8080",
|
"URL": "http://localhost:8080",
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
"loopPeriod": 0.5,
|
"loopPeriod": 0.5,
|
||||||
"recordTime": 3600,
|
"recordTime": 3600,
|
||||||
"fileSaveTime": 360,
|
"fileSaveTime": 360,
|
||||||
"fileSaveDir": "./{}_CL3015HSD.{fType}",
|
"fileSaveDir": "/tmp/GRANDE_{}_CL3015HSD.{fType}",
|
||||||
"fileType": "csv",
|
"fileType": "csv",
|
||||||
"variables": [ {"deviceID":1,
|
"variables": [ {"deviceID":1,
|
||||||
"name": "AsseX",
|
"name": "AsseX",
|
||||||
@@ -51,13 +51,13 @@
|
|||||||
},
|
},
|
||||||
"mqttHost": "localhost",
|
"mqttHost": "localhost",
|
||||||
"mqttPort": 1883,
|
"mqttPort": 1883,
|
||||||
"mqttSend": "nasoscope/cnc2recorder",
|
"mqttSend": "nasoscope/grande/cnc2recorder",
|
||||||
"mqttReceive": "nasoscope/recorder2cnc",
|
"mqttReceive": "nasoscope/grande/recorder2cnc",
|
||||||
"sendMqtt": true,
|
"sendMqtt": false,
|
||||||
"mqttSendSamples": "nasoscope/samples",
|
"mqttSendSamples": "nasoscope/grande/samples",
|
||||||
"sendInflux": true,
|
"sendInflux": true,
|
||||||
"influxHost": "localhost",
|
"influxHost": "localhost",
|
||||||
"influxPort": 8086,
|
"influxPort": 8086,
|
||||||
"influxDB": "axes",
|
"influxDB": "axes_grande",
|
||||||
"influxRetention": "one_day"
|
"influxRetention": "one_day"
|
||||||
}
|
}
|
||||||
63
config-piccola.json
Normal file
63
config-piccola.json
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"version": "0.3",
|
||||||
|
"logFile": "/home/briq/logs/nasoscopio-piccola.log",
|
||||||
|
"logFormat": "%(asctime)s|%(levelname)-7s|%(funcName)-10s|%(lineno)-3d: %(message)-50s",
|
||||||
|
"logTimeFormat": "%m-%d %H:%M:%S",
|
||||||
|
"URL": "http://localhost:8081",
|
||||||
|
"samplePeriod": 10,
|
||||||
|
"loopPeriod": 0.5,
|
||||||
|
"recordTime": 3600,
|
||||||
|
"fileSaveTime": 360,
|
||||||
|
"fileSaveDir": "/tmp/PICCOLA_{}_CL3015HSD.{fType}",
|
||||||
|
"fileType": "csv",
|
||||||
|
"variables": [ {"deviceID":1,
|
||||||
|
"name": "AsseX",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
},
|
||||||
|
{"deviceID":2,
|
||||||
|
"name": "AsseY",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
},
|
||||||
|
{"deviceID":3,
|
||||||
|
"name": "AsseZ",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
},
|
||||||
|
{"deviceID":4,
|
||||||
|
"name": "AsseC",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
},
|
||||||
|
{"deviceID":5,
|
||||||
|
"name": "AsseB",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
},
|
||||||
|
{"deviceID":6,
|
||||||
|
"name": "AsseXs",
|
||||||
|
"codes": [1000,1002,1017,1021,1022,1038],
|
||||||
|
"descr": ["ActualFeed","FollowingError","MeasuredPosition","CalculatedAcceleration","Jerk","ServoPoint"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"variableNames": {
|
||||||
|
"1000": "ActualFeed",
|
||||||
|
"1002": "FollowingError",
|
||||||
|
"1017": "MeasuredPosition",
|
||||||
|
"1021": "CalculatedAcceleration",
|
||||||
|
"1022": "Jerk",
|
||||||
|
"1038": "ServoPoint"
|
||||||
|
},
|
||||||
|
"mqttHost": "localhost",
|
||||||
|
"mqttPort": 1883,
|
||||||
|
"mqttSend": "nasoscope/piccola/cnc2recorder",
|
||||||
|
"mqttReceive": "nasoscope/piccola/recorder2cnc",
|
||||||
|
"sendMqtt": false,
|
||||||
|
"mqttSendSamples": "nasoscope/piccola/samples",
|
||||||
|
"sendInflux": true,
|
||||||
|
"influxHost": "localhost",
|
||||||
|
"influxPort": 8086,
|
||||||
|
"influxDB": "axes_piccola",
|
||||||
|
"influxRetention": "one_day"
|
||||||
|
}
|
||||||
@@ -221,7 +221,7 @@ def onMessage(cli, userdata, msg):
|
|||||||
elif "EXIT" in msg:
|
elif "EXIT" in msg:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
LOGGER.error("Messaggio MQTT sconosciuto")
|
LOGGER.error(f"Messaggio MQTT sconosciuto: {msg}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def onConnect(cli, userdata, flags, rc):
|
def onConnect(cli, userdata, flags, rc):
|
||||||
@@ -248,7 +248,8 @@ if __name__ == '__main__':
|
|||||||
samples = dict()
|
samples = dict()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fp = open("config.json")
|
print(f'Config: {sys.argv[1]}')
|
||||||
|
fp = open(str(sys.argv[1]))
|
||||||
settings = json.load(fp)
|
settings = json.load(fp)
|
||||||
fp.close()
|
fp.close()
|
||||||
except:
|
except:
|
||||||
@@ -331,7 +332,7 @@ if __name__ == '__main__':
|
|||||||
# for y in tempSamples[x] for z in tempSamples[x][y]])
|
# for y in tempSamples[x] for z in tempSamples[x][y]])
|
||||||
firstCap = False
|
firstCap = False
|
||||||
firstTS = time.time()
|
firstTS = time.time()
|
||||||
LOGGER.info(f'Inizio cattura TS: {datetime.fromtimestamp(firstTS).strftime("%c")}')
|
LOGGER.warning(f'Inizio cattura: {datetime.fromtimestamp(firstTS).strftime("%c")}')
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for ax in tempSamples:
|
for ax in tempSamples:
|
||||||
@@ -357,6 +358,7 @@ if __name__ == '__main__':
|
|||||||
sendSamples(tempSamples)
|
sendSamples(tempSamples)
|
||||||
else:
|
else:
|
||||||
influxMeas = list()
|
influxMeas = list()
|
||||||
|
LOGGER.debug("Invio Influx")
|
||||||
for idx,record in enumerate(tempSamples[ax][reg]):
|
for idx,record in enumerate(tempSamples[ax][reg]):
|
||||||
ts = tempSamples[ax][reg][idx][templates.SAM_TS]+firstTS*1000000
|
ts = tempSamples[ax][reg][idx][templates.SAM_TS]+firstTS*1000000
|
||||||
influxMeas.append({
|
influxMeas.append({
|
||||||
@@ -393,13 +395,16 @@ if __name__ == '__main__':
|
|||||||
elif stat == "STOP":
|
elif stat == "STOP":
|
||||||
stopSampling()
|
stopSampling()
|
||||||
closeChannel()
|
closeChannel()
|
||||||
if not settings['sendMqtt']:
|
if not settings['sendMqtt'] and not settings['sendInflux']:
|
||||||
saveSamples(samples)
|
saveSamples(samples)
|
||||||
LOGGER.warning("Chiudo il Canale")
|
LOGGER.warning("Chiudo il Canale")
|
||||||
|
firstLoop = True
|
||||||
stat = "IDLE"
|
stat = "IDLE"
|
||||||
pass
|
pass
|
||||||
elif stat == "IDLE":
|
elif stat == "IDLE":
|
||||||
|
if firstLoop:
|
||||||
LOGGER.info("Pronto a Iniziare Cattura")
|
LOGGER.info("Pronto a Iniziare Cattura")
|
||||||
|
firstLoop = False
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
time.sleep(settings["loopPeriod"])
|
time.sleep(settings["loopPeriod"])
|
||||||
16
nasoscopio-grande.service
Normal file
16
nasoscopio-grande.service
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Nasoscopio - Letture Movimento Assi Materia-CL4020
|
||||||
|
Requires=network.target mosquitto.service docker.service sshtunnel-grande.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=15s
|
||||||
|
Type=simple
|
||||||
|
User=briq
|
||||||
|
Group=briq
|
||||||
|
WorkingDirectory=/home/briq/NasoScopio/
|
||||||
|
ExecStart=/usr/bin/python3 nasomain.py config-grande.json
|
||||||
|
PIDFile=/run/nasoscopio-grande.pid
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
16
nasoscopio-piccola.service
Normal file
16
nasoscopio-piccola.service
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Nasoscopio - Letture Movimento Assi Materia-CL3015
|
||||||
|
Requires=network.target mosquitto.service docker.service sshtunnel-piccola.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=15s
|
||||||
|
Type=simple
|
||||||
|
User=briq
|
||||||
|
Group=briq
|
||||||
|
WorkingDirectory=/home/briq/NasoScopio/
|
||||||
|
ExecStart=/usr/bin/python3 nasomain.py config-piccola.json
|
||||||
|
PIDFile=/run/nasoscopio-piccola.pid
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
16
sshtunnel-grande.service
Normal file
16
sshtunnel-grande.service
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=SSH Tunnel - Letture Movimento Assi Materia-CL4020
|
||||||
|
Requires=network.target mosquitto.service docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=15s
|
||||||
|
Type=simple
|
||||||
|
User=briq
|
||||||
|
Group=briq
|
||||||
|
WorkingDirectory=/home/briq/NasoScopio/
|
||||||
|
ExecStart=/usr/bin/autossh -Nf -M 0 -L 8880:192.168.0.1:8080 cnc@192.168.30.50
|
||||||
|
PIDFile=/run/sshtunnel-grande.pid
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
16
sshtunnel-piccola.service
Normal file
16
sshtunnel-piccola.service
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=SSH Tunnel - Letture Movimento Assi Materia-CL3015
|
||||||
|
Requires=network.target mosquitto.service docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
RestartSec=15s
|
||||||
|
Type=simple
|
||||||
|
User=briq
|
||||||
|
Group=briq
|
||||||
|
WorkingDirectory=/home/briq/NasoScopio/
|
||||||
|
ExecStart=/usr/bin/autossh -Nf -M 0 -L 8881:192.168.0.1:8080 cnc@192.168.30.51
|
||||||
|
PIDFile=/run/sshtunnel-piccola.pid
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user