# Nonlinear Dynamics and Machine Learning for Robotic Control Systems in IoT Applications
## 2 Materials and Methods
### Mathematical Foundation and Dynamic Modeling
Its purpose is to provide a general pose in 3D space, useful for external tasks and interactions, whereas a state vector that includes joint dynamics is more specialized for internal control and analysis within robotic systems and is given in Equation [5], which includes the joint angles, angular velocities, and accelerations. This would indeed be a more detailed and dynamic focused version of a state vector in robotics. \[Q=[X\ \ q]^{T}=[x\ \ y\ z\ \ \varphi\ \ \theta\ \ \psi\ \ q_{1}\ \ q_{2}\ \ q_{3}\ \ldots\ \ q_{n}]^{T} \tag{5}\]  
This vector typically encompasses not only the positions of the joints but also their velocities and accelerations over time, making it highly suitable for dynamic modeling and control purposes. The dynamic model, governed by nonlinear dynamic equations derived from the Euler-Lagrange formulation [40; 41], for a robotic system with \(n\) degrees of freedom (DOFs) is described as follows:  
\[H(q)\ddot{q}+h(q,\dot{q})+g(q)=\tau \tag{6}\]where  
\(H(q)\) is the inertia matrix, influenced by the robot's configuration;  
\(\ddot{q}\) represents the joint accelerations;  
\(h\big{(}q,\dot{q}\big{)}\) represents the Coriolis and centrifugal forces, dependent on both the position and velocities of the joints;  
\(g(q)\) is the gravitational force vector, depending solely on its configuration;  
\(u\) is the control input vector (torques or forces). The robot's velocity motion is governed by the following differential equations:  
\[\dot{q}= \begin{bmatrix}cos\theta&0\\ sin\theta&0\\ 0&1\end{bmatrix}\begin{bmatrix}v\\ \omega\end{bmatrix}  \tag{7}\]  
where q represents the joint positions, \(\theta\) represents the orientation, \(v\) represents the linear velocities, and \(\omega\) represents the angular velocities. The key engineered features include the Euler angles (derived from quaternion orientation data), total angular velocity (\(\omega_{t}\)), and total linear acceleration \((v_{t})\). \[\omega_{t}=\sqrt{\left(angular\_velocity\_X\right)^{2}+\left(angular\_velocity \_Y\right)^{2}+\left(angular\_velocity\_Z\right)^{2}} \tag{8}\]  
\[v_{t}=\sqrt{\left(linear\_accelerate\_X\right)^{2}+\left(linear\_accelerati \_Y\right)^{2}+\left(linear\_accelerati\_Z\right)^{2}} \tag{9}\]  
Analyzing the movement of the robot in the environment, the Jacobian matrix is used, \(J=\frac{\partial\chi}{\partial Q}\), which gives the relationship between the point of the robot located in the local coordinate system and the speed of the entire mechanism in relation to the global coordinate system:  
\[H(q)\ddot{q}+h\big{(}q,\dot{q}\big{)}+g(q)=\tau+J^{T}\left(q\right)F_{ext} \tag{10}\]  
\(J^{T}\left(q\right)\) is the transpose of the Jacobian matrix. This matrix relates the external forces and torques \(F_{ext}\) acting on the robot to the torques at the joints. The Jacobian J(q) transforms the joint velocity vectors into end-effector velocity vectors in the workspace, and its transpose \(J^{T}\left(q\right)\) maps the external forces applied to the end-effector back to the equivalent joint torques. \(F_{ext}\) represents the external forces. This vector represents the forces and torques from the environment acting on the robot. These could be due to interaction with objects, external loads, or any other environmental influence exerting force on the robot. In an IoT-integrated robotic system, the motion of the robot can be monitored through a connected device that communicates with the controller, publishing pose data in a structured format, such as JSON sensor data for \"current_pose\", which include information about the robot's position and orientation (the position of the robot's tool reference frame is described by the coordinates in Equation (1) and the orientation by Equation (5)). Once all of these data are organized, they are ready to be used to create a virtual \"flyer\" object. However, before using this object, it must first be created in the computer's memory. This is performed with the help of the k_flier constructor.