Code Monkey home page Code Monkey logo

Comments (6)

tmcg0 avatar tmcg0 commented on August 26, 2024

Some progress: when the numerical derivative blows up, it's because the calculated angle is near pi or -pi. See screenshot below. Will update unit test to only check derivatives if angle is a little bit away from the boundary.
image

from bioslam.

tmcg0 avatar tmcg0 commented on August 26, 2024

It seems like it's multiple jacobians that will randomly fail this, whereas I was trying to target a specific one. From running a few times, the following will fail at threshold 1e-3:
1,4,6
(and note that 7 probably also fails since 6 and 7 are nearly identical but 6 will error first)
What do these have in common? They're the derivatives w.r.t. the two poses and the distal imu vectors v1 and v2 (from the imu to the joints)

from bioslam.

tmcg0 avatar tmcg0 commented on August 26, 2024

On second thought, I couldn't get unsignedAngle() derive to pass with any tighter tolerance than 1.0e-4. I think that function is the underlying problem here. Changing title of issue, investigate this. See unit test testGenericMath.cpp.

from bioslam.

tmcg0 avatar tmcg0 commented on August 26, 2024

For unsignedAngle(v1,v2), this does seem to be related to norm(cross(v1,v2)). If this norm is small, the numerical derivatives don't pass. Maybe this is just a classical numerical conditioning issue?

from bioslam.

tmcg0 avatar tmcg0 commented on August 26, 2024

Bug identified: it's related to the derivative of atan(y,x). When y or x gets really small, this causes atan2's derivative to blow up. See testGenericMath.cpp, function testatan2() for more info.

I'm not gonna close this for now. It leads to the question: what do we do about this? Do we just make sure we are always testing with non-small x and y?

To be clear: This is a problem not with bioslam's analytical derivative for atan2, but rather with numerical approximation of that derivative for unit testing. We test with random values, so it's possible that it would best to just put in some simple if/then logic to only test with non-small values of x and y.

from bioslam.

tmcg0 avatar tmcg0 commented on August 26, 2024

I didn't find the real reason this test was failing. However, since it was obviously just due to the numerical derivative blowing up I've added a hack fix: just disregard tests where the numerical derivative blew up. Not great form, but fixes the test for now.

from bioslam.

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.