Pages

Showing posts with label Matlab. Show all posts
Showing posts with label Matlab. Show all posts

Monday, 28 October 2013

CMAC-PID in a AUV



The first step in the implementation of a CMAC-PID was the modeling of the vehicle in Simulink. Dr. Cheng Chin (Chin et al. 2006)create a symbol library for modelling of ROVs. The library provided a predefined models that can be change by a simple script in Matlab.
Figure 62  6 DOF AUV unperturbed system
As second step in the implementation of the CMAC-PID is to implement a normal PID controller. The PID component of the system was implemented in Matlab. The acceleration wanted is calculated with a script that divide the input velocity by 8 and if the velocity wanted is equal to the platform speed the acceleration is equal to zero .A value limiter was placed at the output of the system to avoid saturation of the actuators. The tuning values for the PID components were estimated giving as result:
Kp=[16 14 24 34 34 14];
Kpi=[0.01;0;0;0.01;0.01;0.001];
Kdl=[0.002 0 0 0.001 0 0];
Kd=[1.5 0.9 1.5 7 6.2 0.1];

Figure 63 PID Implementation
The implementation of the CMAC component was by the constant call of a script at a sample time of 0.01 seconds. A CMAC was implemented by each one of the DOF’s .In the first 100 cycles is calculated the maximum and minimum data points. As second step the neural networks is started. For each cycle the weight values are adjusted. The adjustments values for the CMAC are m=5,  and  .Appendix 3 c). Figure 63 show the respond to a step input in all DoF. The respond of the PID is calibrated to the fastest answer with a minor overshoot. In rotation movement and vertical motion, the system show low overshooting and fast stabilization. In lateral motions it is notice a overshooting. However the overshooting can be solved reduce the acceleration rating of the robot. Figure 65 provide the different between CMAC-PID and a normal PID in the principal signal with overshooting. The result show a minor change on the signal and a reduction on the overshooting. If the step signal is change for a sinusoidal signal the CMAC-PID show a higher importance in the maintenance of the resonance frequency of the system over the time.
Figure 64 PID position respond to a Step Input [10,5,5,0.7,0.7,0.7]
Figure 65 CMAC-PID Implementation
Figure 66 PID(RED)vs. CMAC-PID (Brown)

Friday, 26 July 2013

Translator Between Torque controller and thrusters

As the AUV have four thrusters that can rotate in any direction its generates a vector U of possible Torque direction where T1,T2,T3 is the component x,y,z of  thruster number 1.However the PD tracking controller generates a force vector Tb of the way  where X,Y,Z are the forces and K,M,N are the moments over the gravitational center in the AUV.



However L can not be inverse and to solve the system it has to be applied and advanced algorithm to solve the system with a seed data .In the case of Matlab this can be made with fsolve(@myfun,x0) where x0 is the seed data .In this case seed data is a vector where each data is X/4,Y/4,Z/4,K/4,M/4 and N/4







Work in progress.......

Monday, 21 January 2013

Emboss of an image with inventor

Usually to add an binary image as a logo to inventor is a process of converting the image to eps and then tranfer that file to autocad and the to inventor. But that process can generate mistakes in the quality of the tranfer.To solve that problem I wrote a matlab code that generate a excel file with the boundary coordinates of the image.with the use of the function to export point  of Inventor,the points can be transfer to a sketch to be used in the emboss function.At the moment to export in the option of inventor it can be choose to create automatically lines or b-spline lines between the points.
InventorSimple.zip (2.0 MB)https://mega.co.nz/#!tENgmZaR!ZpQpSW4_3yr0ATdRD6mItWQDvJdO5sOA-xk-J0NayQA

Saturday, 15 September 2012

Rice Quality Control with Matlab


Software Matlab

Toolboxes: Image toolbox and computer vision toolbox

Aims and Description

Develop a simple application to identified specific visual properties like

·    Size measurement
·    Color Measurement

In rice grains with a webcam and Matlab image processing toolbox.

Introduction

Rice is one of the principal sources of food and it is the basic grain for a big part of the world population. In Asia is the principal component of protein .In some part of Asia rice can compose the 80% of a basic food. Rice on its position as a principal element in the global diet is more that elementary that has to be controlled in basic quality standards. Rice can be qualified in a variety of properties such cooking texture, color, size, shape and the number of broken rice kernels. (Verma 2010)
Japan Food agency evaluates the quality of brown rice when is shipped. The characteristic as sound whole kernel, immature kernel and underdeveloped kernel are evaluated. this evaluation is made by inspector of the agency.(Kawamura et al. 2003)
Brown rice is processed and their different components are separated. Brown layers and germen are retired letting behind the kernel. Broken kernels in theory are separated by mechanical action. The percentage of broke kernels establish the principal parameter in the price of the rice. Rice kernels are consider broken when their size is three-fourths of a complete kernel (Agriculture 2009)



The Beta version of the code can be consult in 
http://www.mathworks.com/matlabcentral/fileexchange/38391
Matlab GUI image
 Using Matlab sample video