Cal3Unified not correct Value

Issue #109 resolved
Frank Dellaert created an issue

@richardroberts and I figured out that Cal3Unified is wrong. Look in DerivedValue and you'll see that it implements the virtual functions defined in Value, and in implementing them, calls the functions in DERIVED (which would be Cal3_S2 and not Cal3Unified). So, any code that relies on calling the virtual functions in Value, which includes copying, retracting, localCoordinatesing, etc, a Values object, will turn all Cal3Unified objects into Cal3_S2 objects.

@richardroberts also said:

June 19, 2014 at 12:57 PM
Hi Frank, I spent a bit of time just now trying to see how to do this and I don't
think there's a good way to do it while using DerivedValue.  DerivedValue fills in 
boilerplate code required for creating a class that derives from Value, but it wasn't 
written with further derived classes in mind.  You may still do it by deriving directly 
from Value and then implementing the functions that DerivedValue implements, e.g.
writing this boilerplate code in the derived classes.  Or by rethinking DerivedValue 
so that it can work with an inheritance chain.

I am thinking this could be solved by having both Cal3Unified and Cal3DS2 be subclasses of DerivedValue and Cal3DS2_Base, which is not a value.

Comments (9)

  1. Jing Dong

    @amelim should be fixed according to the solution given, but I cannot really test it since it's not test in the unit test. I'n figuring out how to add it in the unit-test

  2. Jing Dong

    Hi @dellaert could I have the test code you run in this error? In the current unit test I cannot test it out...

  3. Frank Dellaert reporter

    I just saw it, did not have a failure case (yet). I propose you add a test before your fix that fails, then check if it works after...

  4. Jing Dong

    @dellaert add tests for DerivedValue and Serialization, no test error (DerivedValue test fails before fix). Should be fixed.

  5. Frank Dellaert reporter

    @jdong37 if it is fixed then close the issue :-) Use "Workflow" menu in browser and mark as resolved...

  6. Log in to comment