autoverse-cli 0.1.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- autoverse_cli-0.1.0.dist-info/LICENSE +33 -0
- autoverse_cli-0.1.0.dist-info/METADATA +47 -0
- autoverse_cli-0.1.0.dist-info/RECORD +25 -0
- autoverse_cli-0.1.0.dist-info/WHEEL +5 -0
- autoverse_cli-0.1.0.dist-info/entry_points.txt +2 -0
- autoverse_cli-0.1.0.dist-info/top_level.txt +1 -0
- avrs/__init__.py +0 -0
- avrs/app_version.py +24 -0
- avrs/avrs.py +64 -0
- avrs/cfg.py +26 -0
- avrs/launcher.py +164 -0
- avrs/launcher_util.py +158 -0
- avrs/requests/can.py +131 -0
- avrs/requests/demo.py +23 -0
- avrs/requests/input.py +46 -0
- avrs/requests/log_path.py +28 -0
- avrs/requests/move_to_landmark.py +16 -0
- avrs/requests/npc.py +289 -0
- avrs/requests/request.py +45 -0
- avrs/requests/reserve_mv_slot.py +111 -0
- avrs/requests/reset_to_track.py +12 -0
- avrs/requests/restart.py +12 -0
- avrs/requests/teleport.py +20 -0
- avrs/requests/vd.py +33 -0
- avrs/tests.py +9 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
RESERVE_MV_SLOT_HELP = '''
|
4
|
+
slot (if an open slot exists, there are 4 total) using the given name to add a new vehicle and the appropriate topics.
|
5
|
+
It will despawn the default vehicle and remove the default ROS topics when it is first run. Each vehicle added will be
|
6
|
+
given its own topics prefixed by the given name, and the slot index will correspond to the vcan it will use.
|
7
|
+
Note that this will require having active vcans for each vehicle you wish to use.
|
8
|
+
(eg, if you want to use 4 vehicles, you will need vcan0, vcan1, vcan2, and vcan3)
|
9
|
+
'''
|
10
|
+
|
11
|
+
# use these to spawn MVs
|
12
|
+
MV_LANDMARKS = [
|
13
|
+
'MvStart0',
|
14
|
+
'MvStart1',
|
15
|
+
'MvStart2',
|
16
|
+
'MvStart3'
|
17
|
+
]
|
18
|
+
|
19
|
+
class ReserveMvSlot(AvrsApiRequest):
|
20
|
+
def __init__(self, parser, cfg):
|
21
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'SpawnObject', 0)
|
22
|
+
psr = parser.add_parser('reserve-mv-slot', help=RESERVE_MV_SLOT_HELP)
|
23
|
+
|
24
|
+
psr.add_argument(
|
25
|
+
'slot_name',
|
26
|
+
help='the name of the vehicle to put in the specified slot')
|
27
|
+
|
28
|
+
psr.add_argument(
|
29
|
+
'slot_index',
|
30
|
+
type=int,
|
31
|
+
choices=[0, 1, 2, 3],
|
32
|
+
help='the slot index (0-4) to reserve')
|
33
|
+
|
34
|
+
psr.add_argument(
|
35
|
+
'--bsu-can-name',
|
36
|
+
default='vcan0',
|
37
|
+
help='the name of the CAN interface to use for the BSU CAN bus on the new vehicle')
|
38
|
+
|
39
|
+
psr.add_argument(
|
40
|
+
'--kistler-can-name',
|
41
|
+
default='vcan1',
|
42
|
+
help='the name of the CAN interface to use for the Kistler CAN bus on the new vehicle')
|
43
|
+
|
44
|
+
psr.add_argument(
|
45
|
+
'--badenia-can-name',
|
46
|
+
default='vcan1',
|
47
|
+
help='the name of the CAN interface to use for the bandanania CAN bus on the new vehicle')
|
48
|
+
|
49
|
+
psr.add_argument(
|
50
|
+
'--with-view-cameras',
|
51
|
+
action='store_true',
|
52
|
+
help='if the new vehicle should have cameras attached to it')
|
53
|
+
|
54
|
+
psr.add_argument(
|
55
|
+
'--enable-lidar',
|
56
|
+
action='store_true',
|
57
|
+
help='if set, the lidar will be enabled on the new vehicle')
|
58
|
+
|
59
|
+
psr.add_argument(
|
60
|
+
'--enable-camera-sensor',
|
61
|
+
action='store_true',
|
62
|
+
help='if set, the camera will be enabled on the new vehicle')
|
63
|
+
|
64
|
+
psr.add_argument(
|
65
|
+
'--disable-hud',
|
66
|
+
action='store_true',
|
67
|
+
help='if set, the new vehicle will not create a HUD (mutiple HUDs will clutter the screen)')
|
68
|
+
|
69
|
+
|
70
|
+
psr.set_defaults(func=self.send_request)
|
71
|
+
|
72
|
+
def get_request_body(self, args):
|
73
|
+
|
74
|
+
eav_init_pld = {
|
75
|
+
'TypeName': 'Eav24Initializer',
|
76
|
+
'Body': {
|
77
|
+
'BsuCanName': args.bsu_can_name,
|
78
|
+
'KistlerCanNam': args.kistler_can_name,
|
79
|
+
'BadeniaCanName': args.badenia_can_name,
|
80
|
+
'bHudEnabled': not args.disable_hud,
|
81
|
+
'bEnableLidar': args.enable_lidar,
|
82
|
+
'bEnableCameraSensor': args.enable_camera_sensor
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
plds = [
|
87
|
+
eav_init_pld
|
88
|
+
]
|
89
|
+
|
90
|
+
if args.with_view_cameras:
|
91
|
+
plds.append(
|
92
|
+
{
|
93
|
+
'TypeName': 'InitializerTemplates',
|
94
|
+
'Body': {
|
95
|
+
'Templates': [
|
96
|
+
{
|
97
|
+
'PayloadType': 'SimViewTargetIpd',
|
98
|
+
'PayloadSpec': 'DefaultCarCams'
|
99
|
+
}
|
100
|
+
]
|
101
|
+
}
|
102
|
+
})
|
103
|
+
|
104
|
+
return {
|
105
|
+
'Name': args.slot_name,
|
106
|
+
'Type': 'Eav24',
|
107
|
+
'Location': {},
|
108
|
+
'Rotation': {},
|
109
|
+
'Landmark': MV_LANDMARKS[args.slot_index],
|
110
|
+
'Payloads': plds
|
111
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
class ResetToTrack(AvrsApiRequest):
|
4
|
+
def __init__(self, parser, cfg):
|
5
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'ResetToTrack', 'Ego')
|
6
|
+
psr = parser.add_parser('reset-to-track', help='moves the car to the closest point on track pointing down track')
|
7
|
+
psr.set_defaults(func=self.send_request)
|
8
|
+
|
9
|
+
def get_request_body(self, args):
|
10
|
+
return {
|
11
|
+
|
12
|
+
}
|
avrs/requests/restart.py
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
class Restart(AvrsApiRequest):
|
4
|
+
def __init__(self, parser, cfg):
|
5
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'RestartSimulation', 0)
|
6
|
+
psr = parser.add_parser('restart', help='command to restart the entire simulator')
|
7
|
+
psr.set_defaults(func=self.send_request)
|
8
|
+
|
9
|
+
def get_request_body(self, args):
|
10
|
+
return {
|
11
|
+
|
12
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
from avrs.requests.request import AvrsApiRequest
|
2
|
+
|
3
|
+
class Teleport(AvrsApiRequest):
|
4
|
+
def __init__(self, parser, cfg):
|
5
|
+
AvrsApiRequest.__init__(self, parser, cfg, 'Teleport', "Car1")
|
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')
|
8
|
+
psr.add_argument('y', type=float, help='new y position')
|
9
|
+
psr.add_argument('z', type=float, help='new z position')
|
10
|
+
#psr.add_argument('nav', help='lla or enu coordinate system.', nargs=1, choices=('lla', 'enu'))
|
11
|
+
psr.set_defaults(func=self.send_request)
|
12
|
+
|
13
|
+
|
14
|
+
def get_request_body(self, args):
|
15
|
+
return {
|
16
|
+
"X": args.x,
|
17
|
+
"Y": args.y,
|
18
|
+
"Z": args.z
|
19
|
+
#'NavFrame': args.nav
|
20
|
+
}
|
avrs/requests/vd.py
ADDED
@@ -0,0 +1,33 @@
|
|
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
|
+
}
|