Skip to content

Commit

Permalink
Set verbose properly
Browse files Browse the repository at this point in the history
  • Loading branch information
safijari committed Jul 17, 2024
1 parent 2d9c404 commit 4776ec8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions yag_slam/graph_slam.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def try_to_close_loop(self, scan):

chains = self.find_possible_loop_closure_chains(scan)

if len(chains) > 0:
if len(chains) > 0 and self.verbose:
print("Found {} chains for loop closure".format(len(chains)))


Expand All @@ -233,7 +233,7 @@ def try_to_close_loop(self, scan):

res = self.seq_matcher.match_scan(tmpscan, chain, False, True)

if res.response < self.min_response_fine:
if res.response < self.min_response_fine and self.verbose:
print(f"Loop closure fine response is not good {res.response}")
continue

Expand All @@ -252,15 +252,17 @@ def try_to_close_loop(self, scan):
break

if closed:
print("successful loop closure")
if self.verbose:
print("successful loop closure")
self.run_opt()

return closed

def run_opt(self):
begin = time.time()
self.opt.compute(100, 1.0e-4, True, 1.0e-9, 50)
print("opt took {} seconds".format(time.time() - begin))
if self.verbose:
print("opt took {} seconds".format(time.time() - begin))

for node, vtx in zip(self.opt.nodes, self.graph.vertices):
vtx.obj.corrected_pose = Transform.from_pose2d(Pose2(node.x, node.y, node.yaw))
Expand Down

0 comments on commit 4776ec8

Please sign in to comment.