Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions Regarding the Swing MPC in the Code #30 #31

Open
TRo202 opened this issue Jan 30, 2024 · 0 comments
Open

Questions Regarding the Swing MPC in the Code #30 #31

TRo202 opened this issue Jan 30, 2024 · 0 comments

Comments

@TRo202
Copy link

TRo202 commented Jan 30, 2024

Hello.

The issue #30 I posted few days ago was closed as completed but I am afraid that I didn't get any answer.
Therefore I would like to bring it up again and will greatly appreciate if you would kindly reply to my questions!
Thank you!

  1. When converting the quadratic form of the cost function into the QP standard form, there are terms
    $-2a_2\vec x_N\vec x_f, - 2a_3\dot {\vec x_N}\dot {\vec x_f},-2a_4z(\frac{T}{2})z_{mid}$ that make up the $q^T x$ term. But q_ vector in the code is set as 0. Why is it so?

  2. a For the equality constraint of the velocity components, why do the components of A_eq_ that correspond to slack variables have -1 for both pos. and vel. slack variables?

        A_eq_(3, nb_var_ - 6) = -1;
        A_eq_(3, nb_var_ - 3) = -1;
    

    Shouldn't it just be
    A_eq_(3, nb_var_ - 3) = -1;

2.b Why did you set the equality constraints B_eq_ for the velocity same as the ones for the position? I wonder if there shouldn't be matrices like velocity_terms_F that would include the components that correspond to velocity (1st, 3rd, 5th rows of $A^{i-j}B$) in init_acceleration_velocity_terms() function. Or are the constraints for position and velocity just assumed to be same?

2.c By the equation $(\textrm{position terms})\vec f - \vec x_i = -A^i \vec x_{mea} + (\textrm{position terms})\vec h_c$
and since \vec x_N is already inside the slack variables, why did you include target_pose_ on the right side of the equation?

2.d I don't understand why it's just mid_z for the last component in B_eq_ since $(\textrm{position terms Fz})\vec f - z(T/2) = z_{mid}$ seems to be wrong.

  1. For the inequality constraint, shouldn't the code be like
        B_ineq_(i - 1) = current_pose_(2) -
                         std::min(start_pose(2), target_pose(2)) + 0.0001 -
                         current_velocity_(2) * planner_loop_ * i -
                         non_linear_terms[is_left_leg_in_contact_](i, 2);
    
    instead of
        B_ineq_(i - 1) = current_pose_(2) -
                         std::min(start_pose(2), target_pose(2)) + 0.0001 +
                         current_velocity_(2) * planner_loop_ * i +
                         non_linear_terms[is_left_leg_in_contact_](i, 2);
    
    since we have to multiply the equation $B_{min} <= A_{ineq}\ x$ by -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant