Which frame to choose for these equations of motion? I have a robot with four wheels and I want to create a model to simulate its movement (in the plane).
Assume the robot is a perfect square with side length 1 and wheels at its edges:
3-------1
|       |  ↑ y
|       |  → x
4-------2 

My problem is I don't quite understand how to choose the right reference frame (inertial or body) for my equations. I looked up in a textbook for vehicle modeling and found the following equations:
$$
\begin{align}
M x''&=\sum f^x_i \\
M y''&=\sum f^y_i \\
\Theta r''&=f_1^{b,y}+f_2^{b,y} - (f_3^{b,y}+f_4^{b,y}) + \frac{1}{2}(f_2^{b,x}-f_1^{b,x}+f_4^{b,x}-f_3^{b,x})
\end{align}
$$
Here $f_i^x$ means force in $x$-direction at wheel position $i$ in inertial frame and $f_i^{b,x}$ means force in $x$-direction at wheel position $i$ in the body frame.
A fellow student told me it would be best to write the equations all in inertial frame because it would lead to easier equations (no fictious forces). However I have multiple questions now:

*

*How can I decide which frame I have to use for a specific equation? Is there a "best practice" for this?

*Why are the equations in the textbook "mixed" (only the one for the rotation in the body frame)? Can this make sense?

*The rotation $r''$ in the textbook seems to be in inertial frame... shouldn't it be body frame because the use of forces in body frame? Or is $r''$ the same in both frames?

 A: For single body problems, you always need to sum of torques about the center of mass and describe the motion of the center of mass with Newton's laws.
The choice of coordinate directions depends on how the forces are described, choosing the directions that simplify the problem most.
You are actually asking about the kinematics of problems, and how to choose coordinate frames that describe all possible configurations and motions for the system. In the simple single body 2D problems, you have 3 degrees of freedom (3 DOF) corresponding to two translations of the COM and one rotation about the COM. In the 3D case, you have 6DOFs.
For example, you have a general body with width $w$ and height $h$, mass $m$ and mass moment of inertia about the center of mass $I$.
A single force is applied at the corner of the body, decomposed along two directions $F_H$ and $F_V$ as shown below

The position of the center of mass is described by the coordinates $(x,y)$ and the orientation of the body by the angle $\theta$.
The equations of motion of the body in world-aligned directions is
$$\begin{aligned}
 m \ddot{x} & = F_H \cos \theta - F_V \sin \theta \\
 m \ddot{y} & = F_H \sin \theta + F_V \cos \theta \\
 I \ddot{\theta} & = \frac{w}{2} F_V - \frac{h}{2} F_H
\end{aligned}$$
Or you can choose the body-aligned directions for
$$\begin{aligned}
 m \ddot{x} \cos \theta + m \ddot{y} \sin \theta & = F_H \\
 -m \ddot{x} \sin \theta + m \ddot{y} \cos \theta & = F_V  \\
 I \ddot{\theta} & = \frac{w}{2} F_V - \frac{h}{2} F_H
\end{aligned}$$
So you can choose what works for you.
I cheated a bit above, because in the world-aligned directions the total torque about the center of mass is found from $\Delta x F_y - \Delta y F_x$, or
$$ \small \left(\frac{w}{2}\cos\theta-\frac{h}{2}\sin\theta\right)\left(F_{H}\sin\theta+F_{V}\cos\theta\right)-\left(\frac{w}{2}\sin\theta+\frac{h}{2}\cos\theta\right)\left(F_{H}\cos\theta-F_{V}\sin\theta\right)=\frac{w}{2}F_{V}-\frac{h}{2}F_{H}$$
But if this was a 2D problem of a robotic arm, a different set of 3 DOF would work better, one for each joint angle in the 3 linkages of the robot (shoulder, elbow, wrist).
In summary, the choice of kinematic representation, how many, and which DOF describe the problem drive the form of the equations of motion. It is also the most challenging part of doing dynamics. There is no one solution for all problems. It is where the art of mechanics comes in. Out of experience, luck, and intuition, you can usually find at least one system that works. Especially in 3D, there are many different conventions for kinematics each with its own pros/cons. This is a deep subject, and part of ongoing research ever since the days of Hamilton and Euler.
