Skip to content

Commit 7b1a71d

Browse files
committed
Add vehicle roll & pitch check to _is_valid_estimate. Disable old roll check.
1 parent 240d79c commit 7b1a71d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

gisnav/nodes/base_node.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,17 @@ def _is_valid_estimate(self, fixed_camera: FixedCamera, input_data: InputData) -
11581158
"""
11591159
static_camera = self.get_parameter('misc.static_camera').get_parameter_value().bool_value
11601160
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()
11631172

11641173
if input_data.r_guess is None and not static_camera:
11651174
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) -
11841193
f'{np.degrees(magnitude)}).')
11851194
return False
11861195

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
11921201

11931202
return True
11941203

0 commit comments

Comments
 (0)