@@ -84,6 +84,13 @@ def run(gui=False, plot=True, n_episodes=1, n_steps=None, curr_path='.'):
84
84
graph3_2 = 2
85
85
graph4_1 = 0
86
86
graph4_2 = 1
87
+ elif system == 'quadrotor_5D' :
88
+ graph1_1 = 4
89
+ graph1_2 = 5
90
+ graph3_1 = 0
91
+ graph3_2 = 2
92
+ graph4_1 = 0
93
+ graph4_2 = 1
87
94
88
95
_ , ax = plt .subplots ()
89
96
ax .plot (results ['obs' ][0 ][:, graph1_1 ], results ['obs' ][0 ][:, graph1_2 ], 'r--' , label = 'RL Trajectory' )
@@ -122,6 +129,19 @@ def run(gui=False, plot=True, n_episodes=1, n_steps=None, curr_path='.'):
122
129
ax3 .set_box_aspect (0.5 )
123
130
ax3 .legend (loc = 'upper right' )
124
131
132
+ if config .task == Environment .QUADROTOR and system == 'quadrotor_2D' :
133
+ # _, ax4 = plt.subplots()
134
+ # ax4.plot(results['timestamp'][0][:], results['action'][0][:, graph4_1], 'r', label='Thrust')
135
+ # ax4.set_ylabel(r'Thrust')
136
+ # _, ax5 = plt.subplots()
137
+ # ax5.plot(results['timestamp'][0][:], results['action'][0][:, graph4_2], 'r', label='Pitch')
138
+ # ax5.set_ylabel(r'Pitch')
139
+ _ , ax6 = plt .subplots ()
140
+ ax6 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 4 ], 'r' , label = 'Thrust' )
141
+ ax6 .set_ylabel (r'Pitch' )
142
+ _ , ax7 = plt .subplots ()
143
+ ax7 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 5 ], 'r' , label = 'Pitch' )
144
+ ax7 .set_ylabel (r'Pitch rate' )
125
145
if config .task == Environment .QUADROTOR and system == 'quadrotor_4D' :
126
146
_ , ax4 = plt .subplots ()
127
147
ax4 .plot (results ['timestamp' ][0 ][:], results ['action' ][0 ][:, graph4_1 ], 'r' , label = 'Action: Thrust' )
@@ -135,20 +155,16 @@ def run(gui=False, plot=True, n_episodes=1, n_steps=None, curr_path='.'):
135
155
_ , ax7 = plt .subplots ()
136
156
ax7 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 5 ], 'r' , label = 'Obs: Pitch rate' )
137
157
ax7 .set_ylabel (r'Obs: Pitch rate' )
138
-
139
- if config .task == Environment .QUADROTOR and system == 'quadrotor_2D' :
140
- # _, ax4 = plt.subplots()
141
- # ax4.plot(results['timestamp'][0][:], results['action'][0][:, graph4_1], 'r', label='Thrust')
142
- # ax4.set_ylabel(r'Thrust')
143
- # _, ax5 = plt.subplots()
144
- # ax5.plot(results['timestamp'][0][:], results['action'][0][:, graph4_2], 'r', label='Pitch')
145
- # ax5.set_ylabel(r'Pitch')
158
+ if config .task == Environment .QUADROTOR and system == 'quadrotor_5D' :
159
+ _ , ax4 = plt .subplots ()
160
+ ax4 .plot (results ['timestamp' ][0 ][:], results ['action' ][0 ][:, graph4_1 ], 'r' , label = 'Action: Thrust' )
161
+ ax4 .set_ylabel (r'Action: Thrust' )
162
+ _ , ax5 = plt .subplots ()
163
+ ax5 .plot (results ['timestamp' ][0 ][:], results ['action' ][0 ][:, graph4_2 ], 'r' , label = 'Action: Pitch' )
164
+ ax5 .set_ylabel (r'Action: Pitch' )
146
165
_ , ax6 = plt .subplots ()
147
- ax6 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 4 ], 'r' , label = 'Thrust' )
148
- ax6 .set_ylabel (r'Pitch' )
149
- _ , ax7 = plt .subplots ()
150
- ax7 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 5 ], 'r' , label = 'Pitch' )
151
- ax7 .set_ylabel (r'Pitch rate' )
166
+ ax6 .plot (results ['timestamp' ][0 ][:], results ['obs' ][0 ][1 :, 4 ], 'r' , label = 'Obs: Pitch' )
167
+ ax6 .set_ylabel (r'Obs: Pitch' )
152
168
153
169
plt .tight_layout ()
154
170
plt .show ()
0 commit comments