##### Sections
> Blog > 2012 > 05 > Improved results on the bicycle identification

# Improved results on the bicycle identification

Filed Under:

I've made some progress on viewing the results of my bicycle model identification. This is a summary of the current state.

I'm about to start writing up the results I've obtained on identifying a linear bicycle model. As I've explored the data, my confidence growing in it but there are still some issues. This is the current state of affairs.

I processed all of the raw data as I've mostly described in my draft dissertation chapter. I filtered all of the signals for each run with a 15 hz low pass filter. The total number of runs from three riders that were suitable for system identification numbered 368. These runs encompassed varying duration lengths, on the treadmill and the gym floor. The maneuvers included balancing and line tracking both with and without lateral perturbations. The ideal continuous system that I'm attempting to identify for each run takes this form:

$$\dot{x} = \begin{bmatrix} \dot{\phi} \\ \dot{\delta} \\ \ddot{\phi} \\ \ddot{\delta} \end{bmatrix} = \mathbf{A}x + \mathbf{B}u = \begin{bmatrix} 0 & 0 & a_{\dot{\phi}\phi} & 0\\ 0 & 0 & 0 & a_{\dot{\delta}\delta}\\ a_{\ddot{\phi}\phi} & a_{\ddot{\phi}\delta} & a_{\ddot{\phi}\dot{\phi}} & a_{\ddot{\phi}\dot{\delta}}\\ a_{\ddot{\delta}\phi} & a_{\ddot{\delta}\delta} & a_{\ddot{\delta}\dot{\phi}} & a_{\ddot{\delta}\dot{\delta}} \end{bmatrix} \begin{bmatrix} \phi \\ \delta \\ \dot{\phi} \\ \dot{\delta} \end{bmatrix} + \begin{bmatrix} 0 & 0 \\ 0 & 0\\ b_{\ddot{\phi}T_\delta} & b_{\ddot{\phi}F_{c_l}}\\ b_{\ddot{\delta}T_\delta} & b_{\ddot{\delta}F_{c_l}} \end{bmatrix} \begin{bmatrix} T_\delta\\ F_{c_l} \end{bmatrix}$$ $$y(t)= \begin{bmatrix} \phi \\ \delta \\ \dot{\phi} \\ \ddot{\delta} \end{bmatrix} = \mathbf{C}x = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \phi \\ \delta \\ \dot{\phi} \\ \ddot{\delta} \end{bmatrix}$$

During the identification, the lateral perturbation force $$F_{c_l}$$ is set to zero for all the runs with no perturbations. The goal of the identification is to find the non-zero entries of the $$\mathbf{A}$$ and $$\mathbf{B}$$ matrices. I've been trying out several solutions to the system identification and have had varying results:

• I'm able to get the best fits by assuming that their is no process noise. This degrades the estimation of the entries because they are now chosen such that they fit the noise component in the model.
• I've tried combinations of identifying the initial state, the Kalman gain for the process noise, fixing the kinematical equations to 1, weighting and trying different options with the pem function in Matlab from Focus to SearchMethod. I generally get worse fits the more parameters I introduce . I don't believe that the algorithm is actually finding the global mimina for each run due to the fact that I get better fits with the minimum set of free parameters.
• I'm not sure why this problem doesn't have an analytical solution as it is simple least squares problem. I'm going to write it out myself to see if I can get to the bottom of it.

There are some issues that I haven't completely worked out with the system identification for each run, but I still get reasonably "good" results when looking at the results holistically with respect to all of the runs.

## Equations of Motion Coefficient Estimation

As I've shown in earlier blog posts, some coefficients are tightly clustered and there is some spread in others with the roll Whipple roll acceleration equation better describing the roll equation than the steer equation.

This plot shows the data for the estimate of the equation of motion coefficients (bottom two rows and neglecting the lateral force coefficients) for 251 runs. The process noise and initial state were estimated and the kinematical differential equations had one free parameter. These runs had a mean fit percent greater than zero. The lines represent the coefficients as predicted by the linear Whipple model for these riders and bicycle.

I imported this data into R to try out some basic regression fits on the coefficients. I started with the the assumption that the coefficients changed with respect to speed in the same fashion as the Whipple model (either constant, linear or quadratic). I then fit a basic regression model and a basic mixed effects model with the repeated experiments with respect to speed as groups so that the fits wouldn't be as biased to the speeds at which I had more data.

