Skip to content

Commit

Permalink
* optimize apriltag doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lxowalle committed Jan 10, 2025
1 parent a4d1fd5 commit e9417cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/doc/en/vision/apriltag.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ The process consists of two steps:

apriltags = img.find_apriltags()
for a in apriltags:
k = caculate_k(a.z_translation(), 20)
k = caculate_k(a.z_translation(), 200)
print(f"k:{k}")
disp.show(img)
```
Expand Down Expand Up @@ -353,7 +353,7 @@ k: Constant coefficient.
Returns the distance in mm.
'''
def calculate_distance(x_trans, y_trans, z_trans, k):
return k * math.sqrt(x_trans * x_trans + y_trans * y_trans + z_trans * z_trans)
return abs(k * math.sqrt(x_trans * x_trans + y_trans * y_trans + z_trans * z_trans))

cam = camera.Camera(160, 120)
disp = display.Display()
Expand Down
4 changes: 2 additions & 2 deletions docs/doc/zh/vision/apriltag.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ while 1:

apriltags = img.find_apriltags()
for a in apriltags:
k = caculate_k(a.z_translation(), 20)
k = caculate_k(a.z_translation(), 200)
print(f"k:{k}")
disp.show(img)
```
Expand Down Expand Up @@ -343,7 +343,7 @@ k: 常量系数
返回距离, 单位mm
'''
def calculate_distance(x_trans, y_trans, z_trans, k):
return k * math.sqrt(x_trans * x_trans + y_trans * y_trans + z_trans * z_trans)
return abs(k * math.sqrt(x_trans * x_trans + y_trans * y_trans + z_trans * z_trans))

cam = camera.Camera(160, 120)
disp = display.Display()
Expand Down

0 comments on commit e9417cb

Please sign in to comment.