verse-lib 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- verse/__init__.py +8 -0
- verse/agents/__init__.py +2 -0
- verse/agents/base_agent.py +93 -0
- verse/agents/example_agent/__init__.py +3 -0
- verse/agents/example_agent/ball_agent.py +43 -0
- verse/agents/example_agent/ballg_agent.py +42 -0
- verse/agents/example_agent/car_agent.py +254 -0
- verse/agents/example_agent/line_agent.py +40 -0
- verse/agents/example_agent/origin_agent.py +183 -0
- verse/agents/example_agent/prarm.json +184 -0
- verse/agents/example_agent/quadrotor_agent.py +249 -0
- verse/agents/example_agent/robot_agent.py +37 -0
- verse/agents/example_agent/sign_agent.py +15 -0
- verse/analysis/__init__.py +6 -0
- verse/analysis/analysis_tree.py +571 -0
- verse/analysis/dryvr.py +320 -0
- verse/analysis/dryvr_disc.py +269 -0
- verse/analysis/incremental.py +402 -0
- verse/analysis/mixmonotone.py +291 -0
- verse/analysis/parsed_wrap/__init__.py +3 -0
- verse/analysis/parsed_wrap/_cache.py +95 -0
- verse/analysis/parsed_wrap/bounded_angular.py +434 -0
- verse/analysis/parsed_wrap/bounded_map.py +53 -0
- verse/analysis/parsed_wrap/bounded_piecewise.py +292 -0
- verse/analysis/parsed_wrap/parser_wrapper.py +454 -0
- verse/analysis/parsed_wrap/sensor_parser.py +582 -0
- verse/analysis/parsed_wrap/wrapper_consts.py +29 -0
- verse/analysis/simulator.py +893 -0
- verse/analysis/verifier.py +1899 -0
- verse/automaton/__init__.py +3 -0
- verse/automaton/guard.py +1348 -0
- verse/automaton/hybrid_automaton.py +34 -0
- verse/automaton/hybrid_io_automaton.py +30 -0
- verse/automaton/reset.py +110 -0
- verse/map/__init__.py +5 -0
- verse/map/example_map/__init__.py +2 -0
- verse/map/example_map/intersection.py +127 -0
- verse/map/example_map/map_tacas.py +262 -0
- verse/map/example_map/simple_map.py +31 -0
- verse/map/example_map/simple_map2.py +188 -0
- verse/map/example_map/simple_map_3d.py +278 -0
- verse/map/lane.py +60 -0
- verse/map/lane_3d.py +78 -0
- verse/map/lane_map.py +120 -0
- verse/map/lane_map_3d.py +293 -0
- verse/map/lane_segment.py +324 -0
- verse/map/lane_segment_3d.py +638 -0
- verse/map/opendrive_parser.py +483 -0
- verse/parser/__init__.py +2 -0
- verse/parser/astunparser.py +989 -0
- verse/parser/parser.py +967 -0
- verse/plotter/__init__.py +23 -0
- verse/plotter/plotter2D.py +2864 -0
- verse/plotter/plotter2D_old.py +223 -0
- verse/plotter/plotter3D.py +147 -0
- verse/plotter/plotter3D_new.py +735 -0
- verse/plotter/plotterStar.py +105 -0
- verse/scenario/__init__.py +2 -0
- verse/scenario/scenario.py +595 -0
- verse/sensor/__init__.py +2 -0
- verse/sensor/base_sensor.py +135 -0
- verse/sensor/base_sensor_stars.py +159 -0
- verse/sensor/example_sensor/__init__.py +0 -0
- verse/sensor/example_sensor/craft_sensor.py +62 -0
- verse/sensor/example_sensor/craft_star_sensor.py +81 -0
- verse/sensor/example_sensor/quadrotor_sensor.py +62 -0
- verse/sensor/example_sensor/single_sensor.py +179 -0
- verse/sensor/example_sensor/thermo_sensor.py +62 -0
- verse/stars/__init__.py +3 -0
- verse/stars/reach_at_star.py +73 -0
- verse/stars/starset.py +889 -0
- verse/stars/startests.py +383 -0
- verse/utils/__init__.py +2 -0
- verse/utils/fixed_points.py +125 -0
- verse/utils/star_diams.py +171 -0
- verse/utils/star_manhattan.py +232 -0
- verse/utils/utils.py +437 -0
- verse_lib-2.0.0.dist-info/METADATA +337 -0
- verse_lib-2.0.0.dist-info/RECORD +82 -0
- verse_lib-2.0.0.dist-info/WHEEL +5 -0
- verse_lib-2.0.0.dist-info/licenses/Licence.txt +16 -0
- verse_lib-2.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bias1" : [0.005067077465355396, 0.013770184479653835, 0.02960527129471302, -0.005076207220554352,
|
|
3
|
+
0.00986097939312458, -0.004963981453329325, 0.005067163147032261, 0.022097138687968254,
|
|
4
|
+
0.005067095160484314, -0.009861057624220848, -0.005051563028246164, -0.013770153746008873,
|
|
5
|
+
0.009860980324447155, 0.009861058555543423, 0.013770055025815964, 0.005067105405032635,
|
|
6
|
+
-0.01376994326710701, 0.005067072343081236, -0.005067067686468363, -0.013769976794719696],
|
|
7
|
+
"bias2" : [-0.009237067773938179, -0.00437132129445672, 0.0007612668559886515, 0.009431629441678524,
|
|
8
|
+
-0.04935901612043381, 0.00892704352736473, 0.00891881249845028, -0.042356036603450775, 0.03377627208828926,
|
|
9
|
+
0.014071502722799778, -0.0018434594385325909, -0.0006053714314475656, -0.0038432874716818333,
|
|
10
|
+
-0.007012223359197378, -0.0007034881855361164, 0.007561248727142811, -0.042776428163051605,
|
|
11
|
+
0.009373181499540806, 0.0031296780798584223, 0.008734943345189095],
|
|
12
|
+
"bias3" : [-0.8870829939842224, -1.152485728263855, -1.3024290800094604, -1.1338839530944824, -0.12526285648345947,
|
|
13
|
+
-0.35318782925605774, -0.9353211522102356, -1.0099754333496094],
|
|
14
|
+
"weight1" : [
|
|
15
|
+
[-0.012771551497280598, 0.8522672653198242, 0.005031325854361057, 0.010413140058517456, 0.5228086709976196,
|
|
16
|
+
0.0038109351880848408],
|
|
17
|
+
[0.01777890883386135, 0.011899493634700775, -0.8380187153816223, 0.010888529941439629, 0.011424682103097439,
|
|
18
|
+
-0.5449933409690857],
|
|
19
|
+
[0.01807912439107895, 0.012226282618939877, -0.8379306793212891, 0.011077952571213245, 0.011494635604321957,
|
|
20
|
+
-0.5451062917709351],
|
|
21
|
+
[0.01277169119566679, -0.8522672057151794, -0.005030765198171139, -0.010413102805614471, -0.5228087902069092,
|
|
22
|
+
-0.0038107011932879686],
|
|
23
|
+
[-0.8513970971107483, -0.01639718748629093, -0.015279111452400684, -0.5237646102905273, -0.014861795119941235,
|
|
24
|
+
-0.008371188305318356],
|
|
25
|
+
[0.012770231813192368, -0.8522675633430481, -0.005036665592342615, -0.010414107702672482, -0.5228080749511719,
|
|
26
|
+
-0.0038130702450871468],
|
|
27
|
+
[-0.012771555222570896, 0.8522672653198242, 0.005031300242990255, 0.01041315495967865, 0.5228086709976196,
|
|
28
|
+
0.0038109151646494865],
|
|
29
|
+
[-0.8513400554656982, -0.01752384752035141, -0.01597718894481659, -0.5237532258033752, -0.01596754789352417,
|
|
30
|
+
-0.009223726578056812],
|
|
31
|
+
[-0.012771563604474068, 0.8522672057151794, 0.005031331907957792, 0.010413155891001225, 0.5228087902069092,
|
|
32
|
+
0.0038109072484076023],
|
|
33
|
+
[0.8513972163200378, 0.016397155821323395, 0.015279067680239677, 0.5237646698951721, 0.014861810952425003,
|
|
34
|
+
0.008371211588382721],
|
|
35
|
+
[0.012771359644830227, -0.8522672653198242, -0.005032065790146589, -0.010413287207484245, -0.5228086709976196,
|
|
36
|
+
-0.003811270697042346],
|
|
37
|
+
[-0.01777891255915165, -0.011899505741894245, 0.8380184173583984, -0.010888525284826756, -0.011424724943935871,
|
|
38
|
+
0.5449937582015991],
|
|
39
|
+
[-0.8513973355293274, -0.016397180035710335, -0.01527908630669117, -0.5237643718719482, -0.014861813746392727,
|
|
40
|
+
-0.008371248841285706],
|
|
41
|
+
[-0.8513972163200378, -0.01639718748629093, -0.0152790741994977, -0.5237645506858826, -0.01486178208142519,
|
|
42
|
+
-0.008371269330382347],
|
|
43
|
+
[0.01777891255915165, 0.011899520643055439, -0.8380185961723328, 0.010888495482504368, 0.011424724012613297,
|
|
44
|
+
-0.54499351978302],
|
|
45
|
+
[-0.012771572917699814, 0.8522672653198242, 0.005031317938119173, 0.010413181968033314, 0.5228086709976196,
|
|
46
|
+
0.003810951951891184],
|
|
47
|
+
[-0.017778869718313217, -0.011899495497345924, 0.838018536567688, -0.010888428427278996, -0.011424727737903595,
|
|
48
|
+
0.54499351978302],
|
|
49
|
+
[-0.012771587818861008, 0.8522674441337585, 0.005031261593103409, 0.010413181968033314, 0.5228084325790405,
|
|
50
|
+
0.0038109596353024244],
|
|
51
|
+
[0.012771571055054665, -0.8522672057151794, -0.00503126997500658, -0.010413173586130142, -0.5228086113929749,
|
|
52
|
+
-0.0038109286688268185],
|
|
53
|
+
[-0.017778851091861725, -0.011899485252797604, 0.838018536567688, -0.010888493619859219, -0.0114247165620327,
|
|
54
|
+
0.54499351978302]],
|
|
55
|
+
"weight2" : [
|
|
56
|
+
[0.004485692363232374, 0.4092908799648285, 0.40233033895492554, -0.0044856867752969265, -0.008494298905134201,
|
|
57
|
+
-0.004485597368329763, 0.004485687240958214, -0.008073708973824978, 0.004485689103603363, 0.008494298905134201,
|
|
58
|
+
-0.004485669545829296, -0.4092909097671509, -0.00849429052323103, -0.008494291454553604, 0.4092908799648285,
|
|
59
|
+
0.004485682118684053, -0.4092908799648285, 0.004485685378313065, -0.004485683515667915, -0.4092908799648285],
|
|
60
|
+
[-0.0012539782328531146, 0.011227603070437908, 0.010983745567500591, 0.0012537383008748293,
|
|
61
|
+
-0.44823628664016724, 0.0012566098012030125, -0.0012539738090708852, -0.4422348737716675,
|
|
62
|
+
-0.0012539689196273685, 0.44823625683784485, 0.0012543690390884876, -0.011227612383663654, -0.4482363164424896,
|
|
63
|
+
-0.4482361674308777, 0.011227606795728207, -0.001253972644917667, -0.011227593757212162, -0.001253975322470069,
|
|
64
|
+
0.001253973226994276, -0.01122759748250246],
|
|
65
|
+
[0.0007343984907492995, -0.011749573983252048, -0.011509227566421032, -0.0007341671735048294,
|
|
66
|
+
0.44823724031448364, -0.0007370298844762146, 0.0007343830075114965, 0.4421602189540863, 0.0007343870238400996,
|
|
67
|
+
-0.44823718070983887, -0.0007348008803091943, 0.011749575845897198, 0.44823724031448364, 0.44823721051216125,
|
|
68
|
+
-0.011749569326639175, 0.0007343803299590945, 0.011749548837542534, 0.0007343843462876976,
|
|
69
|
+
-0.0007343952311202884, 0.011749545112252235],
|
|
70
|
+
[0.0032850054558366537, 0.012248189188539982, 0.012028064578771591, -0.003285229206085205, -0.4482342302799225,
|
|
71
|
+
-0.0032824152149260044, 0.003285015933215618, -0.44198647141456604, 0.0032850138377398252, 0.44823431968688965,
|
|
72
|
+
-0.0032846173271536827, -0.012248193845152855, -0.4482342004776001, -0.4482342600822449, 0.01224818080663681,
|
|
73
|
+
0.0032850129064172506, -0.012248178012669086, 0.003285012673586607, -0.003285010578110814,
|
|
74
|
+
-0.012248177081346512],
|
|
75
|
+
[-0.33326631784439087, 0.001286709913983941, 0.0012743606930598617, 0.33326631784439087, 0.008707520551979542,
|
|
76
|
+
0.3332684338092804, -0.33326634764671326, 0.009328183718025684, -0.33326634764671326, -0.008707527071237564,
|
|
77
|
+
0.33326682448387146, -0.001286706537939608, 0.008707529865205288, 0.008707528933882713, 0.0012867064215242863,
|
|
78
|
+
-0.33326634764671326, -0.001286699203774333, -0.3332662582397461, 0.3332662880420685, -0.0012867129407823086],
|
|
79
|
+
[-0.005634149070829153, -0.40926215052604675, -0.4023561179637909, 0.005634183995425701, 0.008391384966671467,
|
|
80
|
+
0.005634055007249117, -0.005634150467813015, 0.007969524711370468, -0.005634148605167866,
|
|
81
|
+
-0.008391385897994041, 0.005634150002151728, 0.4092622399330139, 0.008391381241381168, 0.008391374722123146,
|
|
82
|
+
-0.40926244854927063, -0.0056341588497161865, 0.40926244854927063, -0.0056341467425227165,
|
|
83
|
+
0.005634146276861429, 0.409262478351593],
|
|
84
|
+
[-0.006210127845406532, -0.4092416763305664, -0.4023682475090027, 0.006210171617567539, 0.00855502113699913,
|
|
85
|
+
0.006210030987858772, -0.006210129242390394, 0.008134675212204456, -0.006210132036358118,
|
|
86
|
+
-0.008555027656257153, 0.006210120394825935, 0.4092416763305664, 0.008555008098483086, 0.008555013686418533,
|
|
87
|
+
-0.4092416763305664, -0.006210125517100096, 0.409241646528244, -0.00621012831106782, 0.006210136227309704,
|
|
88
|
+
0.4092416763305664],
|
|
89
|
+
[0.3332020938396454, 0.0034835836850106716, 0.0034986836835741997, -0.3332015573978424, -0.011808326467871666,
|
|
90
|
+
-0.3332063853740692, 0.3332020342350006, -0.012397287413477898, 0.3332020342350006, 0.01180832739919424,
|
|
91
|
+
-0.3332027792930603, -0.0034835890401154757, -0.011808333918452263, -0.01180832739919424,
|
|
92
|
+
0.0034835883416235447, 0.3332020342350006, -0.0034835846163332462, 0.3332020342350006, -0.333202064037323,
|
|
93
|
+
-0.003483586013317108],
|
|
94
|
+
[0.3332599997520447, -0.00046248571015894413, -0.0004488642734941095, -0.3332599699497223,
|
|
95
|
+
-0.009213998913764954, -0.3332628607749939, 0.3332599997520447, -0.009829509072005749, 0.3332599997520447,
|
|
96
|
+
0.009213999845087528, -0.33326059579849243, 0.00046249059960246086, -0.009214004501700401,
|
|
97
|
+
-0.009213997051119804, -0.0004624773282557726, 0.3332599997520447, 0.0004624743014574051, 0.3332599997520447,
|
|
98
|
+
-0.3332599997520447, 0.00046248442959040403],
|
|
99
|
+
[0.005426416639238596, 0.012804088182747364, 0.012594926171004772, -0.005426647607237101, -0.44819632172584534,
|
|
100
|
+
-0.005423834081739187, 0.005426429677754641, -0.44185635447502136, 0.005426422227174044, 0.4481962323188782,
|
|
101
|
+
-0.005426030606031418, -0.012804095633327961, -0.4481962323188782, -0.4481961727142334, 0.01280409935861826,
|
|
102
|
+
0.005426430609077215, -0.012804084457457066, 0.00542643154039979, -0.005426420830190182,
|
|
103
|
+
-0.012804084457457066],
|
|
104
|
+
[-8.470881584798917e-05, -0.01166805811226368, -0.011431642808020115, 8.493004861520603e-05,
|
|
105
|
+
0.44824597239494324, 8.206536585930735e-05, -8.470812463201582e-05, 0.4421427845954895, -8.470044849673286e-05,
|
|
106
|
+
-0.4482460021972656, 8.428884029854089e-05, 0.011668059974908829, 0.4482460021972656, 0.44824597239494324,
|
|
107
|
+
-0.011668050661683083, -8.470762259094045e-05, 0.011668048799037933, -8.469591557513922e-05,
|
|
108
|
+
8.470559259876609e-05, 0.011668049730360508],
|
|
109
|
+
[0.0007104332908056676, -0.012103226035833359, -0.011863806284964085, -0.0007102005183696747,
|
|
110
|
+
0.4482336640357971, -0.0007130496669560671, 0.0007104334654286504, 0.4421180486679077, 0.0007104235119186342,
|
|
111
|
+
-0.44823363423347473, -0.0007108247373253107, 0.012103239074349403, 0.4482337534427643, 0.44823357462882996,
|
|
112
|
+
-0.012103230692446232, 0.0007104267715476453, 0.012103220447897911, 0.0007104279939085245,
|
|
113
|
+
-0.0007104240357875824, 0.012103220447897911],
|
|
114
|
+
[-0.0008108518086373806, -0.011628665030002594, -0.011395211331546307, 0.0008111011702567339,
|
|
115
|
+
0.4482516348361969, 0.0008082437561824918, -0.0008108714246191084, 0.44211941957473755, -0.000810873054433614,
|
|
116
|
+
-0.4482516050338745, 0.0008104708977043629, 0.011628672480583191, 0.4482516050338745, 0.4482516348361969,
|
|
117
|
+
-0.011628661304712296, -0.0008108695619739592, 0.011628646403551102, -0.0008108615875244141,
|
|
118
|
+
0.0008108713664114475, 0.011628646403551102],
|
|
119
|
+
[0.0052762399427592754, 0.4092657268047333, 0.4023624062538147, -0.005276260897517204, -0.008586729876697063,
|
|
120
|
+
-0.0052761598490178585, 0.005276238080114126, -0.008165040984749794, 0.005276246462017298,
|
|
121
|
+
0.008586726151406765, -0.0052762338891625404, -0.4092656970024109, -0.00858672522008419, -0.008586717769503593,
|
|
122
|
+
0.4092656970024109, 0.005276253912597895, -0.40926575660705566, 0.005276249721646309, -0.005276253912597895,
|
|
123
|
+
-0.4092658758163452],
|
|
124
|
+
[0.0004666325112339109, -0.01200425997376442, -0.011765711009502411, -0.00046640209620818496,
|
|
125
|
+
0.44823700189590454, -0.00046925980132073164, 0.00046662817476317286, 0.4421238601207733,
|
|
126
|
+
0.0004666206077672541, -0.448236882686615, -0.00046703135012649, 0.012004264630377293, 0.44823694229125977,
|
|
127
|
+
0.4482368230819702, -0.01200425811111927, 0.0004666294262278825, 0.012004253454506397, 0.0004666416789405048,
|
|
128
|
+
-0.00046663961256854236, 0.012004251591861248],
|
|
129
|
+
[-0.006058018188923597, -0.40924715995788574, -0.4023823142051697, 0.006058032624423504, 0.008350761607289314,
|
|
130
|
+
0.006057909224182367, -0.006058020517230034, 0.007928609848022461, -0.00605802284553647, -0.00835077092051506,
|
|
131
|
+
0.006058006081730127, 0.40924718976020813, 0.00835077092051506, 0.00835077092051506, -0.40924715995788574,
|
|
132
|
+
-0.006058022379875183, 0.4092472195625305, -0.006058013532310724, 0.0060580214485526085, 0.40924715995788574],
|
|
133
|
+
[0.3332037329673767, 0.0033146513160318136, 0.003330634441226721, -0.33320334553718567, -0.011781765148043633,
|
|
134
|
+
-0.3332081437110901, 0.33320361375808716, -0.012370237149298191, 0.3332037031650543, 0.011781767010688782,
|
|
135
|
+
-0.33320438861846924, -0.0033146499190479517, -0.011781766079366207, -0.011781767010688782,
|
|
136
|
+
0.003314657835289836, 0.3332037329673767, -0.0033146559726446867, 0.33320367336273193, -0.3332037329673767,
|
|
137
|
+
-0.0033146515488624573],
|
|
138
|
+
[-0.005700466223061085, -0.4092574417591095, -0.40236255526542664, 0.005700497422367334, 0.008488606661558151,
|
|
139
|
+
0.005700360052287579, -0.005700466688722372, 0.008067479357123375, -0.00570047739893198, -0.008488614112138748,
|
|
140
|
+
0.005700456909835339, 0.4092574417591095, 0.008488607592880726, 0.008488602004945278, -0.4092575013637543,
|
|
141
|
+
-0.005700466223061085, 0.4092575013637543, -0.005700462963432074, 0.005700469017028809, 0.4092574715614319],
|
|
142
|
+
[0.0007849707617424428, 0.012151014059782028, 0.011918344534933567, -0.0007852140697650611, -0.4482424557209015,
|
|
143
|
+
-0.000782380870077759, 0.0007849783287383616, -0.4420732855796814, 0.0007849846151657403, 0.4482424259185791,
|
|
144
|
+
-0.0007845927611924708, -0.012151009403169155, -0.4482423961162567, -0.4482423961162567, 0.012150995433330536,
|
|
145
|
+
0.0007849778048694134, -0.012150992639362812, 0.0007849839166738093, -0.0007849822868593037,
|
|
146
|
+
-0.012150988914072514],
|
|
147
|
+
[-0.005965784657746553, -0.40925177931785583, -0.4023708701133728, 0.005965803749859333, 0.008349047973752022,
|
|
148
|
+
0.005965673830360174, -0.005965787451714277, 0.0079267006367445, -0.005965782329440117, -0.008349056355655193,
|
|
149
|
+
0.0059657711535692215, 0.4092518091201782, 0.008349052630364895, 0.008349040523171425, -0.4092518091201782,
|
|
150
|
+
-0.00596578698605299, 0.40925195813179016, -0.00596578698605299, 0.005965790245682001, 0.4092518985271454]],
|
|
151
|
+
"weight3" : [
|
|
152
|
+
[-335.4917907714844, 295.4498596191406, -300.9907531738281, 292.68359375, 439.89520263671875, 340.9864807128906,
|
|
153
|
+
341.3768615722656, -446.5185852050781, -442.7583312988281, 283.7157287597656, -300.0808410644531,
|
|
154
|
+
-300.40203857421875, -298.2679748535156, -338.4247741699219, -298.95599365234375, 342.16082763671875,
|
|
155
|
+
-442.63568115234375, 340.7982482910156, 291.43646240234375, 340.5745544433594],
|
|
156
|
+
[333.4602355957031, 283.6884460449219, -290.77532958984375, 284.6348571777344, 458.39697265625,
|
|
157
|
+
-331.57843017578125, -330.1046142578125, -458.7938232421875, -459.3420104980469, 277.3214416503906,
|
|
158
|
+
-290.0921936035156, -291.56329345703125, -287.3941955566406, 332.5392150878906, -289.87408447265625,
|
|
159
|
+
-327.3385009765625, -456.78961181640625, -331.62420654296875, 282.5384521484375, -330.56890869140625],
|
|
160
|
+
[-337.1375427246094, 289.10272216796875, -294.45098876953125, 296.2870788574219, -438.8525085449219,
|
|
161
|
+
339.5340881347656, 337.7414855957031, 435.8607177734375, 437.567138671875, 293.1355895996094,
|
|
162
|
+
-295.7801208496094, -293.8027038574219, -295.40887451171875, -337.87371826171875, -293.3611755371094,
|
|
163
|
+
339.5439147949219, 437.2536315917969, 338.9185791015625, 289.39752197265625, 338.4055480957031],
|
|
164
|
+
[331.2817687988281, 278.56243896484375, -286.8565979003906, 290.38287353515625, -383.39654541015625,
|
|
165
|
+
-332.671630859375, -332.4136047363281, 458.2372741699219, 394.3974609375, 288.79791259765625,
|
|
166
|
+
-287.97247314453125, -287.65728759765625, -287.8821105957031, 333.19647216796875, -286.55657958984375,
|
|
167
|
+
-330.1717834472656, 458.9079895019531, -332.5555114746094, 282.8378601074219, -332.8061828613281],
|
|
168
|
+
[-327.96527099609375, -282.6752014160156, 281.63214111328125, -289.4588928222656, 376.37738037109375,
|
|
169
|
+
333.9535217285156, 335.0184020996094, -457.1034851074219, -390.4696960449219, -294.4223327636719,
|
|
170
|
+
281.4463806152344, 281.6940002441406, 284.7673645019531, -332.4997253417969, 284.1268615722656,
|
|
171
|
+
335.67401123046875, -454.1480407714844, 334.2760009765625, -288.58868408203125, 333.94891357421875],
|
|
172
|
+
[341.65960693359375, -295.7402648925781, 292.73046875, -298.5085754394531, 437.5282287597656,
|
|
173
|
+
-340.9335021972656, -338.32208251953125, -443.3055114746094, -439.6506042480469, -301.7493591308594,
|
|
174
|
+
292.2878723144531, 291.4482116699219, 295.3114013671875, 341.15484619140625, 294.27960205078125,
|
|
175
|
+
-337.8680419921875, -440.09320068359375, -340.21820068359375, -298.2076721191406, -340.53692626953125],
|
|
176
|
+
[-330.5609130859375, -291.5669860839844, 287.8730773925781, -286.07989501953125, -456.10418701171875,
|
|
177
|
+
332.3810119628906, 332.67425537109375, 451.7678527832031, 455.01104736328125, -287.4740905761719,
|
|
178
|
+
285.10052490234375, 287.6368103027344, 286.7076721191406, -332.6780090332031, 289.9099426269531,
|
|
179
|
+
333.3375549316406, 453.9902648925781, 332.9720764160156, -292.4762878417969, 331.2679748535156],
|
|
180
|
+
[340.7230224609375, -301.74951171875, 296.9709777832031, -292.6571960449219, -440.14434814453125,
|
|
181
|
+
-343.39404296875, -343.3323059082031, 441.12506103515625, 440.0010070800781, -290.7984924316406,
|
|
182
|
+
294.84613037109375, 295.7033996582031, 296.45263671875, 342.21826171875, 298.08880615234375,
|
|
183
|
+
-341.65997314453125, 440.3846130371094, -343.41845703125, -299.17828369140625, -344.0526428222656]]
|
|
184
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Example agent.
|
|
2
|
+
from typing import Tuple, List
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import numpy as np
|
|
6
|
+
from scipy.integrate import ode
|
|
7
|
+
import torch
|
|
8
|
+
import math
|
|
9
|
+
from verse.agents import BaseAgent
|
|
10
|
+
from verse.map import LaneMap
|
|
11
|
+
from verse.map.lane_map_3d import LaneMap_3d
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class FFNNC(torch.nn.Module):
|
|
15
|
+
def __init__(self, D_in=6, D_out=8):
|
|
16
|
+
super(FFNNC, self).__init__()
|
|
17
|
+
self.layer1 = torch.nn.Linear(D_in, 20)
|
|
18
|
+
self.layer2 = torch.nn.Linear(20, 20)
|
|
19
|
+
self.layer3 = torch.nn.Linear(20, D_out)
|
|
20
|
+
|
|
21
|
+
def forward(self, x):
|
|
22
|
+
x = torch.tanh(self.layer1(x))
|
|
23
|
+
x = torch.tanh(self.layer2(x))
|
|
24
|
+
x = self.layer3(x)
|
|
25
|
+
return x
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class QuadrotorAgent(BaseAgent):
|
|
29
|
+
def __init__(self, id, code=None, file_name=None, t_v_pair=[], box_side=[]):
|
|
30
|
+
super().__init__(id, code, file_name)
|
|
31
|
+
self.t_v_pair = t_v_pair
|
|
32
|
+
self.box_side = box_side
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def dynamics(t, state, u):
|
|
36
|
+
u1, u2, u3, bx, by, bz, sc, ddf = u # len 7
|
|
37
|
+
vx, vy, vz = state[6:] # len 9
|
|
38
|
+
sc = -1 * sc
|
|
39
|
+
dvx = 9.81 * np.sin(u1) / np.cos(u1)
|
|
40
|
+
dvy = -9.81 * np.sin(u2) / np.cos(u2)
|
|
41
|
+
tmp1 = dvx * math.cos(sc) - dvy * math.sin(sc)
|
|
42
|
+
tmp2 = dvx * math.sin(sc) + dvy * math.cos(sc)
|
|
43
|
+
dvx = tmp1
|
|
44
|
+
dvy = tmp2
|
|
45
|
+
dvz = u3 - 9.81
|
|
46
|
+
dx = vx
|
|
47
|
+
dy = vy
|
|
48
|
+
dz = vz
|
|
49
|
+
dref_x = bx
|
|
50
|
+
dref_y = by
|
|
51
|
+
dref_z = bz
|
|
52
|
+
return [dref_x, dref_y, dref_z, dx, dy, dz, dvx, dvy, dvz]
|
|
53
|
+
|
|
54
|
+
def action_handler(self, mode, state, lane_map: LaneMap_3d):
|
|
55
|
+
# if mode[0] == 'Normal':
|
|
56
|
+
df = 0
|
|
57
|
+
if lane_map.check_guard_box(self.id, state[3:9], self.box_side):
|
|
58
|
+
# lane_map.get_next_point(mode[1], self.id, state[3:6])
|
|
59
|
+
df = 1
|
|
60
|
+
# else:
|
|
61
|
+
# raise ValueError
|
|
62
|
+
return df
|
|
63
|
+
|
|
64
|
+
def runModel(
|
|
65
|
+
self, mode, initalCondition, time_bound, time_step, ref_input, lane_map: LaneMap_3d
|
|
66
|
+
):
|
|
67
|
+
path = os.path.abspath(__file__)
|
|
68
|
+
path = path.replace("quadrotor_agent.py", "prarm.json")
|
|
69
|
+
# print(path)
|
|
70
|
+
with open(path, "r") as f:
|
|
71
|
+
prarms = json.load(f)
|
|
72
|
+
bias1 = prarms["bias1"]
|
|
73
|
+
bias2 = prarms["bias2"]
|
|
74
|
+
bias3 = prarms["bias3"]
|
|
75
|
+
weight1 = prarms["weight1"]
|
|
76
|
+
weight2 = prarms["weight2"]
|
|
77
|
+
weight3 = prarms["weight3"]
|
|
78
|
+
|
|
79
|
+
bias1 = torch.FloatTensor(bias1)
|
|
80
|
+
bias2 = torch.FloatTensor(bias2)
|
|
81
|
+
bias3 = torch.FloatTensor(bias3)
|
|
82
|
+
weight1 = torch.FloatTensor(weight1)
|
|
83
|
+
weight2 = torch.FloatTensor(weight2)
|
|
84
|
+
weight3 = torch.FloatTensor(weight3)
|
|
85
|
+
controller = FFNNC()
|
|
86
|
+
controller.layer1.weight = torch.nn.Parameter(weight1)
|
|
87
|
+
controller.layer2.weight = torch.nn.Parameter(weight2)
|
|
88
|
+
controller.layer3.weight = torch.nn.Parameter(weight3)
|
|
89
|
+
controller.layer1.bias = torch.nn.Parameter(bias1)
|
|
90
|
+
controller.layer2.bias = torch.nn.Parameter(bias2)
|
|
91
|
+
controller.layer3.bias = torch.nn.Parameter(bias3)
|
|
92
|
+
control_input_list = [
|
|
93
|
+
[-0.1, -0.1, 7.81],
|
|
94
|
+
[-0.1, -0.1, 11.81],
|
|
95
|
+
[-0.1, 0.1, 7.81],
|
|
96
|
+
[-0.1, 0.1, 11.81],
|
|
97
|
+
[0.1, -0.1, 7.81],
|
|
98
|
+
[0.1, -0.1, 11.81],
|
|
99
|
+
[0.1, 0.1, 7.81],
|
|
100
|
+
[0.1, 0.1, 11.81],
|
|
101
|
+
]
|
|
102
|
+
init = initalCondition
|
|
103
|
+
trajectory = [init]
|
|
104
|
+
r = ode(self.dynamics)
|
|
105
|
+
# r.set_initial_value(init)
|
|
106
|
+
ex_list = []
|
|
107
|
+
ey_list = []
|
|
108
|
+
ez_list = []
|
|
109
|
+
t = 0
|
|
110
|
+
time = [t]
|
|
111
|
+
trace = [[t]]
|
|
112
|
+
trace[0].extend(init[3:])
|
|
113
|
+
i = 0
|
|
114
|
+
df = 0
|
|
115
|
+
while (t < time_bound) or df != 1:
|
|
116
|
+
ex = trajectory[i][3] - trajectory[i][0]
|
|
117
|
+
ey = trajectory[i][4] - trajectory[i][1]
|
|
118
|
+
ez = trajectory[i][5] - trajectory[i][2]
|
|
119
|
+
# if self.id == 'test1':
|
|
120
|
+
# print([t, ex, ey, ez, trajectory[i][0],
|
|
121
|
+
# trajectory[i][1], trajectory[i][2]])
|
|
122
|
+
evx = trajectory[i][6] - ref_input[0]
|
|
123
|
+
evy = trajectory[i][7] - ref_input[1]
|
|
124
|
+
evz = trajectory[i][8] - ref_input[2]
|
|
125
|
+
|
|
126
|
+
sc = ref_input[3] # math.atan2(dot, det)
|
|
127
|
+
|
|
128
|
+
tmp1 = ex * math.cos(sc) - ey * math.sin(sc)
|
|
129
|
+
tmp2 = ex * math.sin(sc) + ey * math.cos(sc)
|
|
130
|
+
ex = tmp1
|
|
131
|
+
ey = tmp2
|
|
132
|
+
|
|
133
|
+
tmp1 = evx * math.cos(sc) - evy * math.sin(sc)
|
|
134
|
+
tmp2 = evx * math.sin(sc) + evy * math.cos(sc)
|
|
135
|
+
evx = tmp1
|
|
136
|
+
evy = tmp2
|
|
137
|
+
|
|
138
|
+
data = torch.FloatTensor(
|
|
139
|
+
[0.2 * ex, 0.2 * ey, 0.2 * ez, 0.1 * evx, 0.1 * evy, 0.1 * evz]
|
|
140
|
+
)
|
|
141
|
+
res = controller(data)
|
|
142
|
+
res = res.detach().numpy()
|
|
143
|
+
idx = np.argmax(res)
|
|
144
|
+
u = control_input_list[idx] + ref_input[0:3] + [sc]
|
|
145
|
+
|
|
146
|
+
df = self.action_handler(mode, init, lane_map)
|
|
147
|
+
|
|
148
|
+
u = u + [df]
|
|
149
|
+
init = trajectory[i] # len 9
|
|
150
|
+
r = ode(self.dynamics)
|
|
151
|
+
r.set_initial_value(init)
|
|
152
|
+
r.set_f_params(u)
|
|
153
|
+
val = r.integrate(r.t + time_step)
|
|
154
|
+
|
|
155
|
+
t = t + time_step
|
|
156
|
+
if round(t - time_bound - time_step, 4) >= 0:
|
|
157
|
+
break
|
|
158
|
+
i += 1
|
|
159
|
+
# print(i,idx,u,res)
|
|
160
|
+
trajectory.append(val)
|
|
161
|
+
time.append(t)
|
|
162
|
+
|
|
163
|
+
ex_list.append(ex)
|
|
164
|
+
ey_list.append(ey)
|
|
165
|
+
ez_list.append(ez)
|
|
166
|
+
trace.append([t])
|
|
167
|
+
# remove the reference trajectory from the trace
|
|
168
|
+
trace[i].extend(val[3:])
|
|
169
|
+
# if self.id == 'test1':
|
|
170
|
+
# print([t, trajectory[i][0], trajectory[i][1], trajectory[i][2]])
|
|
171
|
+
# print('curr', val[3:6])
|
|
172
|
+
# print(trajectory)
|
|
173
|
+
return trace
|
|
174
|
+
|
|
175
|
+
def TC_simulate(
|
|
176
|
+
self, mode: List[str], initialCondition, time_bound, time_step, lane_map: LaneMap_3d = None
|
|
177
|
+
) -> np.ndarray:
|
|
178
|
+
# print("TC", initialCondition)
|
|
179
|
+
# total time_bound remained
|
|
180
|
+
time_bound = float(time_bound)
|
|
181
|
+
traces = []
|
|
182
|
+
end_time = 0
|
|
183
|
+
time_limit = self.t_v_pair[0]
|
|
184
|
+
mode_parameters = lane_map.get_next_point(
|
|
185
|
+
lane_map.trans_func(mode[1]),
|
|
186
|
+
self.id,
|
|
187
|
+
np.array(initialCondition[:3]),
|
|
188
|
+
np.array(initialCondition[3:6]),
|
|
189
|
+
self.t_v_pair,
|
|
190
|
+
)
|
|
191
|
+
while time_bound > end_time:
|
|
192
|
+
ref_vx = (mode_parameters[3] - mode_parameters[0]) / time_limit
|
|
193
|
+
ref_vy = (mode_parameters[4] - mode_parameters[1]) / time_limit
|
|
194
|
+
ref_vz = (mode_parameters[5] - mode_parameters[2]) / time_limit
|
|
195
|
+
sym_rot_angle = 0
|
|
196
|
+
# if self.id == 'test1':
|
|
197
|
+
# print('test', np.linalg.norm(
|
|
198
|
+
# np.array([ref_vx, ref_vy, ref_vz])))
|
|
199
|
+
trace = self.runModel(
|
|
200
|
+
mode,
|
|
201
|
+
mode_parameters[0:3] + list(initialCondition),
|
|
202
|
+
min(time_limit, time_bound - end_time),
|
|
203
|
+
time_step,
|
|
204
|
+
[ref_vx, ref_vy, ref_vz, sym_rot_angle],
|
|
205
|
+
lane_map,
|
|
206
|
+
)
|
|
207
|
+
# if lane_map.check_guard_box(self.id, np.array(trace[-1][1:])):
|
|
208
|
+
# mode_parameters = lane_map.get_next_point(
|
|
209
|
+
# mode[1], self.id, np.array(trace[-1][1:4]), np.array(trace[-1][4:7]))
|
|
210
|
+
# delta = np.array(trace)[:, 1:4]-mode_parameters[3:6]
|
|
211
|
+
# min_dis = float('inf')
|
|
212
|
+
# min_index = 0
|
|
213
|
+
# index = 0
|
|
214
|
+
# for a in delta:
|
|
215
|
+
# dis = np.linalg.norm(a)
|
|
216
|
+
# if min_dis > dis:
|
|
217
|
+
# min_dis = dis
|
|
218
|
+
# min_index = index
|
|
219
|
+
# index += 1
|
|
220
|
+
# if self.id == 'test1':
|
|
221
|
+
# print(index)
|
|
222
|
+
# trace = trace[:index]
|
|
223
|
+
for p in trace:
|
|
224
|
+
p[0] = round(p[0] + end_time, 4)
|
|
225
|
+
end_time = trace[-1][0]
|
|
226
|
+
initialCondition = trace[-1][1:]
|
|
227
|
+
mode_parameters = lane_map.get_next_point(
|
|
228
|
+
lane_map.trans_func(mode[1]),
|
|
229
|
+
self.id,
|
|
230
|
+
None,
|
|
231
|
+
np.array(initialCondition[3:6]),
|
|
232
|
+
self.t_v_pair,
|
|
233
|
+
)
|
|
234
|
+
if round(trace[0][0] - 0, 4) != 0:
|
|
235
|
+
trace = trace[1:]
|
|
236
|
+
traces.extend(trace)
|
|
237
|
+
# print([ref_vx, ref_vy, ref_vz, sym_rot_angle])
|
|
238
|
+
return np.array(traces)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
# import json
|
|
242
|
+
# import os
|
|
243
|
+
# if __name__ == "__main__":
|
|
244
|
+
# path = os.path.abspath(__file__)
|
|
245
|
+
# path=path.replace('tempCodeRunnerFile.py', 'prarm.json')
|
|
246
|
+
# print(path)
|
|
247
|
+
# with open(path, 'r') as f:
|
|
248
|
+
# prarms = json.load(f)
|
|
249
|
+
# print(prarms)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import Tuple, List
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
from scipy.integrate import ode
|
|
5
|
+
|
|
6
|
+
from verse import BaseAgent
|
|
7
|
+
from verse import LaneMap
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RobotAgent(BaseAgent):
|
|
11
|
+
def __init__(self, id, code=None, file_name=None):
|
|
12
|
+
super().__init__(id, code, file_name)
|
|
13
|
+
|
|
14
|
+
@staticmethod
|
|
15
|
+
def dynamics(t, state):
|
|
16
|
+
x_dot = 1
|
|
17
|
+
return [x_dot]
|
|
18
|
+
|
|
19
|
+
def TC_simulate(
|
|
20
|
+
self, mode: List[str], initialCondition, time_bound, time_step, lane_map: LaneMap = None
|
|
21
|
+
) -> np.ndarray:
|
|
22
|
+
# TODO: P1. Should TC_simulate really be part of the agent definition or should it be something more generic?
|
|
23
|
+
# TODO: P2. Looks like this should be a global parameter; some config file should be setting this.
|
|
24
|
+
time_bound = float(time_bound)
|
|
25
|
+
number_points = int(np.ceil(time_bound / time_step))
|
|
26
|
+
t = [round(i * time_step, 10) for i in range(0, number_points)]
|
|
27
|
+
|
|
28
|
+
init = initialCondition
|
|
29
|
+
trace = [[0] + init]
|
|
30
|
+
for i in range(len(t)):
|
|
31
|
+
r = ode(self.dynamics)
|
|
32
|
+
r.set_initial_value(init)
|
|
33
|
+
res: np.ndarray = r.integrate(r.t + time_step)
|
|
34
|
+
init = res.flatten().tolist()
|
|
35
|
+
trace.append([t[i] + time_step] + init)
|
|
36
|
+
|
|
37
|
+
return np.array(trace)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from verse import BaseAgent
|
|
2
|
+
import numpy as np
|
|
3
|
+
from verse.parser import ControllerIR
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SignAgent(BaseAgent):
|
|
7
|
+
def __init__(self, id):
|
|
8
|
+
self.id = id
|
|
9
|
+
self.decision_logic = ControllerIR.empty()
|
|
10
|
+
|
|
11
|
+
def TC_simulate(self, mode, init, time_horizon, time_step, map=None):
|
|
12
|
+
number_points = int(np.ceil(float(time_horizon) / time_step))
|
|
13
|
+
t = [i * time_step for i in range(0, number_points)]
|
|
14
|
+
trace = [[0] + init] + [[i + time_step] + init for i in t]
|
|
15
|
+
return np.array(trace)
|