@@ -1158,8 +1158,17 @@ def _is_valid_estimate(self, fixed_camera: FixedCamera, input_data: InputData) -
1158
1158
"""
1159
1159
static_camera = self .get_parameter ('misc.static_camera' ).get_parameter_value ().bool_value
1160
1160
if static_camera :
1161
- # TODO add vehicle body roll & pitch from input data
1162
- r_guess = Attitude (Rotation .from_rotvec ([0 , - np .pi / 2 , 0 ]).as_quat ()).to_esd ().as_rotation ()
1161
+ vehicle_attitude = self ._bridge .attitude
1162
+ if vehicle_attitude is None :
1163
+ self .get_logger ().warn ('Gimbal attitude was not available, cannot do post-estimation validity check'
1164
+ 'for static camera.' )
1165
+ return False
1166
+
1167
+ # Add vehicle roll & pitch (yaw handled separately through map rotation)
1168
+ #r_guess = Attitude(Rotation.from_rotvec([vehicle_attitude.roll, vehicle_attitude.pitch - np.pi/2, 0])
1169
+ # .as_quat()).to_esd().as_rotation()
1170
+ r_guess = Attitude (Rotation .from_euler ('XYZ' , [vehicle_attitude .roll , vehicle_attitude .pitch - np .pi / 2 ,
1171
+ 0 ]).as_quat ()).to_esd ().as_rotation ()
1163
1172
1164
1173
if input_data .r_guess is None and not static_camera :
1165
1174
self .get_logger ().warn ('Gimbal attitude was not available, cannot do post-estimation validity check.' )
@@ -1184,11 +1193,11 @@ def _is_valid_estimate(self, fixed_camera: FixedCamera, input_data: InputData) -
1184
1193
f'{ np .degrees (magnitude )} ).' )
1185
1194
return False
1186
1195
1187
- roll = r_guess .as_euler ('xyz' , degrees = True )[0 ]
1188
- if roll > threshold / 2 : # TODO: have separate configurable threshold
1189
- self .get_logger ().warn (f'Estimated roll difference to expected was too high (magnitude '
1190
- f'{ roll } ).' )
1191
- return False
1196
+ # roll = r_guess.as_euler('xyz', degrees=True)[0]
1197
+ # if roll > threshold/2: # TODO: have separate configurable threshold
1198
+ # self.get_logger().warn(f'Estimated roll difference to expected was too high (magnitude '
1199
+ # f'{roll}).')
1200
+ # return False
1192
1201
1193
1202
return True
1194
1203
0 commit comments