Skip to content

Commit bc23fec

Browse files
committed
Add calibration removal
1 parent 98284ae commit bc23fec

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drone_estimators/ros_nodes/ros2_node.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,15 @@ def calibration_callback(
365365
response.success = True
366366
response.message = "Pose calibrated successfully."
367367
return response
368+
369+
def remove_calibration_callback(
370+
request: Trigger.Request, response: Trigger.Response
371+
) -> Trigger.Response:
372+
nonlocal calibration_rot
373+
calibration_rot = R.from_quat(np.array([0.0, 0.0, 0.0, 1.0]))
374+
response.success = True
375+
response.message = "Calibration deleted successfully."
376+
return response
368377

369378
sub_tf = node.create_subscription(TFMessage, "/tf", tf_callback, qos_profile=qos_profile)
370379
sub_cmd = node.create_subscription(
@@ -376,13 +385,17 @@ def calibration_callback(
376385
sub_calib = node.create_service(
377386
Trigger, f"/drones/{drone_name}/calibration", calibration_callback
378387
)
388+
sub_remove_calib = node.create_service(
389+
Trigger, f"/drones/{drone_name}/remove_calibration", remove_calibration_callback
390+
)
379391
startup.wait(10.0) # Register this process as ready for startup barrier
380392

381393
while not shutdown.is_set():
382394
rclpy.spin_once(node, timeout_sec=0.1)
383395
sub_tf.destroy()
384396
sub_cmd.destroy()
385397
sub_calib.destroy()
398+
sub_remove_calib.destroy()
386399
node.destroy_node()
387400

388401
@staticmethod

0 commit comments

Comments
 (0)