Commit 78c0240e authored by Lorenz Halt's avatar Lorenz Halt 🔀
Browse files

Less verbose

parent fb4a7266
...@@ -39,7 +39,7 @@ def resample(data, delta_ms): ...@@ -39,7 +39,7 @@ def resample(data, delta_ms):
def write(file, data, header): def write(file, data, header):
print("Writing to file: '%s'"%(file)) #print("Writing to file: '%s'"%(file))
# Test if header fits # Test if header fits
if not len(header.split(',')) == data.shape[1]: if not len(header.split(',')) == data.shape[1]:
raise ValueError("header and data does not fit!\nheader: '{}'\ndata[0]: '{}'".format(header, data[0,:])) raise ValueError("header and data does not fit!\nheader: '{}'\ndata[0]: '{}'".format(header, data[0,:]))
...@@ -51,7 +51,7 @@ def write(file, data, header): ...@@ -51,7 +51,7 @@ def write(file, data, header):
delimiter =",") delimiter =",")
def read(file): def read(file):
print("Reading from file: '%s'"%(file)) #print("Reading from file: '%s'"%(file))
with open(file, 'r') as f: with open(file, 'r') as f:
header_str = f.readline().strip() header_str = f.readline().strip()
data = np.genfromtxt(file, data = np.genfromtxt(file,
......
...@@ -50,7 +50,7 @@ class Ilc_serviceproxy: ...@@ -50,7 +50,7 @@ class Ilc_serviceproxy:
rospack = rospkg.RosPack() rospack = rospkg.RosPack()
name = name.replace(matchObj.group(), "{}".format(rospack.get_path(matchObj.group(2)))) name = name.replace(matchObj.group(), "{}".format(rospack.get_path(matchObj.group(2))))
print("Decoded Name: {} -> {}".format(filename, name)) #print("Decoded Name: {} -> {}".format(filename, name))
return name return name
...@@ -64,7 +64,7 @@ class Ilc_serviceproxy: ...@@ -64,7 +64,7 @@ class Ilc_serviceproxy:
def callback_ilc_calc_meas(self, req): def callback_ilc_calc_meas(self, req):
try: try:
print #print
path = self.decode_filename(req.filename_error) path = self.decode_filename(req.filename_error)
### Read measurement data ### Read measurement data
...@@ -163,7 +163,7 @@ class Ilc_serviceproxy: ...@@ -163,7 +163,7 @@ class Ilc_serviceproxy:
if req.reuse_scheme != 0: if req.reuse_scheme != 0:
self.reshape = True self.reshape = True
print("Retiming Service received:\n{}".format(req)) #print("Retiming Service received:\n{}".format(req))
return RetimeILCResponse(success=True, message="done") return RetimeILCResponse(success=True, message="done")
def reshape_ff(self, last_ff, last_decay_time, new_decay_time): def reshape_ff(self, last_ff, last_decay_time, new_decay_time):
...@@ -174,8 +174,9 @@ class Ilc_serviceproxy: ...@@ -174,8 +174,9 @@ class Ilc_serviceproxy:
def callback_ilc_retime_if(self, req): def callback_ilc_retime_if(self, req):
#print("Retiming Service received:\n{}".format(req)) #print("Retiming Service received:\n{}".format(req))
try: try:
print("Convergence: {} > {}".format(np.max(ilc_lib.error_convergence(self.data_diff)), req.convergence_threshold))
if (np.max(ilc_lib.error_convergence(self.data_diff)) < req.convergence_threshold): if (np.max(ilc_lib.error_convergence(self.data_diff)) < req.convergence_threshold):
print("Reducing trajectory time to {}".format(self.decay_time)) #print("Reducing trajectory time to {}".format(self.decay_time))
self.last_decay_time = self.decay_time self.last_decay_time = self.decay_time
self.decay_time = self.decay_time * req.retime_factor self.decay_time = self.decay_time * req.retime_factor
self.initialized = req.reuse_ff self.initialized = req.reuse_ff
...@@ -184,7 +185,7 @@ class Ilc_serviceproxy: ...@@ -184,7 +185,7 @@ class Ilc_serviceproxy:
self.reshape = True self.reshape = True
# Call service to setpoint_ilc (retime factor is start parameter, not in service but must be in sync!) # Call service to setpoint_ilc (retime factor is start parameter, not in service but must be in sync!)
print(req) #print(req)
resp = rospy.ServiceProxy(req.retime_srv, Empty)() resp = rospy.ServiceProxy(req.retime_srv, Empty)()
print("-------------------------------------------") print("-------------------------------------------")
print("Retimed from {}ms to {}ms".format(self.last_decay_time, self.decay_time)) print("Retimed from {}ms to {}ms".format(self.last_decay_time, self.decay_time))
...@@ -192,7 +193,6 @@ class Ilc_serviceproxy: ...@@ -192,7 +193,6 @@ class Ilc_serviceproxy:
return RetimeIfILCResponse(success=True, message="reshaped") return RetimeIfILCResponse(success=True, message="reshaped")
else: else:
print("Convergence: {} > {}".format(np.max(ilc_lib.error_convergence(self.data_diff)), req.convergence_threshold))
return RetimeIfILCResponse(success=True, message="skipped") return RetimeIfILCResponse(success=True, message="skipped")
except Exception as e: except Exception as e:
......
Supports Markdown
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