001package com.ctre.phoenix.motion; 002 003/** 004 * Motion Profile Trajectory Point This is simply a data transfer object. 005 */ 006public class TrajectoryPoint { 007 008 /** The position to servo to (in sensor units).*/ 009 public double position = 0; 010 /** The velocity to feed-forward (in sensor-units per 100ms). */ 011 public double velocity = 0; 012 /** Added to the output of PID[0], should be within [-1,+1] where 0.01 = 1%. */ 013 public double arbFeedFwd = 0; 014 /** Not used. Use auxiliaryPos instead. @see auxiliaryPos */ 015 public double headingDeg = 0; 016 /** The position for auxiliary PID[1] to target (in sensor units). */ 017 public double auxiliaryPos = 0; 018 /** The velocity for auxiliary PID[1] to target. (in sensor-units per 100ms). */ 019 public double auxiliaryVel = 0; 020 /** Added to the output of PID[1], should be within [-1,+1] where 0.01 = 1%. */ 021 public double auxiliaryArbFeedFwd = 0; 022 023 /** 024 * Which slot to get PIDF gains. PID is used for position servo. F is used 025 * as the Kv constant for velocity feed-forward. Typically this is hard-coded 026 * to a particular slot, but you are free to gain schedule if need be. 027 * Choose from [0,3] 028 */ 029 public int profileSlotSelect0 = 0; 030 031 /** 032 * Which slot to get PIDF gains for auxiliary PId. 033 * This only has impact during MotionProfileArc Control mode. 034 * Choose from [0,3]. 035 */ 036 public int profileSlotSelect1 = 0; 037 038 /** 039 * Set to true to signal Talon that this is the final point, so do not 040 * attempt to pop another trajectory point from out of the Talon buffer. 041 * Instead continue processing this way point. Typically the velocity member 042 * variable should be zero so that the motor doesn't spin indefinitely. 043 */ 044 public boolean isLastPoint = false; 045 /** 046 * Set to true to signal Talon to zero the selected sensor. When generating 047 * MPs, one simple method is to make the first target position zero, and the 048 * final target position the target distance from the current position. Then 049 * when you fire the MP, the current position gets set to zero. If this is 050 * the intent, you can set zeroPos on the first trajectory point. 051 * 052 * Otherwise you can leave this false for all points, and offset the 053 * positions of all trajectory points so they are correct. 054 * 055 * If using multiple sensor sources (Arc modes) we recommend you manually set sensor positions 056 * before arming MP, instead of using this feature. 057 */ 058 public boolean zeroPos = false; 059 060 /** 061 * Duration (ms) to apply this trajectory pt. 062 * This time unit is ADDED to the existing base time set by 063 * ConfigMotionProfileTrajectoryPeriod(). 064 */ 065 public int timeDur = 0; 066 067 /** 068 * If using MotionProfileArc, this flag must be true on all points. 069 * If using MotionProfile, this flag must be false on all points. 070 */ 071 public boolean useAuxPID = false; 072}