Laboratori d'Automatització i Robòtica, Universitat de Lleida
Inicio   Equipo    Publicaciones    TFG/TFM/Tesis    Proyectos    SLAMICP-library    Contacto
MatLab shared functions
Color Picker:    HEX:    RGB: : :
15/04/2024 - getfigure65.m (version 6.5)
Sharing our Matlab function getfigure65.m (version 6.5) that simplifies the copy of axis, lines, and images from another figure.

The first call to this function adds a new Getfigure menu (in the current figure) and the second call deletes the Getfigure menu:

>> getfigure65
21/12/2023 - New version (5.1) of the SLAMICP-Library


This new version 5.1 of the SLAMICP-Library optimizes the "point_to_plane" ICP matching by avoiding to compute the normals of the reference map in each iteration.

There is also a specific function to compute the normals (red arrows) of a point cloud (blue points).
17/10/2023 - Copy a Matlab matrix in Word
Sharing our Matlab functions: matrix2WordTable.m and matrix2WordEq.m

>> matrix2WordTable(M);

This function copies the matlab matrix M into a Word document (through the clipboard):
1) Create an space for the table in word. 2) Call this function. 3) Click over Word. 4) Wait until the whole matrix has been copied (do not change the focus from Word).
Function also avialable at Fileexchange.

>> matrix2WordEq(M);

This function copies the matlab matrix M into a Word equation (through the clipboard):
1) Create an empty equation in word. 2) Call this function. 3) Click over the Word equation. 4) Wait until the whole matrix has been copied (do not change the focus from Word).
Function also avialable at Fileexchange.
04/10/2023 - getfigure.m (version 6.0)
Sharing our Matlab function getfigure.m (version 6.0) to copy axis, lines and images from another figure.

The first call to this function adds a new getfigure menu (in the current figure) and the second call deletes the getfigure menu:

>> getfigure

Also available at File Exchange as: getfigure

Old versions:
getfigure.m (version 5.9)
getfigure.m (version 5.6)
getfigure.m (version 5.5)
getfigure.m (version 5.1)
getfigure.m (version 4.1)
05/07/2023 - dijkstra.m (version 1.0)
Sharing our Matlab function dijkstra.m ( also available at FileExchange )

A single-function implementation of Dijkstra's algorithm for shorter path finding in a directed matrix-graph
Didactic reference at: Dijkstra's algorithm explained, https://youtu.be/bZkzH5x0SKU
% Matrix-Graph example G
% G(a,b)=z defines a directional link (with a weight z) from the node a to b
G = [0     1     0     0     0     0     0;
     0     0     1     0     0    10     0;
     2     0     0     1     0     0     0;
     0     0     2     0     1     0     0;
     0     0     0     2     0     1     0;
     0     0     0     0     2     0     1;
     0     0     0     0     0     2     0];
initialNode = 1;
finalNode   = 7; 
[best_route,cost,M] = dijkstra(G,initialNode,finalNode)
best_route =
     1     2     3     4     5     6     7
cost =
     6
% Interpretation of the columns of the Dijkstra matrix M
% Node number | best previous node | cumulated path lenght or cost | node visited
M =
     1     0     0     1
     2     1     1     1
     3     2     2     1
     4     3     3     1
     5     4     4     1
     6     5     5     1
     7     6     6     1
26/01/2023 - Featuring: LIBICP
LIBICP: C++ Library for Iterative Closest Point Matching

LIBICP (LIBrary for Iterative Closest Point fitting) is a cross-platform C++ library with MATLAB wrappers for fitting 2d or 3d point clouds with respect to each other.

By: Andreas Geiger and Philip Lenz and Raquel Urtasun
Blog: https://autonomousvision.github.io/
Paper: Are we ready for autonomous driving? The KITTI vision benchmark suite, 2012 IEEE Conf. on Computer Vision and Pattern Recognition
26/01/2023 - Featuring: Matlab based ICP implementations
simpleICP: matlab function Iterative Closest Point Matching (also available at FileExchange)
globalICP: A multi-scan ICP implementation for Matlab
11/11/2022 - Featuring: ReadSpeaker
Text-to-Speech demo with many languages and voices available
Ready to be embedded in many practical applications
09/04/2022 - Feturing: Ellipse Detection Using 1D Hough Transform
Available at Matlab Fileexchange: ellipseDetection(img, params), by Martin Simonovsky

