Paso 1: Caracterización de la conducción del robot

Nota

For detailed instructions on using the System Identification tool, see its dedicated documentation.

Nota

The drive identification process requires ample space for the robot to drive. Be sure to have at least a 10” stretch (ideally closer to 20”) in which the robot can drive during the identification routine.

Nota

The identification data for this tutorial has been generously provided by Team 5190, who generated it as part of a demonstration of this functionality at the 2019 North Carolina State University P2P Workshop.

Before accurately following a path with a robot, it is important to have an accurate model for how the robot moves in response to its control inputs. Determining such a model is a process called «system identification.» WPILib’s System Identification tool can accurately determine such a model.

Recopilación de los datos

We begin by gathering our drive identification data.

  1. Configure and Deploy your robot project.

  2. Run the identification Routine.

Análisis de los datos

Once the identification routine has been run and the data file has been saved, it is time to open it in the analysis pane.

Chequeo de Diagnósticos

Per the system identification guide, we first view the diagnostics to ensure that our data look reasonable:

SysId diagnostics panel.

As our data look reasonably linear, and the fit metrics are within acceptable parameters, we proceed to the next step.

Registro de ganancias de compensación

Nota

Las ganancias de compensación no se transfieren, en general, a través de los robots. No uses las ganancias de este tutorial para tu propio robot.

Ahora registramos las ganancias de compensación calculadas por la herramienta:

Highlights where to get the kS, kV, kA, and r-squared results from in the center of the window.

Como el diámetro de nuestra rueda se especificó en metros, nuestras ganancias de compensación están en las siguientes unidades:

  • kS: Volts

  • kV: Volts * Segundos / Metros

  • kV: Volts * Segundos^2 / Metros

Si ha especificado sus unidades correctamente, sus ganancias de compensación estarán probablemente dentro de un orden de magnitud de las reportadas aquí (existe una posible excepción para kA, que puede ser muy pequeña si su robot es liviano). Si no lo son, es posible que haya especificado uno de sus parámetros de conducción de forma incorrecta al generar su proyecto de robot. Una buena prueba para esto es calcular el valor «teórico» de kV, que es 12 voltios dividido por la velocidad libre teórica de su transmisión (que es, a su vez, la velocidad libre del motor multiplicada por la circunferencia de la rueda dividida por la reducción del engranaje). Este valor debe coincidir muy estrechamente con el kV medido por la herramienta - si no es así, es probable que hayas cometido un error en algún lugar.

Cálculo de las ganancias de la retroalimentación

Nota

Las ganancias de la retroalimentación no se transfieren, en general, a través de los robots. No uses las ganancias de este tutorial para tu propio robot.

We now calculate the feedback gains for the PID control that we will use to follow the path. Trajectory following with WPILib’s RAMSETE controller uses velocity closed-loop control, so we first select Velocity mode in the identification tool:

How to specify velocity mode in the "Loop Type" dropdown.

Como usaremos el controlador PID WPILib para nuestro bucle de velocidad, seleccionaremos además la opción «WPILib (2020-)`` del menú desplegable «preestablecidos». Esto es muy importante, ya que las ganancias de retroalimentación no estarán en las unidades correctas si no seleccionamos el preestablecido correcto:

Highlights choosing "WPILib (2020-)" from the "Gain Setting Preset" dropdown.

Finalmente, calculamos y registramos las ganancias de retroalimentación para nuestro bucle de control. Como es un controlador de velocidad, sólo se requiere una ganancia P:

Highlights the calculated kP and kD controller gains.

Assuming we have done everything correctly, our proportional gain will be in units of Volts * Seconds / Meters. Thus, our calculated gain means that, for each meter per second of velocity error, the controller will output an additional 3.38 volts.