This plot shows the regression results for the basic regression (black line) and mixed effects model (red line) for the runs with a 50% or greater mean fit percentage (i.e. the higher quality fits).

The fits for the two models are similar for each coefficient. The $$a_{\ddot{\phi}\dot{\delta}}$$ and the $$a_{\ddot{\delta}\dot{\phi}}$$ have slopes in the opposite direction as compared to the Whipple model in the previous plot (I'm working to combine these plots for clarity but using Python, Matlab, and R simultaneously in my software is a little troublesome...), but other that that the fits seem believable. I've yet to check through the numerical statistics such as T tests, P values and model comparison. I feel like the spread in $$a_{\ddot{\phi}\phi}$$ seems to be large for every speed and I'm not sure how well that is being predicted.

## Bode Plots

We can also look at the data from the Bode plot point of view and this turns out to show greater agreement between the first principles model and the empirical model.

This shows the steer torque to roll angle (left) and steer torque to steer angle (right) transfer functions. The red line is the linear Whipple model and the blue line is the mean of the identified models with the blue line bounding the standard deviation.

The Bode plot shows that the magnitude and phase are qualitatively similar with some offset in each. We are primarily interested in the decade bounded by 1 and 10 rad/s for our 4th order model. I would suspect that the magnitude of the Whipple model would be larger than the magnitude of the empirical model because I know that the steer torque we measured is more than the what the Whipple model predicts for a given steer and roll trajectory. This gain offset is even greater at 5 m/s:

The empirically derived model is the blue line with bounding blue dotted lines showing the standard deviation. The red line represents the Whipple model.

I'm having trouble getting the phase plots to work every time due to the fact that the phases for multiple models don't always match. They can be multiples of 360 degrees off from each other. Getting this phase matching programed correctly has been a headache for some reason. I'll figure it out eventually I guess.

## Root Loci

The eigenvalues of the identified A matrix can be computed for each run and compared to the Whipple model.

The real and imaginary parts of the eigenvalues for each run as a function of speed. The solid lines are the Whipple model predictions. This is from data in which the initial state, and noise were identified.

There is a great deal of spread, but the blue dots give the frequency of the oscillatory eigenvalues. At 2m/s the Whipple model seems to match. The mean frequency is a bit higher at higher speeds, but the trend is there. The black dots are real parts of the eigenvalues. The unstable dots are closer to the real axis than the Whipple model but decrease and there is some indication of predicting the weave critical speed. There is a lot of spread in the real eigenvalues around the capsize mode but is increasing with speed.

The data in which the noise was not estimated actually looks a little clearer (but not necessarily correct).

The blue dots give the oscillatory mode frequency. The red dots are the real parts of the oscillatory modes. The dark dots are the purely real eigenvalues. I've traced some lines over these to try to visualize the modes that may be predicted.

This view shows more agreement with the Whipple model. The weave critical speed is lower, there is spread in the capsize but it is there, and the imaginary part of the modes are well predicted. I'm going to work on these plots to improve their clarity. I've hand drawn lines of what I think the fit may be for the weave and capsize modes.

Now we can also make an eigenvalue plot of the empirically derived model which was found form regressing the coefficients and using the mixed effects model.

This shows the root loci of the empirically derived model from regressing the A and B coefficient data.
This is the root loci of the empirical model derived from the mixed effects regression.

I'm not sure what to make of these two models yet. They both give two oscillatory modes for much of the speed range that have very different frequencies and I'm not sure how well they would fit the data which I showed on the previous plots. I'm going to try to have all these plots together, but I have to figure out RPy a little so I can merge the data into the BicycleID program.

## Conclusions

• There is a great deal of spread in the data, but trends are there and connection to the first principles models.
• The system id is not as repeatable as I'd hoped. I think some better preparation for the data is needed along with figuring out how to proper fit the process noise model.
• The Bode plot view is very nice and the standard deviation is low. It seems that in general models with varying parameters can give matching frequency response. This may implies that there may not be a unique set of parameters. Putting bounds on the search may force them to be more where I want them, but I'm not sure if that would be a good or bad idea.
• The spread in the root loci is larger for the models in which noise was accounted for, but smaller when not. The latter shows some agreement with the Whipple model.
• The empirically derived model based on fitting the coefficient curves is different than the Whipple model. I'm going to try to feed forward simulate it and see if it actually predicts the outputs reasonably.
• Lastly, I'm going to work with the analytical linear Whipple model equations to try to determine which parameters are most likely incorrect and where there is room for some new parameters.