Fits an ellipse by examining all possible major axes (all pairs of points) and getting the minor axis using Hough transform
Selected as File Exchange Pick of the Week
18/03/2022 - Cámara RGB-D Ceative BlasterX Senz3D: consumo de corriente conectada a un puerto USB 3.0
Cable USB conectado pero sin ninguna aplicación accediendo a la cámara: 80 mA
Con una conexión activa pero sin utilizar la cámara (sin pedirle imágenes): 45 mA
Utilizada (solo) como cámara RGB (como una webcam normal): 240 mA
Utilizada plenamente como cámara RGB-D: 450 mA
  • Utilizando (solo) el stream D: 360 mA
  • Utilizando (solo) el stream RGB: 240 mA
  • Utilizando (solo) el stream IR: 300 mA
  • Utilizando los streams D y el IR: 360 mA
  • Utilizando los streams RGB y el IR: 380 mA
  • Utilizando los streams RGB y el D: 450 mA

    En W10 se necesita el Intel® RealSense 2.0 (no funciona con la versión 1.0). La cámara no funciona en un USB 2.0.
  • 18/03/2022 - Cámara RGB-D Ceative 3D Senz: consumo de corriente conectada a un puerto USB 2.0
    Cable USB conectado pero sin ninguna aplicación accediendo a la cámara: 120 mA
    Con una conexión activa pero sin utilizar la cámara (sin pedirle imágenes): 120 mA
    Utilizada (solo) como cámara RGB (como una webcam normal): 140 mA
    Utilizada plenamente como cámara RGB-D: 400 mA
  • Utilizando (solo) el stream D: 400 mA
  • Utilizando (solo) el stream RGB: 140 mA
  • Utilizando los streams RGB y el D: 400 mA

    En W10 se necesita el Intel® Perceptual Computing™ 2013 (no funciona con la versión Intel® RealSense™ 2.0)
  • 15/12/2021 - WITmotion 16 channel servo driver
    WITMotion 16 channel servo driver control
    % Control de WIT motion servo controller 16 chanels mediante MatLab
    % Comunicación mediante USB-serial externo (con el interno no funciona)
    
    % Tramas de datos
    % | 0xFF          | 0x(XX)         | 0x(XX) | 0x(XX) | 0x(XX) |
    % |Byte           |Byte            | # de   | Data 2 | Data 1 |
    % |de             |de              | servo  |        |        |
    % |Confirmación   |acción          | [0-15] |        |        |
    % |(Siempre       |0x01 velocidad  |        |        |        |
    % | 0xFF)         |0x02 posición   |        |        |        |
    % |               |0x09 en grupo   |        |        |        |
    % |               |0x0b emergencia |        |        |        |
    
    % Conectar el puerto 'COMX' con MatLab para acceso serie (RS232)
    s = serial('COM3');  % Por defecto: 9.600bps, 8bits, sin paridad, 1 stop
    % Abrir la comunicación serie con el puerto
    fopen(s);
    
    % Parámetros de control
    % Número de serovo a controlar, de 0 a 15
    servo = 2;
    
    % Velocidad de giro en grados por segundo, de 9º/s a 180º/s
    velocidad = 90;
    % Debe convertirse en un valor entre 1 (9º/s) y 20 (180º/s)
    velocidad = round((velocidad*10)/90);
    
    % Posición en grados, de 0º a 180º
    posicion = 90;
    % Debe convertirse a un valor de control entre 500 y 2500
    % realmente se envía el ancho del pulso de control en microsegundos
    posicion = round(500+(111*(posicion/10)));
    
    % Los datos se deben enviar en dos bytes
    % Ejemplo: para enviar el valor 2498 que equivale a 0x09C2
    % se sebe enviar primero 0xC2 y luego 0x09 
    Data2 = posicion - 256*fix(posicion/256);
    Data1 = fix(posicion/256);
    
    % Enviar velocidad de movimiento
    fwrite(s,[hex2dec('ff') hex2dec('01') servo velocidad hex2dec('00')]);
    % Enviar la posición destino
    fwrite(s,[hex2dec('ff') hex2dec('02') servo Data2 Data1]);
    pause(2);
    
    % Finalizar la comunicación
    fclose(s); % Cerrar la comunicación serie (se puede volver a abrir)
    delete(s); % Desconectar definitivamente el puerto 'COMX' de MatLab
    
    24/08/2021 - Recordatorio: apagar el PC-W10 de forma temporizada
    Acceder a la consola de comandos mediante una de estas alternativas:
    En la consola de comandos teclear shutdown para ver todas las opciones que ofrece el programa de autoapagado de W10
    Otra aplicación muy interesante es copiar archivos de una carpeta a otra a la máxima velocidad posible y apagar automáticamente el ordenador al terminar
    Ver todos los comandos disponibles en el 'Símbolo del Sistema': Finalmente, también es posible arrancar un PC de forma remota mediante una aplicación WakeOnLAN
    04/05/2021 - Utilizar caracteres especiales (unicode) en Matlab
    >> disp( [ sprintf( '\x03B1' ) ' = ' num2str(90) 'º, ' sprintf( '\x03B2' ) ' = ' num2str(45) 'º, ' sprintf( '\x03C9' ) ' = ' num2str(-12.5) 'º' ] )
    α = 90º, β = 45º, ω = -12.5º

    >> disp([ char( 916 ) 't = 0, ' char(hex2dec( '0394' )) 't = 0' ] )
    Δt = 0, Δt = 0

    Unicodes UTF-8: Greek and Coptic
    07/11/2019 - Math Notepad
    Math Notepad una sorprendente calculadora online con capacidades gráficas muy interesantes. Permite realizar cálculos y definir variables y funciones muy fácilmente:

    Web online: http://mathnotepad.com/
    Y si se quiere tener el (simple pero fantástico) programa (del mismo autor) para Windows que inspiró esta implementación en web: http://www.speqmath.com/
    04/10/2019 - Solució matricial de sistemes d'equacions amb Matlab
    Exemple de sistema d'equacions:

    9·X1 + 3·X2 + 4·X3 = 7
    4·X1 + 3·X2 + 4·X3 = 8
    1·X1 + 1·X2 + 1·X3 = 3

    (Solució: X1 = -0.2, X2 = 4.0, X3 = -0.8)

    Sistema expressat en format matricial Matlab: A·X = B

    >> A = [9 3 4; 4 3 4; 1 1 1];
    >> B = [7 8 3]';
    Solució amb el mètode de reducció de Gauss (wikipedia, MathWorld):
    % funció creada per Cheuk i disponible a fileexchange

    >> X = gauss_elim(A,B)

    X = -0.2000 4.0000 -0.8000
    Solució mitjançant càlcul numèric directe
    Calculant la inversa de A:

    >> X = A\B

    X = -0.2000 4.0000 -0.8000
    Solució mitjançant càlcul numèric directe
    Calculant la pseudo-inversa de A:

    >> X = pinv(A)*B

    X = -0.2000 4.0000 -0.8000
    15/03/2011 - Calc 1.0
    calc.m es una simple calculadora creada en un unico script de Matlab.

    >> calc.m

    Ejemplos de uso:
    [AC] [1000] [+] [18] [%] [=] 1180
    [AC] [1000] [+] [18] [±] [%] [=] 820
    [AC] [1000] [-] [18] [%] [=] 820
    [AC] [100] [+] [10] [=] 110
    [AC] [100] [+] [10] [±] [=] 90
    [AC] [100] [+] [10] [C] [20] [=] 120
    [AC] [100] [+] [10] [=] 110 [=] 120 ([=]repeats the last operation)

    Also available at File Exchange as: https://es.mathworks.com/matlabcentral/fileexchange/30747-calc
    22/02/2011 - reverseplot 2.0
    Función para recuperar los datos de una gráfica en una imagen. Permite recuperar los datos de forma manual o automática.

    >> reverseplot20.m

    Also available at File Exchange as: http://www.mathworks.com/matlabcentral/fileexchange/4316-reverseplot
    30/12/2009 - pen.m for pen or mouse draw input template
    Función que permite una entrada por pen o mouse y que está configurada para llamar a la función process_data(x_pen,y_pen) al pasar por encima de las zonas rojas. La función es interna, ahora solo muestra el número de datos y está pensada para que se pueda insertar un codigo para procesar el dibujo o escritura. La funcion process_data(x_pen,y_pen) se encuentra al final de la función.

    >> pen.m

    Also available at File Exchange as: http://www.mathworks.com/matlabcentral/fileexchange/26225
    Inicio   Equipo    Publicaciones    TFG/TFM/Tesis    Proyectos    SLAMICP-library    Contacto

    © Laboratori de Robòtica, Universitat de Lleida