Changes between Initial Version and Version 1 of Position Mode


Ignore:
Timestamp:
Feb 13, 2016, 4:14:22 PM (9 years ago)
Author:
alex
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Position Mode

    v1 v1  
     1== Position Mode ==
     2
     3Things needed to initialize position mode.
     4
     5You need to set these variables:
     6{{{
     7P = 100.0,
     8I = 0.0,
     9D = 0.0;
     10}}}
     11
     12Change as necessary. These are *not* recommended values.
     13
     14Read up on PID loops as necessary.
     15
     16In the constructor of your subsystem, you need:
     17
     18{{{armMotor.setFeedbackDevice(FeedbackDevice.EncoderType);}}}
     19
     20{{{armMotor.configEncoderCodesPerRev(X);}}}
     21
     22Note that on QuadEncoders this is the nominal value, not the actual value
     23
     24{{{armMotor.setEncPosition(0);}}}
     25
     26This will save you a lot of future headache
     27
     28You need these methods:
     29
     30{{{
     31public void enable() {
     32        armMotor.enableControl();
     33}
     34}}}
     35
     36{{{
     37public void positionMode() {
     38        armMotor.changeControlMode(TalonControlMode.Position);
     39        armMotor.setPID(P, I, D);
     40}
     41}}}
     42
     43Finally, here's some example code.
     44
     45To initialize it, you need to run this:
     46
     47{{{
     48Robot.armSys.positionMode();
     49Robot.armSys.enable();
     50}}}
     51
     52Finally, once you've initialized the code:
     53
     54{{{
     55Robot.armSys.setArmTalon(1F);
     56}}}
     57
     58This will make it move one rotation.