From be8713d2b7fed6d1eb10881a8dd5681813b451e2 Mon Sep 17 00:00:00 2001 From: lanius Date: Sun, 25 Apr 2021 19:08:23 +0900 Subject: [PATCH] Fix default optimizer not to be initialized unintentionally --- tinyik/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tinyik/core.py b/tinyik/core.py index 134366e..718b51b 100644 --- a/tinyik/core.py +++ b/tinyik/core.py @@ -12,7 +12,7 @@ class Actuator(object): """Represents an actuator as a set of links and revolute joints.""" - def __init__(self, tokens, optimizer=ScipyOptimizer()): + def __init__(self, tokens, optimizer=None): """Create an actuator from specified link lengths and joint axes.""" components = [] for t in tokens: @@ -29,7 +29,8 @@ def __init__(self, tokens, optimizer=ScipyOptimizer()): ) self.fk = FKSolver(components) - self.ik = IKSolver(self.fk, optimizer) + self.ik = IKSolver( + self.fk, ScipyOptimizer() if optimizer is None else optimizer) self.angles = [0.] * len( [c for c in components if isinstance(c, Joint)]