autoverse-cli 0.7.0__tar.gz → 0.8.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/PKG-INFO +1 -1
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/pyproject.toml +1 -1
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/PKG-INFO +1 -1
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/app_version.py +1 -1
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/avrs.py +2 -0
- autoverse_cli-0.8.0/src/avrs/requests/misc.py +40 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/teleport.py +8 -6
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/simconfig.py +15 -1
- autoverse_cli-0.8.0/src/avrs/simconfig_util.py +146 -0
- autoverse_cli-0.7.0/src/avrs/requests/misc.py +0 -11
- autoverse_cli-0.7.0/src/avrs/simconfig_util.py +0 -70
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/LICENSE +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/README.md +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/setup.cfg +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/SOURCES.txt +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/dependency_links.txt +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/entry_points.txt +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/requires.txt +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/autoverse_cli.egg-info/top_level.txt +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/__init__.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/argparse_help.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/can_tool.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/can_tool_util.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/cfg.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/launcher.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/launcher_util.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/change_camera.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/code_booz.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/demo.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/environment.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/fault_injection.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/get_object_config.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/list_sim_objects.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/log_path.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/move_to_landmark.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/npc.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/request.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/reserve_mv_slot.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/reset_to_track.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/restart.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/scenario_control.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/toggle_hud.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/vd.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/vehicle_input.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/requests/vehicle_replay.py +0 -0
- {autoverse_cli-0.7.0 → autoverse_cli-0.8.0}/src/avrs/tests.py +0 -0
@@ -82,6 +82,8 @@ def main():
|
|
82
82
|
AvrsToggleHudRequest(sps, cfg)
|
83
83
|
AvrsGetObjectConfigRequest(sps, cfg)
|
84
84
|
AvrsGetSimVersionRequest(sps, cfg)
|
85
|
+
AvrsPingRequest(sps, cfg)
|
86
|
+
AvrsConfigureSimLodRequest(sps, cfg)
|
85
87
|
|
86
88
|
if os.environ.get('AVRS_WITH_DEMO', '0') == '1':
|
87
89
|
AvrsDemoRequest(sps, cfg)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
class AvrsGetSimVersionRequest(AvrsApiRequest):
|
4
|
+
def __init__(self, parser, cfg):
|
5
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'GetVersion', 0)
|
6
|
+
psr = parser.add_parser('get-sim-version', help='get the version of the currently running simulator')
|
7
|
+
psr.set_defaults(func=self.send_request)
|
8
|
+
|
9
|
+
def get_request_body(self, args):
|
10
|
+
return {
|
11
|
+
}
|
12
|
+
|
13
|
+
class AvrsPingRequest(AvrsApiRequest):
|
14
|
+
def __init__(self, parser, cfg):
|
15
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'GetVersion', 0)
|
16
|
+
psr = parser.add_parser('ping', help='ping the simulator to see if it is running and responsive')
|
17
|
+
psr.set_defaults(func=self.send_ping)
|
18
|
+
|
19
|
+
def send_ping(self, args):
|
20
|
+
try:
|
21
|
+
self.send_http_request(args)
|
22
|
+
except:
|
23
|
+
print('no')
|
24
|
+
|
25
|
+
class AvrsConfigureSimLodRequest(AvrsApiRequest):
|
26
|
+
def __init__(self, parser, cfg):
|
27
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'ConfigureSimLod', 'lodctrl')
|
28
|
+
psr = parser.add_parser('set-lod', help='set the LOD of the sim, possibly reducing GPU overhead')
|
29
|
+
|
30
|
+
psr.add_argument(
|
31
|
+
'lod',
|
32
|
+
type=int,
|
33
|
+
help='the new lod level to set. 0 is max lod, 1 is min lod')
|
34
|
+
|
35
|
+
psr.set_defaults(func=self.send_request)
|
36
|
+
|
37
|
+
def get_request_body(self, args):
|
38
|
+
return {
|
39
|
+
'newLod': args.lod
|
40
|
+
}
|
@@ -4,10 +4,11 @@ class Teleport(AvrsApiRequest):
|
|
4
4
|
def __init__(self, parser, cfg):
|
5
5
|
AvrsApiRequest.__init__(self, parser, cfg, 'Teleport', "Ego")
|
6
6
|
psr = parser.add_parser('teleport', help='Teleports the car to the given x,y,z in either enu or lla.')
|
7
|
-
psr.add_argument('x', type=float, help='new x position (NED meters)')
|
8
|
-
psr.add_argument('y', type=float, help='new y position (NED meters)')
|
9
|
-
psr.add_argument('z', type=float, help='new z position (NED meters)')
|
10
|
-
|
7
|
+
psr.add_argument('x', type=float, help='new x position (NED meters) or latitude (if frame is set to lla)')
|
8
|
+
psr.add_argument('y', type=float, help='new y position (NED meters) or longitude (if frame is set to lla)')
|
9
|
+
psr.add_argument('z', type=float, help='new z position (NED meters) or altitude (if frame is set to lla)')
|
10
|
+
psr.add_argument('--yaw', type=float, default=0.0, help='the yaw in degrees (0 north, + CW) to apply post teleport')
|
11
|
+
psr.add_argument('--frame', choices=['lla', 'ned'], default='ned', help='LLA or NED coordinate system.')
|
11
12
|
psr.set_defaults(func=self.send_request)
|
12
13
|
|
13
14
|
|
@@ -15,6 +16,7 @@ class Teleport(AvrsApiRequest):
|
|
15
16
|
return {
|
16
17
|
"X": args.x,
|
17
18
|
"Y": args.y,
|
18
|
-
"Z": args.z
|
19
|
-
|
19
|
+
"Z": args.z,
|
20
|
+
"yaw": args.yaw,
|
21
|
+
"NavFrame": args.frame
|
20
22
|
}
|
@@ -15,6 +15,17 @@ class AvrsSimConfig:
|
|
15
15
|
|
16
16
|
sps = sim_config_parser.add_subparsers(required=True, help='sim-config options')
|
17
17
|
|
18
|
+
compare_parser = sps.add_parser(
|
19
|
+
'compare-configs',
|
20
|
+
help='compare two sets of configuration files')
|
21
|
+
compare_parser.add_argument(
|
22
|
+
'a',
|
23
|
+
help='the path to the first set of config files')
|
24
|
+
compare_parser.add_argument(
|
25
|
+
'b',
|
26
|
+
help='the path to the second set of config files')
|
27
|
+
compare_parser.set_defaults(func=self.compare_configs)
|
28
|
+
|
18
29
|
apply_preset_parser = sps.add_parser(
|
19
30
|
'apply-preset',
|
20
31
|
help='apply a preset configuration for a certain use-case')
|
@@ -58,4 +69,7 @@ the target
|
|
58
69
|
return
|
59
70
|
|
60
71
|
print('applying preset {} to sim install at {}'.format(args.preset_name, sim_path))
|
61
|
-
apply_simconfig_preset(get_sim_saved_dir(sim_path), args.preset_name)
|
72
|
+
apply_simconfig_preset(get_sim_saved_dir(sim_path), args.preset_name)
|
73
|
+
|
74
|
+
def compare_configs(self, args):
|
75
|
+
compare_simconfig_defaults(args.a, args.b)
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import os
|
2
|
+
import json
|
3
|
+
|
4
|
+
class SimConfigFiles():
|
5
|
+
def __init__(self, saved_dir):
|
6
|
+
|
7
|
+
self.required_files = {
|
8
|
+
'main': os.path.join(saved_dir, 'simconfig.json'),
|
9
|
+
'eav24': os.path.join(saved_dir, 'Objects', 'Eav24_default.json'),
|
10
|
+
'yas': os.path.join(saved_dir, 'Environments', 'yasmarina_env.json')
|
11
|
+
}
|
12
|
+
self.files = {}
|
13
|
+
|
14
|
+
ok, status = self.valdiate()
|
15
|
+
if ok:
|
16
|
+
for name, path in self.required_files.items():
|
17
|
+
with open(path, 'r', encoding='utf-8') as f:
|
18
|
+
self.files[name] = json.load(f)
|
19
|
+
|
20
|
+
def valdiate(self):
|
21
|
+
for name, path in self.required_files.items():
|
22
|
+
if not os.path.exists(path):
|
23
|
+
return (False, '{} not found'.format(path))
|
24
|
+
return (True, '')
|
25
|
+
|
26
|
+
def save(self):
|
27
|
+
for name, path in self.required_files.items():
|
28
|
+
with open(path, 'w', encoding='utf-8') as f:
|
29
|
+
json.dump(self.files[name], f, ensure_ascii=False, indent=4)
|
30
|
+
|
31
|
+
def compare_simconfig_defaults(sim_saved_dir, new_defaults_dir):
|
32
|
+
old_cfg_files = SimConfigFiles(sim_saved_dir)
|
33
|
+
new_cfg_files = SimConfigFiles(new_defaults_dir)
|
34
|
+
|
35
|
+
ok, status = old_cfg_files.valdiate()
|
36
|
+
if not ok:
|
37
|
+
print(status)
|
38
|
+
return
|
39
|
+
ok, status = new_cfg_files.valdiate()
|
40
|
+
if not ok:
|
41
|
+
print(status)
|
42
|
+
return
|
43
|
+
|
44
|
+
print('comparing config files at {} with those at {}'.format(
|
45
|
+
sim_saved_dir, new_defaults_dir))
|
46
|
+
|
47
|
+
out_cpr = {}
|
48
|
+
compare_dicts(old_cfg_files.files['main'], new_cfg_files.files['main'], 'main', out_cpr)
|
49
|
+
|
50
|
+
#print('{}'.format(out_cpr))
|
51
|
+
print_simconfig_compare(out_cpr['main'])
|
52
|
+
|
53
|
+
def print_simconfig_compare(cpr):
|
54
|
+
for i in cpr['only_a']:
|
55
|
+
print('{} in a ({}) but not b'.format(i[0], i[1]))
|
56
|
+
for i in cpr['only_b']:
|
57
|
+
print('{} in b ({}) but not a'.format(i[0], i[1]))
|
58
|
+
for i in cpr['type_mismatch']:
|
59
|
+
print('{} ({}) does not match type {} ({})'.format(i[0], i[1], i[0], i[2]))
|
60
|
+
for i in cpr['value_mismatch']:
|
61
|
+
print('{} ({}) value does not match ({})'.format(i[0], i[1], i[2]))
|
62
|
+
|
63
|
+
for key, value in cpr['sub'].items():
|
64
|
+
print_simconfig_compare(value)
|
65
|
+
|
66
|
+
def compare_dicts(a, b, parent_key, out_checks):
|
67
|
+
|
68
|
+
only_a = []
|
69
|
+
only_b = []
|
70
|
+
type_mismatch = []
|
71
|
+
value_mismatch = []
|
72
|
+
|
73
|
+
out_checks[parent_key] = {}
|
74
|
+
out_checks[parent_key]['sub'] = {}
|
75
|
+
|
76
|
+
|
77
|
+
for key, value in a.items():
|
78
|
+
key_chain = '{}.{}'.format(parent_key, key)
|
79
|
+
if key not in b:
|
80
|
+
only_a.append((key_chain, value))
|
81
|
+
else:
|
82
|
+
if type(value) != type(b[key]):
|
83
|
+
type_mismatch.append((key_chain, type(value), type(b[key])))
|
84
|
+
elif isinstance(value, dict):
|
85
|
+
compare_dicts(value, b[key], key_chain, out_checks[parent_key]['sub'])
|
86
|
+
elif value != b[key]:
|
87
|
+
value_mismatch.append((key_chain, value, b[key]))
|
88
|
+
|
89
|
+
for key, value in b.items():
|
90
|
+
key_chain = '{}.{}'.format(parent_key, key)
|
91
|
+
if key not in a:
|
92
|
+
only_b.append((key_chain, value))
|
93
|
+
|
94
|
+
out_checks[parent_key]['only_a'] = only_a
|
95
|
+
out_checks[parent_key]['only_b'] = only_b
|
96
|
+
out_checks[parent_key]['type_mismatch'] = type_mismatch
|
97
|
+
out_checks[parent_key]['value_mismatch'] = value_mismatch
|
98
|
+
|
99
|
+
#print('only a \n {} \n\n'.format(only_a))
|
100
|
+
#print('only b \n {} \n\n'.format(only_b))
|
101
|
+
#print('type mismatch \n {} \n\n'.format(type_mismatch))
|
102
|
+
#print('value mismatch \n {} \n\n'.format(value_mismatch))
|
103
|
+
#print('sub_checks')
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
def apply_simconfig_preset(sim_saved_dir, preset_name):
|
108
|
+
cfg_files = SimConfigFiles(sim_saved_dir)
|
109
|
+
ok, status = cfg_files.valdiate()
|
110
|
+
if not ok:
|
111
|
+
print(status)
|
112
|
+
return
|
113
|
+
|
114
|
+
presets = {
|
115
|
+
'default': apply_default_simconfig_preset,
|
116
|
+
'lightweight': apply_lightweight_simconfig_preset,
|
117
|
+
'a2rl': apply_a2rl_simconfig_preset
|
118
|
+
}
|
119
|
+
presets[preset_name](cfg_files)
|
120
|
+
|
121
|
+
def apply_default_simconfig_preset(cfg_files):
|
122
|
+
files = cfg_files.files
|
123
|
+
|
124
|
+
print('globally enabling ROS2 and CAN')
|
125
|
+
files['main']['interfaces']['bEnableRos2'] = True
|
126
|
+
files['main']['interfaces']['bEnableCan'] = True
|
127
|
+
|
128
|
+
print('ensuring default eav24 and yasmarina are reference in main config')
|
129
|
+
if not 'Environments/yasmarina_env.json' in files['main']['environmentPaths']:
|
130
|
+
print('missing yas environment. adding')
|
131
|
+
print('{}'.format(files['main']['environmentPaths']))
|
132
|
+
if not 'Objects/Eav24_default.json' in files['main']['objectTemplatePaths']:
|
133
|
+
print('missing eav24. adding')
|
134
|
+
|
135
|
+
cfg_files.save()
|
136
|
+
|
137
|
+
|
138
|
+
def apply_lightweight_simconfig_preset(cfg_files):
|
139
|
+
files = cfg_files.files
|
140
|
+
|
141
|
+
cfg_files.save()
|
142
|
+
|
143
|
+
def apply_a2rl_simconfig_preset(cfg_files):
|
144
|
+
files = cfg_files.files
|
145
|
+
|
146
|
+
cfg_files.save()
|
@@ -1,11 +0,0 @@
|
|
1
|
-
from avrs.requests.request import AvrsApiRequest
|
2
|
-
|
3
|
-
class AvrsGetSimVersionRequest(AvrsApiRequest):
|
4
|
-
def __init__(self, parser, cfg):
|
5
|
-
AvrsApiRequest.__init__(self, parser, cfg, 'GetVersion', 0)
|
6
|
-
psr = parser.add_parser('get-sim-version', help='get the version of the currently running simulator')
|
7
|
-
psr.set_defaults(func=self.send_request)
|
8
|
-
|
9
|
-
def get_request_body(self, args):
|
10
|
-
return {
|
11
|
-
}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
import json
|
3
|
-
|
4
|
-
class SimConfigFiles():
|
5
|
-
def __init__(self, saved_dir):
|
6
|
-
|
7
|
-
self.required_files = {
|
8
|
-
'main': os.path.join(saved_dir, 'simconfig.json'),
|
9
|
-
'eav24': os.path.join(saved_dir, 'Objects', 'Eav24_default.json'),
|
10
|
-
'yas': os.path.join(saved_dir, 'Environments', 'yasmarina_env.json')
|
11
|
-
}
|
12
|
-
self.files = {}
|
13
|
-
|
14
|
-
ok, status = self.valdiate()
|
15
|
-
if ok:
|
16
|
-
for name, path in self.required_files.items():
|
17
|
-
with open(path, 'r', encoding='utf-8') as f:
|
18
|
-
self.files[name] = json.load(f)
|
19
|
-
|
20
|
-
def valdiate(self):
|
21
|
-
for name, path in self.required_files.items():
|
22
|
-
if not os.path.exists(path):
|
23
|
-
return (False, '{} not found'.format(path))
|
24
|
-
return (True, '')
|
25
|
-
|
26
|
-
def save(self):
|
27
|
-
for name, path in self.required_files.items():
|
28
|
-
with open(path, 'w', encoding='utf-8') as f:
|
29
|
-
json.dump(self.files[name], f, ensure_ascii=False, indent=4)
|
30
|
-
|
31
|
-
def apply_simconfig_preset(sim_saved_dir, preset_name):
|
32
|
-
cfg_files = SimConfigFiles(sim_saved_dir)
|
33
|
-
ok, status = cfg_files.valdiate()
|
34
|
-
if not ok:
|
35
|
-
print(status)
|
36
|
-
return
|
37
|
-
|
38
|
-
presets = {
|
39
|
-
'default': apply_default_simconfig_preset,
|
40
|
-
'lightweight': apply_lightweight_simconfig_preset,
|
41
|
-
'a2rl': apply_a2rl_simconfig_preset
|
42
|
-
}
|
43
|
-
presets[preset_name](cfg_files)
|
44
|
-
|
45
|
-
def apply_default_simconfig_preset(cfg_files):
|
46
|
-
files = cfg_files.files
|
47
|
-
|
48
|
-
print('globally enabling ROS2 and CAN')
|
49
|
-
files['main']['interfaces']['bEnableRos2'] = True
|
50
|
-
files['main']['interfaces']['bEnableCan'] = True
|
51
|
-
|
52
|
-
print('ensuring default eav24 and yasmarina are reference in main config')
|
53
|
-
if not 'Environments/yasmarina_env.json' in files['main']['environmentPaths']:
|
54
|
-
print('missing yas environment. adding')
|
55
|
-
print('{}'.format(files['main']['environmentPaths']))
|
56
|
-
if not 'Objects/Eav24_default.json' in files['main']['objectTemplatePaths']:
|
57
|
-
print('missing eav24. adding')
|
58
|
-
|
59
|
-
cfg_files.save()
|
60
|
-
|
61
|
-
|
62
|
-
def apply_lightweight_simconfig_preset(cfg_files):
|
63
|
-
files = cfg_files.files
|
64
|
-
|
65
|
-
cfg_files.save()
|
66
|
-
|
67
|
-
def apply_a2rl_simconfig_preset(cfg_files):
|
68
|
-
files = cfg_files.files
|
69
|
-
|
70
|
-
cfg_files.save()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|