From d299b039089873af1eebb8366e7e0ad198c8a842 Mon Sep 17 00:00:00 2001 From: Fabien Spindler Date: Tue, 25 Jun 2024 10:27:56 +0200 Subject: [PATCH] Remove deprecated buildFrom() usage --- modules/python/examples/yolo-centering-task-afma6.py | 10 +++++----- modules/python/examples/yolo-centering-task.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/python/examples/yolo-centering-task-afma6.py b/modules/python/examples/yolo-centering-task-afma6.py index 48a24e4153..8221727309 100644 --- a/modules/python/examples/yolo-centering-task-afma6.py +++ b/modules/python/examples/yolo-centering-task-afma6.py @@ -255,10 +255,10 @@ def animate(i): Zd = I_depth[h // 2, w // 2] * depth_scale print(f'Desired depth is {Zd}') sd = FeaturePoint() - sd.buildFrom(xd, yd, Zd) + sd.build(xd, yd, Zd) s = FeaturePoint() - s.buildFrom(0.0, 0.0, Zd) + s.build(0.0, 0.0, Zd) task = Servo() task.addFeature(s, sd) @@ -309,14 +309,14 @@ def has_class_box(box): kalman.filter(ColVector([x, y]), (1 / fps)) kalman_state = kalman.getXest() last_detection_time = time.time() - s.buildFrom(kalman_state[0], kalman_state[3], Zd) + s.build(kalman_state[0], kalman_state[3], Zd) v = task.computeControlLaw() else: if last_detection_time < 0.0: raise RuntimeError('No detection at first iteration') kalman.predict(time.time() - last_detection_time) kalman_pred = kalman.getXpred() - s.buildFrom(kalman_pred[0], kalman_pred[3], Zd) + s.build(kalman_pred[0], kalman_pred[3], Zd) task.computeControlLaw() error: ColVector = task.getError() @@ -333,7 +333,7 @@ def has_class_box(box): Display.flush(I) Display.getImage(I, Idisp) robot.getPosition(Robot.ControlFrameType.REFERENCE_FRAME, r) - cTw.buildFrom(r) + cTw.build(r) plotter.on_iter(Idisp, v, error, cTw) # Move robot/update simulator diff --git a/modules/python/examples/yolo-centering-task.py b/modules/python/examples/yolo-centering-task.py index 1d91c53d3e..06ed1b08ed 100644 --- a/modules/python/examples/yolo-centering-task.py +++ b/modules/python/examples/yolo-centering-task.py @@ -125,10 +125,10 @@ def animate(i): # Define centering task xd, yd = PixelMeterConversion.convertPoint(cam, w / 2.0, h / 2.0) sd = FeaturePoint() - sd.buildFrom(xd, yd, Z) + sd.build(xd, yd, Z) s = FeaturePoint() - s.buildFrom(0.0, 0.0, Z) + s.build(0.0, 0.0, Z) task = Servo() task.addFeature(s, sd) @@ -177,7 +177,7 @@ def has_class_box(box): if bb is not None: u, v = bb[0], bb[1] x, y = PixelMeterConversion.convertPoint(cam, u, v) - s.buildFrom(x, y, Z) + s.build(x, y, Z) v = task.computeControlLaw() prev_v = v else: