autoverse-cli 0.2.2__tar.gz → 0.4.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/PKG-INFO +1 -1
  2. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/pyproject.toml +1 -1
  3. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/PKG-INFO +1 -1
  4. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/SOURCES.txt +3 -0
  5. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/app_version.py +1 -1
  6. autoverse_cli-0.4.0/src/avrs/argparse_help.py +30 -0
  7. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/avrs.py +11 -3
  8. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/launcher.py +1 -1
  9. autoverse_cli-0.4.0/src/avrs/requests/code_booz.py +65 -0
  10. autoverse_cli-0.4.0/src/avrs/requests/edit_environment.py +21 -0
  11. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/request.py +1 -1
  12. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/reserve_mv_slot.py +2 -1
  13. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/teleport.py +1 -1
  14. autoverse_cli-0.4.0/src/avrs/requests/vd.py +36 -0
  15. autoverse_cli-0.2.2/src/avrs/requests/vd.py +0 -33
  16. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/LICENSE +0 -0
  17. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/README.md +0 -0
  18. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/setup.cfg +0 -0
  19. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/dependency_links.txt +0 -0
  20. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/entry_points.txt +0 -0
  21. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/autoverse_cli.egg-info/top_level.txt +0 -0
  22. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/__init__.py +0 -0
  23. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/cfg.py +0 -0
  24. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/launcher_util.py +0 -0
  25. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/can.py +0 -0
  26. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/demo.py +0 -0
  27. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/input.py +0 -0
  28. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/log_path.py +0 -0
  29. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/move_to_landmark.py +0 -0
  30. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/npc.py +0 -0
  31. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/reset_to_track.py +0 -0
  32. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/requests/restart.py +0 -0
  33. {autoverse_cli-0.2.2 → autoverse_cli-0.4.0}/src/avrs/tests.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autoverse-cli
3
- Version: 0.2.2
3
+ Version: 0.4.0
4
4
  Summary: The Autoverse CLI
5
5
  Author-email: Dan Kamrath <dan.kamrath@autonomalabs.com>
6
6
  License: # End-User License Agreement (EULA) of the Autonoma AutoVerse CLI
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "autoverse-cli"
3
- version = "0.2.2"
3
+ version = "0.4.0"
4
4
  authors = [
5
5
  { name="Dan Kamrath", email="dan.kamrath@autonomalabs.com" },
6
6
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: autoverse-cli
3
- Version: 0.2.2
3
+ Version: 0.4.0
4
4
  Summary: The Autoverse CLI
5
5
  Author-email: Dan Kamrath <dan.kamrath@autonomalabs.com>
6
6
  License: # End-User License Agreement (EULA) of the Autonoma AutoVerse CLI
@@ -8,13 +8,16 @@ src/autoverse_cli.egg-info/entry_points.txt
8
8
  src/autoverse_cli.egg-info/top_level.txt
9
9
  src/avrs/__init__.py
10
10
  src/avrs/app_version.py
11
+ src/avrs/argparse_help.py
11
12
  src/avrs/avrs.py
12
13
  src/avrs/cfg.py
13
14
  src/avrs/launcher.py
14
15
  src/avrs/launcher_util.py
15
16
  src/avrs/tests.py
16
17
  src/avrs/requests/can.py
18
+ src/avrs/requests/code_booz.py
17
19
  src/avrs/requests/demo.py
20
+ src/avrs/requests/edit_environment.py
18
21
  src/avrs/requests/input.py
19
22
  src/avrs/requests/log_path.py
20
23
  src/avrs/requests/move_to_landmark.py
@@ -2,7 +2,7 @@ import http.client
2
2
  import json
3
3
 
4
4
  def get_app_version():
5
- return '0.2.2'
5
+ return '0.4.0'
6
6
 
7
7
  def check_app_is_latest():
8
8
  pass
@@ -0,0 +1,30 @@
1
+ import argparse
2
+
3
+ def generate_argparse_docs(parser):
4
+ """
5
+ Try to generate a nice markdown with all help from a parser
6
+ """
7
+ s = recursive_get_argparse_help(parser, 'avrs', True)
8
+ #print(s)
9
+
10
+ with open('out.txt', 'w', encoding='utf-8') as f:
11
+ f.write(s)
12
+
13
+ def recursive_get_argparse_help(parser, parent_name, is_root):
14
+
15
+ s = ''
16
+ if not is_root:
17
+ s += '\n' + '_' * 72 + '\n\n'
18
+
19
+ s += '{}\n'.format(parent_name)
20
+ s += '{}\n'.format(parser.format_help())
21
+
22
+ for action in parser._actions:
23
+ if isinstance(action, argparse._SubParsersAction):
24
+ #s += '{}\n'.format(dir(action))
25
+ #s += '{}\n'.format(action._choices_actions)
26
+ #for a in action._choices_actions:
27
+ # s += '{}\n'.format(a.dest)
28
+ for subcmd, subpsr in action.choices.items():
29
+ s += recursive_get_argparse_help(subpsr, parent_name + ' ' + subcmd, False)
30
+ return s
@@ -6,6 +6,7 @@ from argparse import RawTextHelpFormatter
6
6
  from avrs.app_version import *
7
7
  from avrs.cfg import *
8
8
  from avrs.launcher import *
9
+ from avrs.argparse_help import *
9
10
 
10
11
  from avrs.requests.move_to_landmark import MoveToLandmarkRequest
11
12
  from avrs.requests.restart import Restart
@@ -18,6 +19,8 @@ from avrs.requests.vd import Vd
18
19
  from avrs.requests.input import InputRequest
19
20
  from avrs.requests.log_path import LogPath
20
21
  from avrs.requests.demo import AvrsDemoRequest
22
+ from avrs.requests.edit_environment import AvrsEditEnvironmentRequests
23
+ from avrs.requests.code_booz import *
21
24
 
22
25
 
23
26
  def get_version():
@@ -28,7 +31,7 @@ def main():
28
31
  prog='avrs',
29
32
  description='Autoverse CLI',
30
33
  epilog='',
31
- formatter_class=RawDescriptionHelpFormatter)
34
+ formatter_class=RawTextHelpFormatter)
32
35
 
