-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SE(2) and SE(3) offset parameter classes
- Loading branch information
1 parent
6818bd0
commit 1f37c5f
Showing
2 changed files
with
138 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,43 @@ | ||
# Copyright (c) 2020 Jeff Irion and contributors | ||
|
||
"""Unit tests for the ``BaseEdge`` class. | ||
"""Unit tests for the g2o parameters classes. | ||
""" | ||
|
||
|
||
import unittest | ||
|
||
# from graphslam.g2o_parameters import BaseG2OParameter | ||
from graphslam.g2o_parameters import G2OParameterSE2Offset, G2OParameterSE3Offset | ||
from graphslam.pose.se2 import PoseSE2 | ||
from graphslam.pose.se3 import PoseSE3 | ||
|
||
|
||
class TestBaseEdge(unittest.TestCase): | ||
"""Tests for the ``BaseG2OParameter`` class.""" | ||
class TestG2OParameterSE2Offset(unittest.TestCase): | ||
"""Tests for the ``G2OParameterSE2Offset`` class.""" | ||
|
||
def test_to_g2o_from_g2o(self): | ||
"""Test the `to_g2o` and `from_g2o` methods.""" | ||
param = G2OParameterSE2Offset(("PARAMS_SE2OFFSET", 2), PoseSE2([1.0, 2.0], 3.0)) | ||
|
||
param2 = G2OParameterSE2Offset.from_g2o(param.to_g2o()) | ||
|
||
self.assertTupleEqual(param.key, param2.key) | ||
self.assertTrue(param.value.equals(param2.value)) | ||
|
||
self.assertIsNone(G2OParameterSE2Offset.from_g2o("bologna")) | ||
|
||
|
||
class TestG2OParameterSE3Offset(unittest.TestCase): | ||
"""Tests for the ``G2OParameterSE3Offset`` class.""" | ||
|
||
def test_to_g2o_from_g2o(self): | ||
"""Test the `to_g2o` and `from_g2o` methods.""" | ||
param = G2OParameterSE3Offset(("PARAMS_SE3OFFSET", 4), PoseSE3([1.0, 2.0, 3.0], [0.1, 0.2, 0.3, 0.4])) | ||
param.value.normalize() | ||
|
||
param2 = G2OParameterSE3Offset.from_g2o(param.to_g2o()) | ||
|
||
self.assertTupleEqual(param.key, param2.key) | ||
self.assertTrue(param.value.equals(param2.value)) | ||
|
||
self.assertIsNone(G2OParameterSE3Offset.from_g2o("bologna")) |