Changes between Initial Version and Version 1 of SoftwareCAN


Ignore:
Timestamp:
Jan 23, 2015, 8:15:58 AM (10 years ago)
Author:
Timothy Lin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SoftwareCAN

    v1 v1  
     1= Configuring and Using the CAN Interface for Software
     2CAN is a connection interface like PWM is as well. A ''controller area network'' is a series of nodes daisy-chained together to a single signal port. Instead of referencing a port number, as is done with PWM or digital input, CAN objects are referenced by each device's unique ID number, which needs to be initially set. This somewhat complicates things when switching components and robots, as the numbers would change drastically.
     3
     4== Maintenance
     5For a tutorial with more pictures and lengthier discussion, see [http://wpilib.screenstepslive.com/s/4485/m/24166/l/216217-updating-and-configuring-pneumatics-control-module-and-power-distribution-panel screen steps live].
     6=== Setting Device IDs
     7For best performance, start allocating device IDs with 1. The ID 0 is reserved for new devices which have not been assigned a number yet.
     8
     9Talon SRXs have a maximum ID value of 62, but it is generally not recommended to use more than 16.
     10
     11To set a device ID:
     121. Open a web browser and go to one of the addresses below:
     13{{{
     14roboRIO-2537.local
     15}}}
     16  OR
     17{{{
     18172.22.11.2
     19}}}
     202. On the {{{Home}}} page, select a device on the CAN Network list.
     213. In the device options, change the value of the field {{{Device ID}}} to the desired ID, preferably one that is not currently in use and is in accordance with the I/O sheet.
     224. Press {{{Save}}} in the top menu bar.
     23
     24=== Updating Firmware
     25Whenever FIRST or NI rolls out a new version of firmware for the Talon SRX, PCM, or PDP, the new software will need to be flashed onto the device.
     261. Open the web browser and go to one of the addresses below:
     27{{{
     28roboRIO-2537.local
     29}}}
     30  OR
     31{{{
     32172.22.11.2
     33}}}
     342. On the {{{Home}}} page, select a device on the CAN Network list.
     353. In the device options, select {{{Update Firmware}}} in the lower right corner.
     364. Select the latest version of firmware from the dialog that pops up. The .crf files should be located at
     37{{{
     38C:\Users\Public\Documents\FRC
     39}}}
     405. Install and flash the device. This should only take ~10 seconds.
     41
     42=== Running Diagnostics
     43The CAN self tests can be used to clear sticky faults, view ports and allocations, and other miscellaneous information.
     441. Open the web browser and go to one of the addresses below:
     45{{{
     46roboRIO-2537.local
     47}}}
     48  OR
     49{{{
     50172.22.11.2
     51}}}
     522. On the {{{Home}}} page, select a device on the CAN Network list.
     533. In the device options, select {{{Self Test}}} in the top menu bar.
     54
     55== Writing Code
     56In code, a simple access of the [http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1CANTalon.html CANTalon] class:
     57{{{
     58...
     59CANTalon egTalon = new CANTalon(1);
     60egTalon.enableBrakeMode(true);
     61
     62egTalon.set(.75);
     63
     64egTalon.stopMotor();
     65
     66// special methods & functionalities
     67egTalon.getEncPosition();
     68egTalon.getEncVelocity();
     69
     70egTalon.isFwdLimitSwitchClosed();
     71egTalon.isRevLimitSwitchClosed();
     72
     73
     74// diagnostics tools
     75egTalon.getDeviceID();
     76
     77egTalon.getOutputCurrent();
     78egTalon.getOutputVoltage();
     79egTalon.getTemp();
     80
     81/* There are many more methods in this class. See javadocs. */
     82
     83...
     84}}}
     85
     86For the complete documentation, always refer back to the [http://first.wpi.edu/FRC/roborio/release/docs/java/classedu_1_1wpi_1_1first_1_1wpilibj_1_1CANTalon.html javadocs].