33
36
  version_psr = parser.add_argument(
34
37
  '--version',
@@ -54,11 +57,16 @@ def main():
54
57
  Vd(sps, cfg)
55
58
  #InputRequest(sps, cfg)
56
59
  LogPath(sps, cfg)
57
- #AvrsDemoRequest(sps, cfg)
58
-
60
+ AvrsEditEnvironmentRequests(sps, cfg)
61
+ AvrsCodeBoozRequest(sps, cfg)
62
+ AvrsDemoRequest(sps, cfg)
63
+
64
+ if os.environ.get('AVRS_GEN_DOCS', '0') == '1':
65
+ generate_argparse_docs(parser)
59
66
 
60
67
  args = parser.parse_args()
61
68
  args.func(args)
62
69
 
70
+
63
71
  if __name__ == '__main__':
64
72
  main()
@@ -11,7 +11,7 @@ class AvrsLauncher:
11
11
  self.cfg = cfg
12
12
  provision_parser = parent_parser.add_parser(
13
13
  'launcher',
14
- help='launcher operations, such as license registration or updating a sim install')
14
+ help='launcher operations, such as license registration or updating a sim install\n\n')
15
15
  sps = provision_parser.add_subparsers(required=True, help='launcher options')
16
16
 
17
17
  register_license_psr = sps.add_parser(
@@ -0,0 +1,65 @@
1
+ from avrs.requests.request import AvrsApiRequest
2
+ from argparse import RawTextHelpFormatter
3
+
4
+ class AvrsCodeBoozRequest():
5
+ def __init__(self, parent_parser, cfg):
6
+ psr = parent_parser.add_parser(
7
+ 'lwi',
8
+ help='light-weight interface logging options\n\n')
9
+ sps = psr.add_subparsers(required=True, help='light-wieght interface logging options')
10
+
11
+ AvrsCodeBoozStartLogging(sps, cfg)
12
+ AvrsCodeBoozStopLogging(sps, cfg)
13
+ AvrsCodeBoozGetTimes(sps, cfg)
14
+
15
+ class AvrsCodeBoozStartLogging(AvrsApiRequest):
16
+ def __init__(self, parser, cfg):
17
+ AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
18
+ psr = parser.add_parser(
19
+ 'start-log', help='starts logging', formatter_class=RawTextHelpFormatter)
20
+
21
+ psr.add_argument(
22
+ 'out_file',
23
+ help='the name of the log file to create (within the \"Saved\" directory)')
24
+
25
+ psr.add_argument(
26
+ '--format', choices=('binary', 'csv'), default='binary', help='the format to save logged data')
27
+
28
+ psr.add_argument(
29
+ '--rate-hz', type=float, default=100.0, help='the rate in hz to log data')
30
+
31
+ psr.set_defaults(func=self.send_request)
32
+
33
+ def get_request_body(self, args):
34
+ return {
35
+ 'Action': 'Start',
36
+ 'FileName': args.out_file,
37
+ 'RateHz': args.rate_hz,
38
+ 'Format': args.format
39
+ }
40
+
41
+ class AvrsCodeBoozStopLogging(AvrsApiRequest):
42
+ def __init__(self, parser, cfg):
43
+ AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
44
+ psr = parser.add_parser(
45
+ 'stop-log', help='starts logging', formatter_class=RawTextHelpFormatter)
46
+
47
+ psr.set_defaults(func=self.send_request)
48
+
49
+ def get_request_body(self, args):
50
+ return {
51
+ 'Action': 'Stop'
52
+ }
53
+
54
+ class AvrsCodeBoozGetTimes(AvrsApiRequest):
55
+ def __init__(self, parser, cfg):
56
+ AvrsApiRequest.__init__(self, parser, cfg, 'CodeBoozLog', 'Ego')
57
+ psr = parser.add_parser(
58
+ 'get-times', help='starts logging', formatter_class=RawTextHelpFormatter)
59
+
60
+ psr.set_defaults(func=self.send_request)
61
+
62
+ def get_request_body(self, args):
63
+ return {
64
+ 'Action': 'GetTimes'
65
+ }
@@ -0,0 +1,21 @@
1
+ from avrs.requests.request import AvrsApiRequest
2
+
3
+ class AvrsEditEnvironmentRequests():
4
+ def __init__(self, parser, cfg):
5
+ psr = parser.add_parser('edit-environment', help='Edits the environment')
6
+ sps = psr.add_subparsers(required= True, help='')
7
+ AvrsSetTimeOfDayRequest(sps, cfg)
8
+
9
+
10
+ class AvrsSetTimeOfDayRequest(AvrsApiRequest):
11
+ def __init__(self, parser, cfg):
12
+ AvrsApiRequest.__init__(self, parser, cfg, 'SetTimeOfDay', '')
13
+ psr = parser.add_parser('set-time-of-day', help='sets the current time of day')
14
+ psr.add_argument('tod', type=float, help='The time of day (0-24) to set')
15
+ psr.set_defaults(func=self.send_request)
16
+
17
+ def get_request_body(self, args):
18
+ self.target_object_id = ''
19
+ return {
20
+ 'TimeOfDay': args.tod
21
+ }
@@ -35,7 +35,7 @@ class AvrsApiRequest:
35
35
  # print('{}'.format(response))
36
36
 
37
37
  def send_http_request(self, args):
38
- connection = http.client.HTTPConnection("localhost", 30313, timeout=2)
38
+ connection = http.client.HTTPConnection("localhost", 30313, timeout=10)
39
39
  headers = {'Content-type': 'application/json'}
40
40
  body = json.dumps(self.get_request(args)).encode('utf-8')
41
41
  connection.request('POST', '/post', body, headers)
@@ -1,4 +1,5 @@
1
1
  from avrs.requests.request import AvrsApiRequest
2
+ from argparse import RawTextHelpFormatter
2
3
 
3
4
  RESERVE_MV_SLOT_HELP = '''
4
5
  slot (if an open slot exists, there are 4 total) using the given name to add a new vehicle and the appropriate topics.
@@ -19,7 +20,7 @@ MV_LANDMARKS = [
19
20
  class ReserveMvSlot(AvrsApiRequest):
20
21
  def __init__(self, parser, cfg):
21
22
  AvrsApiRequest.__init__(self, parser, cfg, 'SpawnObject', 0)
22
- psr = parser.add_parser('reserve-mv-slot', help=RESERVE_MV_SLOT_HELP)
23
+ psr = parser.add_parser('reserve-mv-slot', help=RESERVE_MV_SLOT_HELP, formatter_class=RawTextHelpFormatter)
23
24
 
24
25
  psr.add_argument(
25
26
  'slot_name',
@@ -2,7 +2,7 @@ from avrs.requests.request import AvrsApiRequest
2
2
 
3
3
  class Teleport(AvrsApiRequest):
4
4
  def __init__(self, parser, cfg):
5
- AvrsApiRequest.__init__(self, parser, cfg, 'Teleport', "Car1")
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
7
  psr.add_argument('x', type=float, help='new x position')
8
8
  psr.add_argument('y', type=float, help='new y position')
@@ -0,0 +1,36 @@
1
+ from avrs.requests.request import AvrsApiRequest
2
+
3
+ class Vd():
4
+ def __init__(self, parser, cfg):
5
+ psr = parser.add_parser('vd', help='Vehicle dynamic options')
6
+ sps = psr.add_subparsers(required= True, help='sub-command of vd')
7
+ SetFrictionModifier(sps, cfg)
8
+ #SlipModel(sps, cfg)
9
+
10
+ class SetFrictionModifier(AvrsApiRequest):
11
+ def __init__(self, parser, cfg):
12
+ AvrsApiRequest.__init__(self, parser, cfg, 'SetFrictionModifiers', 'Ego')
13
+ psr = parser.add_parser('set-friction-modifier', help='Change the amount of grip the car has.'
14
+ + '0 is no grip and higher values will prevent spinning')
15
+ psr.add_argument('modifier', type = float, help = "Modified grip value")
16
+ psr.add_argument('tires', help = "Tires to apply the modifier to",
17
+ choices=("FL", "FR", "RL", "RR", "F", "R", "All"))
18
+ psr.set_defaults(func=self.send_request)
19
+
20
+ def get_request_body(self, args):
21
+ return {
22
+ 'NewModifier': args.modifier,
23
+ 'Tires': args.tires
24
+ }
25
+
26
+ # class SlipModel(AvrsApiRequest):
27
+ # def __init__(self, parser, cfg):
28
+ # AvrsApiRequest.__init__(self, parser, cfg, 'SlipModel', 'Ego')
29
+ # psr = parser.add_parser('slip-model', help='Change the tire slip model to be pure slip only or combined slip')
30
+ # psr.add_argument('slip', choices = ['pure-slip, combined-slip'], help = 'type of slip')
31
+ # psr.set_defaults(func=self.send_request)
32
+
33
+ # def get_request_body(self, args):
34
+ # return {
35
+ # 'Modifier Value': args.slip
36
+ # }
@@ -1,33 +0,0 @@
1
- from avrs.requests.request import AvrsApiRequest
2
-
3
- class Vd():
4
- def __init__(self, parser, cfg):
5
- psr = parser.add_parser('vd', help='Vehicle dynamic options')
6
- sps = psr.add_subparsers(required= True, help='sub-command of vd')
7
- SetFrictionModifier(sps, cfg)
8
- SlipModel(sps, cfg)
9
-
10
- class SetFrictionModifier(AvrsApiRequest):
11
- def __init__(self, parser, cfg):
12
- AvrsApiRequest.__init__(self, parser, cfg, 'SetFrictionModifiers', 0)
13
- psr = parser.add_parser('set-friction-modifier', help='Change the amount of grip the car has.'
14
- + '0 is no grip and higher values will prevent spinning')
15
- psr.add_argument('modifier-value', type = float, help = "Modified grip value")
16
- psr.set_defaults(func=self.send_request)
17
-
18
- def get_request_body(self, args):
19
- return {
20
- 'Modifier Value': args.modifier-value
21
- }
22
-
23
- class SlipModel(AvrsApiRequest):
24
- def __init__(self, parser, cfg):
25
- AvrsApiRequest.__init__(self, parser, cfg, 'SlipModel', 0)
26
- psr = parser.add_parser('slip-model', help='Change the tire slip model to be pure slip only or combined slip')
27
- psr.add_argument('slip', choices = ['pure-slip, combined-slip'], help = 'type of slip')
28
- psr.set_defaults(func=self.send_request)
29
-
30
- def get_request_body(self, args):
31
- return {
32
- 'Modifier Value': args.slip
33
- }
File without changes
File without changes
File without changes