mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:41 -04:00
add test for circle_fitting
This commit is contained in:
@@ -12,6 +12,8 @@ import math
|
||||
import random
|
||||
import numpy as np
|
||||
|
||||
show_animation = True
|
||||
|
||||
|
||||
def circle_fitting(x, y):
|
||||
"""
|
||||
@@ -120,15 +122,17 @@ def main():
|
||||
ex, ey, er, error = circle_fitting(x, y)
|
||||
print("Error:", error)
|
||||
|
||||
plt.cla()
|
||||
plt.axis("equal")
|
||||
plt.plot(0.0, 0.0, "*r")
|
||||
plot_circle(cx, cy, cr)
|
||||
plt.plot(x, y, "xr")
|
||||
plot_circle(ex, ey, er, "-r")
|
||||
plt.pause(dt)
|
||||
if show_animation:
|
||||
plt.cla()
|
||||
plt.axis("equal")
|
||||
plt.plot(0.0, 0.0, "*r")
|
||||
plot_circle(cx, cy, cr)
|
||||
plt.plot(x, y, "xr")
|
||||
plot_circle(ex, ey, er, "-r")
|
||||
plt.pause(dt)
|
||||
|
||||
print("Done")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# main1()
|
||||
main()
|
||||
|
||||
12
tests/test_circle_fitting.py
Normal file
12
tests/test_circle_fitting.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from Mapping.circle_fitting import circle_fitting as m
|
||||
|
||||
print(__file__)
|
||||
|
||||
|
||||
class Test(TestCase):
|
||||
|
||||
def test1(self):
|
||||
m.show_animation = False
|
||||
m.main()
|
||||
Reference in New Issue
Block a user