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

Add a toy 2D system with nonlinear dynamics. #18

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Conversation

hongkai-dai
Copy link
Owner

@hongkai-dai hongkai-dai commented Nov 30, 2023

We can certify the CLF/CBF are compatible for this toy system.


This change is Reviewable

Copy link
Owner Author

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@Chuanruijiang for review please, thanks!

Reviewable status: 0 of 5 files reviewed, all discussions resolved (waiting on @Chuanruijiang)

Copy link
Collaborator

@Chuanruijiang Chuanruijiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 5 files at r1, all commit messages.
Reviewable status: 2 of 5 files reviewed, 2 unresolved discussions (waiting on @hongkai-dai)


compatible_clf_cbf/clf_cbf.py line 575 at r1 (raw file):

        Note that this function only adds the constraint
        -(1+ϕᵢ,₀(x))*bᵢ(x) +ⱼϕᵢ,(x)pⱼ(x) is sos
        It doesn't add the constraint ϕᵢ,₀(x), ϕᵢ,(x) are sos.

Why we don't need these \phi(x) polynomials to be SOS?


examples/nonlinear_toy/toy_system.py line 24 at r1 (raw file):

                    {
                        sym.Monomial(x[0]): sym.Expression(-1),
                        sym.Monomial(x[0], 3): sym.Expression(-1.0 / 6.0),

Maybe sym.Expression(1.0/6.0)? I saw that the system dynamics above is dot(x1) = -x0 + 1/6(x0)^3

We can certify the CLF/CBF are compatible for this toy system.
Copy link
Owner Author

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @Chuanruijiang)


compatible_clf_cbf/clf_cbf.py line 575 at r1 (raw file):

Previously, Chuanruijiang wrote…

Why we don't need these \phi(x) polynomials to be SOS?

Because we will use this function in two cases (during bilinear alternation)

  1. Fix the Lagrangian multiplier \phi(x), search for the CLF/CBF.
  2. Fix the CLF/CBF, search for the Lagrangian multiplier \phi.

In the second case, we will need the condition that \phi(x) is sos; while in the first case we do not.


examples/nonlinear_toy/toy_system.py line 24 at r1 (raw file):

Previously, Chuanruijiang wrote…

Maybe sym.Expression(1.0/6.0)? I saw that the system dynamics above is dot(x1) = -x0 + 1/6(x0)^3

Done. Good catch

Copy link
Collaborator

@Chuanruijiang Chuanruijiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @hongkai-dai)


compatible_clf_cbf/clf_cbf.py line 575 at r1 (raw file):

Previously, hongkai-dai (Hongkai Dai) wrote…

Because we will use this function in two cases (during bilinear alternation)

  1. Fix the Lagrangian multiplier \phi(x), search for the CLF/CBF.
  2. Fix the CLF/CBF, search for the Lagrangian multiplier \phi.

In the second case, we will need the condition that \phi(x) is sos; while in the first case we do not.

Ah, I see. So in this file, "class compatible_cbfclf " should be used when we fix the lagrangian and find b(x),V(x). And the first three classes are used when we fix the b(x), V(x) and compute the lagrangian. Is that correct?

Copy link
Owner Author

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 5 files reviewed, 1 unresolved discussion (waiting on @Chuanruijiang)


compatible_clf_cbf/clf_cbf.py line 575 at r1 (raw file):

Previously, Chuanruijiang wrote…

Ah, I see. So in this file, "class compatible_cbfclf " should be used when we fix the lagrangian and find b(x),V(x). And the first three classes are used when we fix the b(x), V(x) and compute the lagrangian. Is that correct?

class CompatibleClfCbf will be used in both cases: 1) when we fix the Lagrangian and 2) when we fix the CLF/CBF. In both cases we will call this function _add_barrier_safe_constraint. But when we search for the Lagrangian, we will additionally add the constraint that the Lagrangian is sos.

Copy link
Collaborator

@Chuanruijiang Chuanruijiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 5 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @hongkai-dai)

@hongkai-dai hongkai-dai merged commit bb240a1 into main Dec 15, 2023
2 checks passed
@hongkai-dai hongkai-dai deleted the nonlinear_2d_toy branch January 3, 2024 06:41
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

Successfully merging this pull request may close these issues.

2 participants