2. Introducción. / 2. Introduction.
El objetivo era mover las ruedas de Piero a la velocidad de un número real constante dado por nosotros.
Tuvimos tres posibilidades de movimiento:
• Avanzar - proporcionamos constante positiva
• Retrocediendo - proporcionamos constante negativa
• Parada: situación especial cuando proporcionamos 0 (apagando los motores)
ENGLISH
The goal was to move Piero’s wheels at the speed of a constant real number given by us.
We had three possibilities of movement:
- Moving forward – we provide positive constant
- Moving backward – we provide negative constant
- Stopping – special situation when we provide 0 (turning off the engines)
2.1 Bloques Simulink. / 2.1 Simulink Blocks.
1. El primer bloque en el bloque Constante que proporciona un vector de velocidad para cada rueda. Está conectado al subsistema "Motores" que incluye el resto del programa.
Subsystem “Motors”
2. En esta sección usamos:
- In – el bloque que envía la variable al subsistema desde el exterior (funciona como un puerto de entrada para este subsistema)..
- Mux - divide señales vectoriales en escalares - velocidad para cada rueda.
- Gain - multiplica la entrada por un valor constante - en este caso, es -1.
3. Arriba podemos ver todo el subprograma. Contiene también bloques tales como:
- Saturación – utilizamos este bloque para el valor de entrada de límite de 0 a 255 (valor máximo para el bloque PWM)
- Compare con cero – este bloque compara el valor de entrada con cero. En este ejemplo, si la entrada no es cero, devuelve TRUE (1).
- Salida digital Arduino – establece el valor lógico de un pin de salida digital especificado.
- Arduino PWM – PWM es un atajo Pulse Width Modulation: al usar este bloque podemos regular la velocidad. PWM funciona como un interruptor para el motor. Cuanto más tiempo se enciende el motor, más rápido gira, pero al mismo tiempo: si prolongamos el tiempo de desactivación del motor, este gira más lento. El pulso es el tiempo activo del motor y al regular el ancho que regulamos la velocidad.
Este bloque en Simulink genera una forma de onda cuadrada en el pin de salida analógica especificado. La entrada de bloque controla el ciclo de trabajo de la forma de onda cuadrada. Un valor de entrada de 0 produce un ciclo de trabajo del 0 por ciento y un valor de entrada de 255 produce un ciclo de trabajo del 100 por ciento. La frecuencia de la forma de onda es constante a aproximadamente 490 Hz.
1. The first block is the Constant block which provides a vector – velocity for each wheel. It is connected to the subsystem “Motors” which includes the rest of the program.
Subsystem “Motors”
2. In this section we used :
- In – the block sending the variable to the subsystem from the outside of it (works as an input port for this subsystem).
- Mux – splits vector signals into scalars – velocity for each wheel.
- Gain - multiplies the input by a constant value – in this case, it is -1.
3. Above we can see the whole subprogram. It contains also such a blocks as:
- Saturation – we used this block for limit input value for 0 to 255 (maximum value for PWM block)
- Compare to Zero – this block compares the input value to zero. In this example, if the input is not a zero it returns TRUE (1).
- Arduino Digital Output – sets the logical value of a specified digital output pin.
- Arduino PWM – PWM it is a shortcut of Pulse Width Modulation – by using this block we can regulate the velocity. PWM works as a switch for the engine. The longer engine is turned on the faster it spins – but at the same time: if we prolong the time of deactivation of the engine then it spins slower. The Pulse is the active time of the motor and by regulating the Width we regulating the velocity.
This block in Simulink generates square waveform on the specified analog output pin. The block input controls the duty cycle of the square waveform. An input value of 0 produces a 0 percent duty cycle, and an input value of 255 produces a 100 percent duty cycle. The frequency of the waveform is constant at approximately 490 Hz.
2.2.Resumen / 2.2.Summary
Logramos el objetivo y movemos a Piero por constante. Lo principal que aprendí fue cómo funciona PWM y el bloque de Saturación. También fue un reto encontrar los pines correctos y familiarizarme con los bloques de Simulink, porque no conocía muchos de ellos.
ENGLISH
We achieve the goal and move Piero by given constant. The main thing I have learned was how PWM and Saturation block works. Also it was challenging to find correct pins and get acquainted to Simulink blocks, because I didn’t know lots of them.