Fixed warnings
This commit is contained in:
parent
ec26ff3175
commit
eaab4691cd
@ -134,7 +134,8 @@ class ConfigParser:
|
|||||||
var_dict[tag] = self.get_default_value(var_type)
|
var_dict[tag] = self.get_default_value(var_type)
|
||||||
print(f"📄 Assigned Standard Value: '{tag}' -> {var_dict[tag]}")
|
print(f"📄 Assigned Standard Value: '{tag}' -> {var_dict[tag]}")
|
||||||
|
|
||||||
def rename_tech_keys(self, var_dict):
|
@staticmethod
|
||||||
|
def rename_tech_keys(var_dict):
|
||||||
"""Rename Tech.XX keys to Tech in send and receive variables at the last step."""
|
"""Rename Tech.XX keys to Tech in send and receive variables at the last step."""
|
||||||
tech_data = {}
|
tech_data = {}
|
||||||
for key in list(var_dict.keys()):
|
for key in list(var_dict.keys()):
|
||||||
@ -144,7 +145,8 @@ class ConfigParser:
|
|||||||
var_dict["Tech"] = tech_data # ✅ Store under Tech
|
var_dict["Tech"] = tech_data # ✅ Store under Tech
|
||||||
print(f"✅ Renamed Tech.XX keys to 'Tech': {var_dict['Tech']}")
|
print(f"✅ Renamed Tech.XX keys to 'Tech': {var_dict['Tech']}")
|
||||||
|
|
||||||
def get_default_value(self, var_type):
|
@staticmethod
|
||||||
|
def get_default_value(var_type):
|
||||||
"""Returns a default value based on TYPE."""
|
"""Returns a default value based on TYPE."""
|
||||||
if var_type == "BOOL":
|
if var_type == "BOOL":
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import re
|
|||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyTypeChecker
|
||||||
class KRLParser:
|
class KRLParser:
|
||||||
"""Parses KUKA KRL .src and .dat files, extracting Cartesian coordinates into CSV."""
|
"""Parses KUKA KRL .src and .dat files, extracting Cartesian coordinates into CSV."""
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,9 @@ class KukaRSIVisualizer:
|
|||||||
plt.savefig(save_path)
|
plt.savefig(save_path)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
def has_column(self, col):
|
||||||
|
return col in self.df.columns
|
||||||
|
|
||||||
def plot_joint_positions(self, save_path=None):
|
def plot_joint_positions(self, save_path=None):
|
||||||
"""Plots joint positions over time with safety limit overlays."""
|
"""Plots joint positions over time with safety limit overlays."""
|
||||||
plt.figure()
|
plt.figure()
|
||||||
|
|||||||
@ -41,7 +41,8 @@ class NetworkProcess(multiprocessing.Process):
|
|||||||
|
|
||||||
self.controller_ip_and_port = None
|
self.controller_ip_and_port = None
|
||||||
|
|
||||||
def is_valid_ip(self, ip):
|
@staticmethod
|
||||||
|
def is_valid_ip(ip):
|
||||||
"""Check if an IP address is valid and can be bound on this machine."""
|
"""Check if an IP address is valid and can be bound on this machine."""
|
||||||
try:
|
try:
|
||||||
socket.inet_aton(ip) # Validate format
|
socket.inet_aton(ip) # Validate format
|
||||||
|
|||||||
@ -240,7 +240,8 @@ class RSIAPI:
|
|||||||
if export:
|
if export:
|
||||||
visualizer.export_graphs()
|
visualizer.export_graphs()
|
||||||
|
|
||||||
def parse_krl_to_csv(self, src_file, dat_file, output_file):
|
@staticmethod
|
||||||
|
def parse_krl_to_csv(src_file, dat_file, output_file):
|
||||||
"""
|
"""
|
||||||
Parses KRL files (.src, .dat) and exports coordinates to CSV.
|
Parses KRL files (.src, .dat) and exports coordinates to CSV.
|
||||||
|
|
||||||
@ -258,7 +259,8 @@ class RSIAPI:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"❌ Error parsing KRL files: {e}"
|
return f"❌ Error parsing KRL files: {e}"
|
||||||
|
|
||||||
def inject_rsi(self, input_krl, output_krl=None, rsi_config="RSIGatewayv1.rsi"):
|
@staticmethod
|
||||||
|
def inject_rsi(input_krl, output_krl=None, rsi_config="RSIGatewayv1.rsi"):
|
||||||
"""
|
"""
|
||||||
Inject RSI commands into a KRL (.src) program file.
|
Inject RSI commands into a KRL (.src) program file.
|
||||||
|
|
||||||
@ -274,7 +276,8 @@ class RSIAPI:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"❌ RSI injection failed: {e}"
|
return f"❌ RSI injection failed: {e}"
|
||||||
|
|
||||||
def generate_trajectory(self, start, end, steps=100, space="cartesian"):
|
@staticmethod
|
||||||
|
def generate_trajectory(start, end, steps=100, space="cartesian"):
|
||||||
"""Generates a linear trajectory (Cartesian or Joint)."""
|
"""Generates a linear trajectory (Cartesian or Joint)."""
|
||||||
return generate_trajectory(start, end, steps, space)
|
return generate_trajectory(start, end, steps, space)
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,8 @@ class RSIConfig:
|
|||||||
logging.warning(f"⚠️ Failed to load RSI safety limits: {e}")
|
logging.warning(f"⚠️ Failed to load RSI safety limits: {e}")
|
||||||
self.safety_limits = {}
|
self.safety_limits = {}
|
||||||
|
|
||||||
def strip_def_prefix(self, tag):
|
@staticmethod
|
||||||
|
def strip_def_prefix(tag):
|
||||||
"""Remove 'DEF_' prefix from a variable name."""
|
"""Remove 'DEF_' prefix from a variable name."""
|
||||||
return tag.replace("DEF_", "")
|
return tag.replace("DEF_", "")
|
||||||
|
|
||||||
@ -81,7 +82,8 @@ class RSIConfig:
|
|||||||
else:
|
else:
|
||||||
var_dict[tag] = self.get_default_value(var_type)
|
var_dict[tag] = self.get_default_value(var_type)
|
||||||
|
|
||||||
def get_default_value(self, var_type):
|
@staticmethod
|
||||||
|
def get_default_value(var_type):
|
||||||
"""Returns a default value based on TYPE."""
|
"""Returns a default value based on TYPE."""
|
||||||
if var_type == "BOOL":
|
if var_type == "BOOL":
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -22,14 +22,14 @@ class SafetyManager:
|
|||||||
Raises ValueError if out of allowed bounds.
|
Raises ValueError if out of allowed bounds.
|
||||||
"""
|
"""
|
||||||
if self.e_stop:
|
if self.e_stop:
|
||||||
raise RuntimeError(f"SafetyManager: E-STOP active, motion blocked for {path}.")
|
logging.warning(f"SafetyManager: {path} update blocked (E-STOP active)")
|
||||||
|
raise RuntimeError(f"SafetyManager: E-STOP active. Motion blocked for {path}.")
|
||||||
|
|
||||||
if path in self.limits:
|
if path in self.limits:
|
||||||
min_val, max_val = self.limits[path]
|
min_val, max_val = self.limits[path]
|
||||||
if not (min_val <= value <= max_val):
|
if not (min_val <= value <= max_val):
|
||||||
raise ValueError(
|
logging.warning(f"SafetyManager: {path}={value} blocked (out of bounds {min_val} to {max_val})")
|
||||||
f"SafetyManager: {path}={value} is out of bounds ({min_val} to {max_val})"
|
raise ValueError(f"SafetyManager: {path}={value} is out of bounds ({min_val} to {max_val})")
|
||||||
)
|
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -52,15 +52,3 @@ class SafetyManager:
|
|||||||
def is_stopped(self):
|
def is_stopped(self):
|
||||||
return self.e_stop
|
return self.e_stop
|
||||||
|
|
||||||
def validate(self, path: str, value: float) -> float:
|
|
||||||
if self.e_stop:
|
|
||||||
logging.warning(f"Safety violation: {path} update blocked (E-STOP active)")
|
|
||||||
raise RuntimeError(f"E-STOP active. Motion blocked for {path}.")
|
|
||||||
|
|
||||||
if path in self.limits:
|
|
||||||
min_val, max_val = self.limits[path]
|
|
||||||
if not (min_val <= value <= max_val):
|
|
||||||
logging.warning(f"Safety violation: {path}={value} blocked (out of bounds {min_val} to {max_val})")
|
|
||||||
raise ValueError(f"{path}={value} is out of bounds ({min_val} to {max_val})")
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user