GithubHelp home page GithubHelp logo

Comments (9)

dellaert avatar dellaert commented on August 19, 2024

Rather than creating a file, could you try to use the code example in in test_ShonanAvaerging.py? Here is a snippet:

        measurements = []
        unit3 = gtsam.noiseModel.Unit.Create(3)
        m01 = BinaryMeasurementRot3(0, 1, Rot3.Yaw(math.radians(90)), unit3)
        m12 = BinaryMeasurementRot3(1, 2, Rot3.Yaw(math.radians(90)), unit3)
        measurements.append(m01)
        measurements.append(m12)
        obj = ShonanAveraging3(measurements)
        self.assertIsInstance(obj, ShonanAveraging3)
        initial = obj.initializeRandomly()
        _, cost = obj.run(initial, min_p=3, max_p=5)
        self.assertAlmostEqual(cost, 0)

from gtsam.

anilesec avatar anilesec commented on August 19, 2024

Thanks for the response! I have tried this. But I am getting the following error
Error

I think it could be mismatch in gtsam version (I installed gtsam using pip as "pip install gtsam" )

from gtsam.

dellaert avatar dellaert commented on August 19, 2024

Yeah. Try uninstalling and pip install gtbook

from gtsam.

anilesec avatar anilesec commented on August 19, 2024

I created a new conda env (python 3.6.9) and installed gtbook (pip install gtbook).

I still get the same error:

image

from gtsam.

dellaert avatar dellaert commented on August 19, 2024

Dang,. Sorry this is happening to you. I will investigate but might need the 4.2 release.

from gtsam.

anilesec avatar anilesec commented on August 19, 2024

My bad! May I ask when the 4.2 release is planned? Otherwise, if I can somehow figure out how to set the measurements value in the input(g2o) file, perhaps I can run "ShonanAveragingCLI.py" script. Any help to set the 21 measurements values for a custom dataset would be a great help for my research.

Thank you very much for your precious time and effort!

from gtsam.

dellaert avatar dellaert commented on August 19, 2024

Actually, it is related to recent changes in the wrapper. There was an old way to do this, and I tried it in this notebook, and it works. Here is the code snippet:

%pip -q install gtbook

import math
import gtsam
from gtsam import BinaryMeasurementRot3, Rot3, ShonanAveraging3, BinaryMeasurementsRot3

measurements = BinaryMeasurementsRot3()
unit3 = gtsam.noiseModel.Unit.Create(3)
m01 = BinaryMeasurementRot3(0, 1, Rot3.Yaw(math.radians(90)), unit3)
m12 = BinaryMeasurementRot3(1, 2, Rot3.Yaw(math.radians(90)), unit3)
measurements.append(m01)
measurements.append(m12)
obj = ShonanAveraging3(measurements)
assert isinstance(obj, ShonanAveraging3)
initial = obj.initializeRandomly()
result, cost = obj.run(initial, min_p=3, max_p=5)
assert cost < 1e-4
print(result)

I will close this issue but try to make sure the "list" way works in 4.2.

from gtsam.

anilesec avatar anilesec commented on August 19, 2024

Great! It works now :) Thanks a lot!

from gtsam.

anilesec avatar anilesec commented on August 19, 2024
  measurements = []
  unit3 = gtsam.noiseModel.Unit.Create(3)
  m01 = BinaryMeasurementRot3(0, 1, Rot3.Yaw(math.radians(90)), unit3)
  m12 = BinaryMeasurementRot3(1, 2, Rot3.Yaw(math.radians(90)), unit3)
  measurements.append(m01)
  measurements.append(m12)
  obj = ShonanAveraging3(measurements)
  self.assertIsInstance(obj, ShonanAveraging3)
  initial = obj.initializeRandomly()
  _, cost = obj.run(initial, min_p=3, max_p=5)
  self.assertAlmostEqual(cost, 0)

This snippet does not seem to work in 4.2 release.

Also how to select the noise model for the real-world dataset? Is there an example?

from gtsam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.