Skip to content

About the system model and non-quadratic objective function #3

@BlueeHole

Description

@BlueeHole

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 = A@self.x + B@vel

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.Q@((desired_state-z_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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions