# Optimization of Redundant Degrees of Freedom in Robotic Flat-End Milling Based on Dynamic Response
## 2 Redundant Degrees of Freedom Optimization in Robotic Milling
### Solution of Redundant Degree of Freedom Optimization Model  
#### 2.3.1 Evaluation of Posture-Dependent Frequency Response Function  
Typically, the frequency response function can be directly obtained through experimental modal testing methods [35; 36]. However, when dealing with industrial robots, the dynamic characteristics can vary significantly across different postures. Conducting modal tests on all the postures within the entire workspace becomes challenging and time-consuming. Hence, it is necessary to develop an appropriate model to predict the frequency response function of the robot milling processing system at an arbitrary posture.  
In this article, the inverse distance weighted method [37] is utilized to obtain the frequency response function of the robot tool tip at specific postures. This method combines the weight values, determined by the Euclidean distance of joint angles across different postures, with their corresponding frequency response values. Essentially, the frequency response data obtained from the modal experiments for various postures are employed to predict the frequency response value for an arbitrary posture within the Cartesian workspace. Based on the modal tests at \(n_{s}\) postures within the workspace, the frequency response function at the \(e\)-th posture is determined by the following equation:  
\[H_{e}(\omega)=\sum_{s=1}^{n_{s}}\alpha_{s}H_{s}(\omega) \tag{4}\]  
where \(H_{e}(\omega)\) is the frequency response function at the \(e\)-th posture for prediction, \(H_{s}(\omega)\) represents the frequency response function at the \(s\)-th test posture, and \(n_{s}\) corresponds to the number of the weighted frequency response function. \(\alpha_{s}\) represents the weight coefficients and is defined as follows:  
\[\alpha_{s}=\frac{1/d_{s}}{\sum_{s-1}^{n_{s}}1/d_{s}} \tag{5}\]  
with  
\[d_{s}=\sqrt{\left(\theta_{e1}-\theta_{s1}\right)^{2}+\left(\theta_{\ell 2}-\theta_{s2} \right)^{2}+\left(\theta_{e3}-\theta_{s3}\right)^{2}+\left(\theta_{e4}- \theta_{s4}\right)^{2}+\left(\theta_{e5}-\theta_{s5}\right)^{2}+\left(\theta_ {e6}-\theta_{s6}\right)^{2}} \tag{6}\]  
where \(d_{s}\) denotes the Euclidean distance in the joint space, which is utilized to estimate the joint angular distance between the predicted posture \(\left[\theta_{e1},\theta_{e2},\theta_{e3},\theta_{e4},\theta_{e5},\theta_{e6} \right]^{T}\) and the test posture \(\left[\theta_{s1},\theta_{s2},\theta_{s3},\theta_{s4},\theta_{e5},\theta_{s6 }\right]^{T}\).  
Based on the predicted frequency response function \(H_{gh}\) at the \(e\)-th posture, the relationship between the frequency response function matrix and the modal parameters can be expressed as follows:  
\[H_{gh}(\mathrm{i}\omega)=\sum_{r=1}^{N_{m}}\frac{A_{ghr}}{(\mathrm{i}\omega-s _{r})}+\frac{A_{ghr}^{*}}{(\mathrm{i}\omega-s_{r}^{*})} \tag{7}\]  
where \(\omega\) is the frequency, \(N_{m}\) is the number of modes, \(\mathrm{i}\) is the imaginary unit, \(A_{ghr}\) are the residues at nodes \(g\) and \(h\) of mode \(r\), \(s_{r}\) is the pole of mode \(r\), and \({}^{*}\) denotes complex conjugation.  
The poles \(s_{r},s_{r}^{*}\) can be expressed as  
\[s_{r},s_{r}^{*}=-\zeta_{r}\omega_{r}\pm\mathrm{i}\omega_{r}\sqrt{1-\zeta_{r}^ {2}} \tag{8}\]  
where \(\zeta_{r}\) and \(\omega_{r}\) are the damping ratio and eigenfrequency of mode \(r\), respectively.  
The residues \(A_{gltr}\) are composed of a modal scaling constant \(Q_{r}\), and the mode shape coefficients \(\psi_{gr},\psi_{hr}\) in the nodes \(g\) and \(h\), as follows:  
\[A_{gltr}=Q_{r}\psi_{gr}\psi_{hr}=\frac{1}{\mathrm{i}2m_{r}\sqrt{1-\zeta_{r}^{2}} }\psi_{gr}\psi_{hr} \tag{9}\]  
where \(m_{r}\) is the modal mass of mode \(r\). \(\psi_{gr},\psi_{hr}\) are the mode shape coefficients in nodes \(g\) and \(h\) for mode \(r\), respectively.  
In this article, the modal mass is calculated by scaling the mode shapes to unity modal A. The modalfit function in MATLAB is employed to obtain the modal mass, modal damping, and modal stiffness.