Changes between Version 4 and Version 5 of ControlSystems/SoftwareTeam/Training/GettingStarted/Autonomous
- Timestamp:
- Nov 3, 2019, 8:42:47 PM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/Training/GettingStarted/Autonomous
v4 v5 23 23 24 24 * In robotInit() instantiate the Encoder and Motor objects 25 For PWM Motor Controller robots (Macadamia):25 * For PWM Motor Controller robots (Macadamia): 26 26 {{{ 27 27 // Quadrature encoder has A and B channels connected to DIO0,1, DIO2,3 … … 36 36 rightMotor = new Talon(1); 37 37 }}} 38 39 For CAN Motor Controller robots (Hazelnut): 38 * For CAN Motor Controller robots (Hazelnut): 40 39 {{{ 41 40 // CAN motor controllers connected to CAN bus (addrs 3,4) … … 51 50 52 51 * In robotPeriodic() display the encoder values 53 54 52 * For PWM controller robots (Macadamia): 55 53 {{{ … … 57 55 SmartDashboard.putNumber("Right", rightEncoder.getDistance()); 58 56 }}} 59 60 57 * For CAN motor controllers (Hazelnut) note the use of the [https://www.ctr-electronics.com/downloads/api/java/html/classcom_1_1ctre_1_1phoenix_1_1motorcontrol_1_1can_1_1_base_motor_controller.html#afb934a11682e710df123eec35aba1ba9 getSelectedFeedbackSensor()] method of the motor controller object which returns raw encoder counts. 61 58 Add the following function to the Robot class: … … 63 60 double raw2inches(int raw_count, int counts_per_rotation, double wheel_diameter) { 64 61 return (raw_count / counts_per_rotation) * (3.141492 * wheel_diameter); 65 {{{ 62 } 63 }}} 66 64 Add the following to the robotPeriodic() method: 67 65 // Encoders connected to CAN controller return raw counts