To reimplement the GTSAM BetweenFactor with an additional scale parameter, you'll need to define a custom factor and compute its Jacobian. Here's a step-by-step guide to achieve this:
Define the Custom Factor: Create a new class that inherits from gtsam::BetweenFactor<T>.
Add Scale Parameter: Include a scale parameter in your custom factor.
Compute the Error: Modify the error computation to include the scale parameter.
Compute the Jacobian: Derive the Jacobian matrix for the custom factor.
Constructor: The constructor takes the keys for the two poses, the measurement, the scale parameter, and the noise model.
evaluateError: This method computes the error between the measured pose and the predicted pose, scaled by the scale_ parameter.
Jacobian Calculation: The Jacobian is computed using numericalDerivative31, which numerically differentiates the evaluateError function to obtain the Jacobian matrix.
Usage
To use this custom factor in a GTSAM optimization problem, you would add it to a NonlinearFactorGraph and optimize as usual.