Giter Site home page Giter Site logo

Values accept Dict about symforce HOT 4 CLOSED

hflemmen avatar hflemmen commented on May 29, 2024
Values accept Dict

from symforce.

Comments (4)

aaron-skydio avatar aaron-skydio commented on May 29, 2024

You should be able to put a Values in a Values, which should be similar to putting a Dict in a Values? Is there a reason that doesn't cover what you need?

from symforce.

hflemmen avatar hflemmen commented on May 29, 2024

It could be that it cover what I need. I did try to do this, but I struggled with different errors.

How would I reference a key in a Values inside a Values?

E.g. (slightly modified from robot_2d_localization)

    landmarks = Values()
    landmarks["landmark_0"] = sf.V2(-2, 2)
    landmarks["landmark_1"] = sf.V2(1, -3)
    landmarks["landmark_2"] = sf.V2(5, 2)

    initial_values = Values(
        poses=[sf.Pose2.identity()] * num_poses,
        landmarks=landmarks,
        distances=[1.7, 1.4],
        angles=np.deg2rad([[55, 245, -35], [95, 220, -20], [125, 220, -20]]).tolist(),
        epsilon=sf.numeric_epsilon,
    )

How would i reference the key to eg. landmark_0?

When constructing a Factor accessing the key as keys=[f"poses[{i}]", f"landmarks[landmark_{j}]", f"angles[{i}][{j}]", "epsilon"], failed.

The full modified example: robot_2d_localization.txt

from symforce.

aaron-skydio avatar aaron-skydio commented on May 29, 2024

You should be able to do f"landmarks.landmark_{j}"

from symforce.

hflemmen avatar hflemmen commented on May 29, 2024

Correct, it works. Thank you.

It covers my use case, so I close this now.

from symforce.

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.