-
Notifications
You must be signed in to change notification settings - Fork 9
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
About the system model and non-quadratic objective function #3
Comments
Hi,
The car model is constrained to only move in one direction (forward). This
means that the motion in the other planar direction is constrained, in this
case I have assumed that "forward" is towards the y-axis of the robot.
Therefore, the velocity of the robot will be applied in the y direction
when its heading is 0, however, when the robot heading is non-zero, the
robot will move at an angle and the robot displacement will be in both x
and y axis, in other words, when looking at the robot from the world frame,
it will appear to have velocity in both x and y axis. To calculate this
velocity I take the sine and cosine of the robot heading, this gives me a
multiplier (scaling value) that I multiply with the current robot velocity
to make it move according to the heading.
You can think of the result after ***@***.*** to be equal to:
[
[delta_y],
[delta_x],
[delta_theta]
]
The cost function is a quadratic equation, I am summing the squares of the
variables and their differences.
…On Tue, Mar 26, 2024 at 5:24 PM 莫非 ***@***.***> wrote:
First of all thank you for sharing this code! But I have a question for
this.
The vehicle model you use in car.py is *non-linear*.
def update_state(self, dt):
A = np.array([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]
])
B = np.array([
[np.sin(self.x[2, 0] + np.pi/2)*dt, 0],
[np.cos(self.x[2, 0] + np.pi/2)*dt, 0],
[0 , dt]
])
vel = np.array([
[self.x_dot[0, 0]],
[self.x_dot[2, 0]]
])
self.x = ***@***.*** + ***@***.***
In the MPC objective function, you directly use this model to derive all
future states within the control hoziron, and use QP to solve it.
x, _ = controller_car.get_state()z_k[:,i] = [x[0, 0], x[1, 0]]cost += np.sum(self.R@(u_k[:,i]**2))
But in this case, *the objective function is not quadratic*, right? (it
contains sin(x) ).
Is there any theoretical basis for doing this? Or did I misunderstand
something? Hope for your responding, thank you!
—
Reply to this email directly, view it on GitHub
<#3>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIUWJZIJM3LHTH6YC4PKYA3Y2FSHRAVCNFSM6AAAAABFI2GUMGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYDQMJQGQ2TONI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thank you for your detailed response! But I still have one question. |
First of all thank you for sharing this code! But I have a question for this.
The vehicle model you use in car.py is non-linear.
In the MPC objective function, you directly use this model to derive all future states within the control hoziron, and use QP to solve it.
But in this case, the objective function is not quadratic, right? (it contains sin(x) ).
Is there any theoretical basis for doing this? Or did I misunderstand something? Hope for your responding, thank you!
The text was updated successfully, but these errors were encountered: