-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
781a317
commit 4b33f49
Showing
5 changed files
with
84 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import List | ||
|
||
import numpy as np | ||
|
||
from project.dto.Pcd import Pcd | ||
from project.slam.SLAMGraph import SLAMGraph | ||
from mrob.mrob import LM_ELLIPS | ||
|
||
|
||
class EigenPointsSLAMGraph(SLAMGraph): | ||
|
||
def _add_planes(self, pcd_s: List[Pcd], needed_indices: List[int]): | ||
for _ in self.plane_index_to_real_index: | ||
self.graph.add_eigen_factor_plane() | ||
|
||
for i, pcd in enumerate(pcd_s): | ||
for plane in pcd.planes: | ||
if needed_indices is not None and plane.track not in needed_indices: | ||
continue | ||
|
||
cur_indx = self.plane_index_to_real_index[plane.track] | ||
plane_points = pcd.points[plane.plane_indices] | ||
self.graph.eigen_factor_plane_add_points_array( | ||
planeEigenId=cur_indx, | ||
nodePoseId=self.graph_trajectory[i], | ||
pointsArray=plane_points, | ||
W=1.0 | ||
) | ||
|
||
def _solve(self): | ||
self.graph.solve(LM_ELLIPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import List | ||
from mrob.mrob import FGraph, LM | ||
|
||
import numpy as np | ||
|
||
from project.dto.Pcd import Pcd | ||
from project.slam.SLAMGraph import SLAMGraph | ||
|
||
|
||
class LandmarksSLAMGraph(SLAMGraph): | ||
|
||
def _add_planes(self, pcd_s: List[Pcd], needed_indices: List[int]): | ||
w_z = np.identity(4) # weight matrix | ||
for _ in self.plane_index_to_real_index: | ||
self.graph.add_node_plane_4d(np.array([1, 0, 0, 0])) | ||
for i, pcd in enumerate(pcd_s): | ||
for plane in pcd.planes: | ||
if needed_indices is not None and plane.track not in needed_indices: | ||
continue | ||
|
||
cur_indx = self.plane_index_to_real_index[plane.track] | ||
self.graph.add_factor_1pose_1plane_4d( | ||
plane.equation, self.graph_trajectory[i], cur_indx, w_z | ||
) | ||
|
||
def _solve(self): | ||
self.graph.solve(LM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters