# Robot Characterization ###### tags: `程式組教程` # Purpose 藉由數學公式計算出馬達的輸出量 > The process of determining a mathematical model for the behavior of a system through statistical analysis of its inputs and outputs. # Basic Math ![](https://i.imgur.com/gOFbXrC.png) $V$ 應輸出電壓 $d$ 上面一個點 -> 速度 $d$ 上面兩個點 -> 加速度 > 上面一個點是表示對時間的微分 $kS$ 需要克服地面摩擦力的最低電壓 > the voltage needed to overcome the motor’s static friction $kV$ 是在給定速度下需要多少電壓來保持 > how much voltage is needed to hold at a given constant velocity $kA$ 加速時所需電壓 > the voltage needed to induce a given acceleration in the motor shaft :::success 可憐的冠穎剛看完了八九成卻被改版 gank ::: # Configure A Project ## Analysis Type General mechanism -> non-drivetrain mechanisms (e.g. Simple Motor, Arm, Elevator) Drivetrain -> Drivetrain mechanisms Romi -> Romi robots ## Motor Controller Selection +- : add motor * **Motor port:** ``` Where you add the port number for a specific controller. ``` * **Inverted:** ``` Should be checked if the motorcontroller should be inverted. ``` * **Motor controller:** ``` The type of motor controller that will be used. ``` ## Encoder Selection **Encoder selection:** The types of encoder you can use will vary with the first motor controller type specified | Motor Controller Types | Encoder Types | | -------- | -------- | | General Types | **RoboRIO:** Corresponds to any encoders that are plugged into the roboRIO| | General Types | **CANcoder:** Corresponds to the CTRE CANCoder. | | TalonSRX | **Built-in:** Corresponds to any quadrature encoder plugged into the encoder port | | TalonSRX | **Tachometer:** Corresponds to the CTRE Tachometer plugged into the encoder port | | TalonFX | **Built-in:** Corresponds to the integrated encoder on the TalonFX motor | | SparkMAX | **Encoder Port:** Refers to an encoder plugged into the encoder port | | SparkMAX | **Encoder Port:** Data Port refers to an encoder plugged into the data port. | | Venom | Built-in refers to an encoder plugged into the Venom’s encoder port ## Encoder Setting the following settings that can be configured(although the settings that are visible will vary by the previously selected encoder type) * **Encoder Inverted:** Should be checked if a positive motor power doesn’t correspond to a positive increase in encoder values * **Sample Per Averages:** How many samples will be averaged per velocity measurement. A value greater than one can help reduce encoder noise and 5-10 is recommended for encoders with high CPR. Only mess with this setting if a previous run of SysId resulted in extremely noisy data. * **Reduce Encoding:** Should be checked if using high resolution encoders(e.g. CTRE Mag Encoders or REV Through Bore Encoder)that are plugged into the roboRIO. Do note, that if this is checked, you will have to update your team’s robot code to also reduce encoding. * **Time Measurement Window:** Yhe period of time in milliseconds that the velocity measurement will be taken across. This setting can reduce measurement lag at the cost of possibly introducing more noise. Only modify this if data lag is impeding accurate control and data collection. ## Encoder Parameter Counts Per Revolution: the encoder counts per revolution for your encoder which is generally specified on a datasheet. Common values include: | encoder | counts per revolution | | -------- | -------- | | CTRE Magnetic Encoder | 4096 | | Falcon 500 Integrated | 2048 | | REV Throughbore | 8192 | | NEO | 1 | ## Gearing The gearing between the encoder and output shaft ## Gyro Parameter(Drivetrain Only) * **Gyro:** ``` The type of supported gyro. ``` * **Gyro Parameter:** ``` Lets you configure additional settings needed to configure the previously specified gyro ``` ## Save loading and saving configuration ## Load Config load an existing config file ## Delploy # Dunning the Characterization Routine Mode:clinet Team/IP:7130(simulated robot program:localhost) ## Pply Success -> NT connected Unsuccess -> NT Disconnected(reboot the robot) ## Project Parameters Mechanism:controls what data is sampled and how gravity is expected to affect the analysis. Unit Type:the units you are using and the units that SysID will export the gains in. Unites per rotation ## Voltage Parameters Quasistatic Ramp Rate(摩擦力):controls how quickly the voltage will ramp up during the quasistatic tests. The goal here is to get the voltage ramped up enough that a trend emerges. If the amount of space you have to run the robot is small you might need to slightly increase this ramp rate. Dynamic Step Voltage(啟動電壓):he voltage that will be applied immediately on start to determine how your robot accelerates. If your robot is short on space you should slightly reduce the voltage. ## Running Test Quasistatic:In this test, the mechanism is gradually sped-up such that the voltage corresponding to acceleration is negligible (hence, “as if static”). Dynamic:In this test, a constant ‘step voltage’ is given to the mechanism, so that the behavior while accelerating can be determined. ## Track Width select Drivetrain(Aungular)test will provide angular Kv and Ka parameters will spin the robot ## Save after four tests are finished and click save as JSON file a timestamp will be appended the name of the file saved will be shown in the Program Log # Analyzing Data WPILib standarizes on SI units, so its recommended that the Units option is set to Meters. ## Loading Data File select JSON file ## Running Feedforward Analysis Override Units:change units # References Material [Robot Characterization](https://docs.wpilib.org/en/stable/docs/software/pathplanning/robot-characterization/index.html?highlight=Robot%20characterization)