// ----- Follower ------// /** * Set the control mode and output value so that this motor controller will * follow another motor controller. Currently supports following Victor SPX * and Talon SRX. * * @param masterToFollow * Motor Controller object to follow. * @param followerType * Type of following control. Use AuxOutput1 to follow the master * device's auxiliary output 1. * Use PercentOutput for standard follower mode. */ public void Follow(IMotorController masterToFollow, FollowerType followerType) { int id32 = masterToFollow.GetBaseID(); int id24 = id32; id24 >>= 16; id24 = (short)id24; id24 <<= 8; id24 |= (id32 & 0xFF); Set(ControlMode.Follower, id24); switch (followerType) { case FollowerType.PercentOutput: Set(ControlMode.Follower, (double)id24); break; case FollowerType.AuxOutput1: /* follow the motor controller, but set the aux flag * to ensure we follow the processed output */ Set(ControlMode.Follower, (double)id24, DemandType.AuxPID, 0); break; default: NeutralOutput(); break; } }