1. Determine Control Objectives
- Performance: Identify which states are most important to regulate accurately (e.g., position, velocity).
- Effort: Understand which control inputs are costly or should be minimized (e.g., due to energy consumption or wear).
2. Define Q Matrix
- Size: $Q$ should be a square matrix of size $n \times n$ (where $n$ is the number of states).
- Diagonal Elements: The diagonal elements of $Q$, denoted $Q_{ii}$, determine the relative importance of minimizing each state variable $x_i$.
- Off-Diagonal Elements: Off-diagonal elements $(Q_{ij}, i \neq j)$ determine the importance of the correlation between different states.
- Common Choice: Often, $Q$ is chosen as a diagonal matrix for simplicity and to avoid having to tune off-diagonal elements.
- Example: If position regulation is crucial, the elements of $Q$ corresponding to position states should be larger than those corresponding to other states.
3. Define R Matrix
- Size: $R$ should be a square matrix of size $m \times m$ (where $m$ is the number of control inputs).
- Diagonal Elements: The diagonal elements of $R$, denoted $R_{ii}$, determine the relative importance of minimizing each control input $u_i$.
- Off-Diagonal Elements: Off-diagonal elements $(R_{ij}, i \neq j)$ determine the importance of the correlation between different control inputs.
- Common Choice: Often, $R$ is chosen as a diagonal matrix for simplicity.
- Example: If energy conservation is crucial, elements of $R$ corresponding to propulsive control inputs might be larger.
4. Balance Between State and Control Effort
- Trade-Off: $Q$ and $R$ determine the trade-off between state regulation and control effort.
- Larger elements in $Q$ prioritize state regulation, while larger elements in $R$ prioritize minimizing control effort.
- Stability: Ensure that $Q$ and $R$ are positive semi-definite and positive definite, respectively, to ensure stability and optimality.
5. Iterative Tuning
- Initial Guess: Start with an initial guess for $Q$ and $R$ based on your control objectives.