Skip to content

Commit

Permalink
Remove deprecated buildFrom() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fspindle committed Jun 25, 2024
1 parent ac57ba9 commit d299b03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions modules/python/examples/yolo-centering-task-afma6.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions modules/python/examples/yolo-centering-task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d299b03

Please sign in to comment.