Woolfrey / software_robot_library

Custom classes for robot control.
GNU General Public License v3.0
2 stars 1 forks source link

Set scalar Newton step to minimum in QP Solver #87

Closed Woolfrey closed 1 year ago

Woolfrey commented 1 year ago

At the moment, the scalar for the step size is computed as:

    // Ensure next step remains inside constraint
    alpha = this->alpha0;
    for(int j = 0; j < numConstraints; j++)
    {
        // d_i   = b'*x_i - z
        // d_i+1 = b'*(x_i + alpha*dx_i) - z
        ///      = alpha*b'*dx_i > 0

        float dotProd = bt[j].dot(dx);

        if( d[j] + alpha*dotProd < 0 ) alpha = (1e-04 - d[j]) / dotProd;
    }

However, this is only evaluated for the jth constraint. alpha should be set based on the largest constraint violation.

Woolfrey commented 1 year ago

The QPSolver class has been made in to a separate repository/library: https://github.com/Woolfrey/SimpleQPSolver