forked from AutodeskRoboticsLab/Mimic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostproc_setup.py
74 lines (61 loc) · 1.9 KB
/
postproc_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!usr/bin/env python
"""
Configuration for post processors
"""
import postproc_config
# Import your processor as private here:
from ABB.RAPID.rapid \
import SimpleRAPIDProcessor \
as __SimpleRAPIDProcessor
from KUKA.EntertainTech.entertaintech \
import SimpleEntertainTechProcessor \
as __SimpleEntertainTechProcessor
from KUKA.KRL.krl \
import SimpleKRLProcessor \
as __SimpleKRLProcessor
from GENERAL.CSV.comma_separated_vals \
import SimpleCSVProcessor \
as __SimpleCSVProcessor
# Add your processor to private list here:
__supported_processors = [
__SimpleRAPIDProcessor,
__SimpleKRLProcessor,
__SimpleEntertainTechProcessor,
__SimpleCSVProcessor
]
def construct_processor_name(type_robot, type_processor):
"""
Construct the name of a single Post Processor.
:param type_robot: Type of robot.
:param type_processor: Type of processor.
:return:
"""
return '{} {}'.format(type_robot, type_processor)
def get_processor_name(processor):
"""
Get the name from a given Post Processor
:param processor: Processor itself.
:return:
"""
return construct_processor_name(processor.type_robot, processor.type_processor)
def get_processor_names():
"""
Get the names of all processors using existing POST_PROCESSORS dict.
Sorts names alphabetically by default. User-accessible function.
:return: 'ROBOT_TYPE POSTPROCESSOR_TYPE'
"""
names = POST_PROCESSORS.keys()
names.sort()
# Get default from config
default = postproc_config.DEFAULT_POST_PROCESSOR
if default in names:
names.remove(default)
names.insert(0, default)
return names
# All post processors dict!
POST_PROCESSORS = {}
# Configure the dict (don't touch)
for processor in __supported_processors:
p = processor()
name = construct_processor_name(p.type_robot, p.type_processor)
POST_PROCESSORS[name] = processor