Skip to content

Commit

Permalink
Update system parameters
Browse files Browse the repository at this point in the history
Also support comments in the `system_parameter_codes` file when reading
system parameters from hardware.
  • Loading branch information
stefanscherzinger committed Jul 19, 2024
1 parent 91aa53d commit 35984a6
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
[flake8]
# Use black's line length (default 88) instead of the flake8 default of 79:
max-line-length = 88

per-file-ignores =
schunk_egu_egk_gripper_dummy/*.py:E203
23 changes: 16 additions & 7 deletions schunk_egu_egk_gripper_dummy/config/data.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"0x0040": [
"210000800000A2800000000000000000"
"800000800000A25800000000000000EF"
],
"0x0048": [
"05000000000000000000000000000000"
Expand All @@ -9,7 +9,7 @@
"0000"
],
"0x0118": [
"00"
"EF"
],
"0x0120": [
"00"
Expand All @@ -18,10 +18,13 @@
"001F"
],
"0x0130": [
"3238333A34303A3534203C307837323E206C6F67696320766F6C746167652031362E343336203C2031392E3230302056202876616C75655F6D6F6E69746F722E6370703A3A32312900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"3238343A32363A3532203C307846343E206D6F766520626C6F636B6564206F6363757272656420696E2063757272656E74207374617465203420286170706C69636174696F6E5F73746174655F6D616368696E652E683A3A313334392900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
],
"0x0210": [
"00000000"
],
"0x0230": [
"4226667D"
"42263D87"
],
"0x0238": [
"00000000"
Expand Down Expand Up @@ -102,10 +105,10 @@
"42AA0000"
],
"0x0840": [
"41F5DC60"
"421EAE6D"
],
"0x0870": [
"41BA7D40"
"41BA5871"
],
"0x0878": [
"41C04897"
Expand Down Expand Up @@ -149,13 +152,19 @@
"0x1118": [
"352E322E302E38313839360000000000000000000000"
],
"0x1120": [
"322E312E3100000000000000"
],
"0x1130": [
"01"
],
"0x1138": [
"0030114844C7"
],
"0x1330": [
"01"
],
"0x1400": [
"00000080"
"00000A69"
]
}
36 changes: 35 additions & 1 deletion schunk_egu_egk_gripper_dummy/config/enum.json
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,7 @@
"string": "ERR_SW_COMM"
}
],
"0x120": [
"0x0120": [
{
"value": 0,
"string": "ERR_NONE"
Expand Down Expand Up @@ -2140,5 +2140,39 @@
"value": 27,
"string": "EGU_80_M_SD"
}
],
"0x1130": [
{
"value": 0,
"string": "UNKNOWN"
},
{
"value": 1,
"string": "PROFINET"
},
{
"value": 2,
"string": "EtherNet/IP (TM)"
},
{
"value": 3,
"string": "EtherCAT"
},
{
"value": 4,
"string": "Modbus TCP"
},
{
"value": 5,
"string": "Common Ethernet"
},
{
"value": 6,
"string": "IOLink"
},
{
"value": 7,
"string": "Modbus RTU"
}
]
}
7 changes: 7 additions & 0 deletions schunk_egu_egk_gripper_dummy/config/read_system_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ def read_parameter_codes(filepath: str) -> list[str]:
def contains_hex(line: str) -> bool:
return True if "0x" in line and line[0] != "#" else False

def remove_comments(line: str) -> str:
if line.find("#") != -1:
line = line[0 : line.find("#")]
line = line.strip()
return line

with open(filepath, "r") as f:
lines = f.read().split("\n")
lines = list(filter(contains_hex, lines))
lines = list(map(remove_comments, lines))
return lines


Expand Down
9 changes: 6 additions & 3 deletions schunk_egu_egk_gripper_dummy/config/system_parameter_codes
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
0x0040
0x0048
0x0100
0x0118
0x0120
0x0118 # enum
0x0120 # enum
0x0128
0x0130
0x0210
0x0230
0x0238
0x0380
0x03A8
0x03B0
0x03B8
0x0500
0x0500 # enum
0x0528
0x0540
0x0580
Expand Down Expand Up @@ -53,6 +54,8 @@
0x1108
0x1110
0x1118
0x1120
0x1130 # enum
0x1138
0x1330
0x1400

0 comments on commit 35984a6

Please sign in to comment.