Commit c7d98a8f by Vincent Wall

added warning message, updated author and description

parent 72fd7cec
# -*- coding: utf-8 -*-
"""
This script deflates all valves
This script checks for leaks in a vessel by releasing the values, checking the pressure
and then checking the pressure again after closing the valves for a set period
@author: Raphael Deimel
@copyright 2013-2016 Robotics and Biology Lab, TU Berlin
@author: Callum Waters
@copyright 2020-2023 Robotics and Biology Lab, TU Berlin
@licence: BSD Licence
"""
......@@ -22,48 +23,53 @@ pressures_after = [None] * channels
waiting_period = 20.0;
tolerance = 1.0;
print("Pressurizing all channels")
accepted = input("Inflation Period: " + inflation + " seconds. Please ensure vessel attached can withstand supply pressure" +
"then press y to start")
for i in range(channels):
airserver.submit( api.MsgConfigurationControllerThreshold(i) )
airserver.submit( api.MsgControllerActivate(i) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 1.0, now + delay) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 0, now + delay + inflation) )
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
airserver.submit( api.MsgSubscribe(SIGNAL_POUT, 0.05 , now + delay ))
if accepted == "y" or accepted == "Y":
time.sleep(delay + inflation + 2.0)
print("Pressurizing all channels")
airserver.service_incoming_messages()
for i in range(channels):
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
pressures_before[i] = airserver.serversignals[SIGNAL_POUT][1][0]
print("Begining holding time")
time.sleep(waiting_period)
print("Finishing holding time")
for i in range(channels):
airserver.submit( api.MsgConfigurationControllerThreshold(i) )
airserver.submit( api.MsgControllerActivate(i) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 1.0, now + delay) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 0, now + delay + inflation) )
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
airserver.submit( api.MsgSubscribe(SIGNAL_POUT, 0.05 , now + delay ))
airserver.service_incoming_messages()
leakages = False
for i in range(channels):
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
pressures_after[i] = airserver.serversignals[SIGNAL_POUT][1][0]
if (pressures_before[i] > pressures_after[i] + tolerance or pressures_before[i] < pressures_after[i] - tolerance):
leakages = True
print("Leakage observered on channel " + str(i) + ": " + str(pressures_before[i]) + " -> " + str(pressures_after[i]))
time.sleep(delay + inflation + 2.0)
print("Depressurizing all channels")
now = api.now()
for i in range(channels):
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, -1.0, now + delay) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 0, now + delay + deflation) )
time.sleep(delay + deflation)
airserver.service_incoming_messages()
for i in range(channels):
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
pressures_before[i] = airserver.serversignals[SIGNAL_POUT][1][0]
print("Begining holding time")
time.sleep(waiting_period)
print("Finishing holding time")
airserver.service_incoming_messages()
leakages = False
for i in range(channels):
SIGNAL_POUT = api.SIGNALS_CHANNEL[i][2]
pressures_after[i] = airserver.serversignals[SIGNAL_POUT][1][0]
if (pressures_before[i] > pressures_after[i] + tolerance or pressures_before[i] < pressures_after[i] - tolerance):
leakages = True
print("Leakage observered on channel " + str(i) + ": " + str(pressures_before[i]) + " -> " + str(pressures_after[i]))
print("Depressurizing all channels")
now = api.now()
for i in range(channels):
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, -1.0, now + delay) )
airserver.submit( api.MsgSignalEvent(api.BLOCK_SIGNALS_CLIENT + i, 0, now + delay + deflation) )
time.sleep(delay + deflation)
if not leakages:
print("Passed leakage test. All channels held their pressure")
if not leakages:
print("Passed leakage test. All channels held their pressure")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment