Skip to content

Some objects in Python have no attribute 'measured' #1142

@doublestrong

Description

@doublestrong

Description

Hi, I am using the python wrapper of GTSAM. I cannot get measured() from the RangeFactor2D and BearingFactor2D objects. I can get it from the BearingRangeFactor2D object. Any clues for potential solutions? Is there a different way to access the measurements in those factors in Python? Thanks!

Steps to reproduce

import gtsam

if __name__ == "__main__":
    try:
        br_f = gtsam.BearingRangeFactor2D(1, 2, gtsam.Rot2(.3), 10.0, gtsam.noiseModel.Isotropic.Sigma(2, 1))
        print(br_f.measured())
    except Exception as e:
        print(str(e))
    try:
        range_f = gtsam.RangeFactor2D(1, 2, 10.0, gtsam.noiseModel.Isotropic.Sigma(1, 1))
        print(range_f.measured())
    except Exception as e:
        print(str(e))
    try:
        bearing_f = gtsam.BearingFactor2D(1, 2, gtsam.Rot2(.3), gtsam.noiseModel.Isotropic.Sigma(1, 1))
        print(bearing_f.measured())
    except Exception as e:
        print(str(e))

Expected behavior

bearing : 0.3
range  10

'gtsam.gtsam.RangeFactor2D' object has no attribute 'measured'
'gtsam.gtsam.BearingFactor2D' object has no attribute 'measured'

Process finished with exit code 0

Environment

I am using Ubuntu 20.04. The GTSAM on my computer was installed from the source on branch develop. Here is my environment:

name: GTSAM_test
channels:
  - defaults
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=4.5=1_gnu
  - brotlipy=0.7.0=py39h27cfd23_1003
  - ca-certificates=2021.10.26=h06a4308_2
  - certifi=2021.10.8=py39h06a4308_2
  - cffi=1.15.0=py39hd667e15_1
  - charset-normalizer=2.0.4=pyhd3eb1b0_0
  - conda=4.11.0=py39h06a4308_0
  - conda-content-trust=0.1.1=pyhd3eb1b0_0
  - conda-package-handling=1.7.3=py39h27cfd23_1
  - cryptography=36.0.0=py39h9ce1e76_0
  - idna=3.3=pyhd3eb1b0_0
  - ld_impl_linux-64=2.35.1=h7274673_9
  - libffi=3.3=he6710b0_2
  - libgcc-ng=9.3.0=h5101ec6_17
  - libgomp=9.3.0=h5101ec6_17
  - libstdcxx-ng=9.3.0=hd4cf53a_17
  - ncurses=6.3=h7f8727e_2
  - openssl=1.1.1m=h7f8727e_0
  - pip=21.2.4=py39h06a4308_0
  - pycosat=0.6.3=py39h27cfd23_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pyopenssl=21.0.0=pyhd3eb1b0_1
  - pysocks=1.7.1=py39h06a4308_0
  - python=3.9.7=h12debd9_1
  - readline=8.1.2=h7f8727e_1
  - requests=2.27.1=pyhd3eb1b0_0
  - ruamel_yaml=0.15.100=py39h27cfd23_0
  - setuptools=58.0.4=py39h06a4308_0
  - six=1.16.0=pyhd3eb1b0_0
  - sqlite=3.37.0=hc218d9a_0
  - tk=8.6.11=h1ccaba5_0
  - tqdm=4.62.3=pyhd3eb1b0_1
  - tzdata=2021e=hda174b7_0
  - urllib3=1.26.7=pyhd3eb1b0_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.2.5=h7b6447c_0
  - yaml=0.2.5=h7b6447c_0
  - zlib=1.2.11=h7f8727e_4
  - pip:
    - numpy==1.19.5

Additional information

I looked into the declaration of objects RangeFactor2D and BearingRangeFactor2D navigated by my PyCharm IDE. I did see measured() in the BearingRangeFactor2D.py.

RangeFactor2D.py

# encoding: utf-8
# module gtsam.gtsam
# from /home/chad/miniconda3/envs/GTSAM_test/lib/python3.9/site-packages/gtsam-4.2a5-py3.9.egg/gtsam/gtsam.cpython-39-x86_64-linux-gnu.so
# by generator 1.147
""" pybind11 wrapper of basis """

# imports
import gtsam.gtsam.symbol_shorthand as symbol_shorthand # <module 'gtsam.gtsam.symbol_shorthand'>
import gtsam.gtsam.noiseModel as noiseModel # <module 'gtsam.gtsam.noiseModel'>
import gtsam.gtsam.lago as lago # <module 'gtsam.gtsam.lago'>
import gtsam.gtsam.imuBias as imuBias # <module 'gtsam.gtsam.imuBias'>
import gtsam.gtsam.utilities as utilities # <module 'gtsam.gtsam.utilities'>
import pybind11_builtins as __pybind11_builtins


from .NoiseModelFactor import NoiseModelFactor

class RangeFactor2D(NoiseModelFactor):
    # no doc
    def deserialize(self, serialized): # real signature unknown; restored from __doc__
        """ deserialize(self: gtsam.gtsam.RangeFactor2D, serialized: str) -> None """
        pass

    def serialize(self): # real signature unknown; restored from __doc__
        """ serialize(self: gtsam.gtsam.RangeFactor2D) -> str """
        return ""

    def __getstate__(self): # real signature unknown; restored from __doc__
        """ __getstate__(self: gtsam.gtsam.RangeFactor2D) -> tuple """
        return ()

    def __init__(self, key1, key2, measured, noiseModel): # real signature unknown; restored from __doc__
        """ __init__(self: gtsam.gtsam.RangeFactor2D, key1: int, key2: int, measured: float, noiseModel: gtsam.gtsam.noiseModel.Base) -> None """
        pass

    def __setstate__(self, arg0): # real signature unknown; restored from __doc__
        """ __setstate__(self: gtsam.gtsam.RangeFactor2D, arg0: tuple) -> None """
        pass

BearingRangeFactor2D.py

# encoding: utf-8
# module gtsam.gtsam
# from /home/chad/miniconda3/envs/GTSAM_test/lib/python3.9/site-packages/gtsam-4.2a5-py3.9.egg/gtsam/gtsam.cpython-39-x86_64-linux-gnu.so
# by generator 1.147
""" pybind11 wrapper of basis """

# imports
import gtsam.gtsam.symbol_shorthand as symbol_shorthand # <module 'gtsam.gtsam.symbol_shorthand'>
import gtsam.gtsam.noiseModel as noiseModel # <module 'gtsam.gtsam.noiseModel'>
import gtsam.gtsam.lago as lago # <module 'gtsam.gtsam.lago'>
import gtsam.gtsam.imuBias as imuBias # <module 'gtsam.gtsam.imuBias'>
import gtsam.gtsam.utilities as utilities # <module 'gtsam.gtsam.utilities'>
import pybind11_builtins as __pybind11_builtins


from .NoiseModelFactor import NoiseModelFactor

class BearingRangeFactor2D(NoiseModelFactor):
    # no doc
    def deserialize(self, serialized): # real signature unknown; restored from __doc__
        """ deserialize(self: gtsam.gtsam.BearingRangeFactor2D, serialized: str) -> None """
        pass

    def measured(self): # real signature unknown; restored from __doc__
        """ measured(self: gtsam.gtsam.BearingRangeFactor2D) -> gtsam.gtsam.BearingRange2D """
        pass

    def serialize(self): # real signature unknown; restored from __doc__
        """ serialize(self: gtsam.gtsam.BearingRangeFactor2D) -> str """
        return ""

    def __getstate__(self): # real signature unknown; restored from __doc__
        """ __getstate__(self: gtsam.gtsam.BearingRangeFactor2D) -> tuple """
        return ()

    def __init__(self, poseKey, pointKey, measuredBearing, measuredRange, noiseModel): # real signature unknown; restored from __doc__
        """ __init__(self: gtsam.gtsam.BearingRangeFactor2D, poseKey: int, pointKey: int, measuredBearing: gtsam.gtsam.Rot2, measuredRange: float, noiseModel: gtsam.gtsam.noiseModel.Base) -> None """
        pass

    def __setstate__(self, arg0): # real signature unknown; restored from __doc__
        """ __setstate__(self: gtsam.gtsam.BearingRangeFactor2D, arg0: tuple) -> None """
        pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions