@@ -158,23 +158,42 @@ def compute_resampled_dataframe(self, ulog):
158158 curr_df .columns = topic_dict ["dataframe_name" ]
159159 topic_type_bar .next ()
160160 if (topic_type == "vehicle_angular_velocity" and self .estimate_angular_acceleration ):
161- print (curr_df )
162- ang_vel_np = curr_df [["ang_vel_x" ,
161+ ang_vel_mat = curr_df [["ang_vel_x" ,
163162 "ang_vel_y" , "ang_vel_z" ]].to_numpy ()
164163 time_in_secods_np = (curr_df [["timestamp" ]].to_numpy ()/ 1000000 )
165164 time_in_secods_np = time_in_secods_np .flatten ()
166- print (ang_vel_np )
167- ang_acc_np = np .gradient (ang_vel_np , time_in_secods_np , axis = 0 )
168- print (ang_acc_np )
165+ ang_acc_np = np .gradient (
166+ ang_vel_mat , time_in_secods_np , axis = 0 )
169167 topic_type_bar .next ()
170168 curr_df [["ang_acc_b_x" , "ang_acc_b_y" ,
171169 "ang_acc_b_z" ]] = ang_acc_np
170+
172171 df_list .append (curr_df )
173172
174173 topic_type_bar .finish ()
175- print (df_list )
176174 resampled_df = resample_dataframe_list (
177175 df_list , fts , self .resample_freq )
176+ if (self .estimate_angular_acceleration ):
177+ ang_vel_mat = resampled_df [["ang_vel_x" ,
178+ "ang_vel_y" , "ang_vel_z" ]].to_numpy ()
179+ for i in range (3 ):
180+ ang_vel_mat [:, i ] = np .convolve (
181+ ang_vel_mat [:, i ], np .ones (33 ), mode = 'same' ) / 33
182+
183+ # Alternate forward differentiation version
184+ # ang_vel_mat_1 = np.roll(ang_vel_mat, -1, axis=0)
185+ # diff_angular_acc_mat = (
186+ # ang_vel_mat_1 - ang_vel_mat) * self.resample_freq
187+ # resampled_df[["ang_acc_b_x", "ang_acc_b_y",
188+ # "ang_acc_b_z"]] = diff_angular_acc_mat
189+
190+ time_in_secods_np = (
191+ resampled_df [["timestamp" ]].to_numpy ()/ 1000000 )
192+ time_in_secods_np = time_in_secods_np .flatten ()
193+ ang_acc_np = np .gradient (ang_vel_mat , time_in_secods_np , axis = 0 )
194+ topic_type_bar .next ()
195+ resampled_df [["ang_acc_b_x" , "ang_acc_b_y" ,
196+ "ang_acc_b_z" ]] = ang_acc_np
178197 return resampled_df .dropna ()
179198
180199 def visually_select_data (self , plot_config_dict = None ):
0 commit comments