GithubHelp home page GithubHelp logo

Comments (3)

osrf-migration avatar osrf-migration commented on August 24, 2024

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


I looked at this with @caguero today, and it appears to be related to uninitialized variables. The following patch fixes it:

diff -r 832c63ae5b8c10237e90f0adaf74281892065532 include/ignition/math/Filter.hh
--- a/include/ignition/math/Filter.hh   Fri Jul 11 10:51:20 2014 -0700
+++ b/include/ignition/math/Filter.hh   Fri Jul 11 16:49:55 2014 -0700
@@ -212,7 +212,12 @@
       }

       /// \brief Input gain control coefficients.
-      protected: double a0, a1, a2, b0, b1, b2 = 0;
+      protected: double a0 = 0,
+                        a1 = 0,
+                        a2 = 0,
+                        b0 = 0,
+                        b1 = 0,
+                        b2 = 0;

       /// \brief Gain of the feedback coefficients.
       protected: T x1, x2, y1, y2;
diff -r 832c63ae5b8c10237e90f0adaf74281892065532 src/Filter_TEST.cc
--- a/src/Filter_TEST.cc    Fri Jul 11 10:51:20 2014 -0700
+++ b/src/Filter_TEST.cc    Fri Jul 11 16:49:55 2014 -0700
@@ -73,6 +73,7 @@
 TEST(FilterTest, Biquad)
 {
   math::BiQuad<double> filterA;
+  filterA.Set(0.0);
   EXPECT_NEAR(filterA.Value(), 0.0, 1e-10);
   EXPECT_NEAR(filterA.Process(1.1), 0.0, 1e-10);

   filterA.Fc(0.3, 1.4);

The modification to the test with Set(0.0) is necessary to initialize the Filter::y0 variable. I don't know of any other way to initialize it.

from gz-math.

osrf-migration avatar osrf-migration commented on August 24, 2024

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


Instead of filterA.set(0.0); in the FilterTest, can you modify line 248 in Filter.hh to be:

protected: y0{}

from gz-math.

osrf-migration avatar osrf-migration commented on August 24, 2024

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • changed state from "new" to "resolved"

Fixed in pull request #23

from gz-math.

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.