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