示例#1
0
        private void OpenGrabber()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(OPENGRABBER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            CANController.SetPWMOutput(map.GetFlagGrabberServo_ID(), pulses); //move servo
        } //FLAGSURVO LOOK LOOK LOOOK LOOK LOOK LOOK LOOK DO THIS FIX IT HE SHOWED YOU YOU GOTTA DO IT LLLLLLOOOOOOOOOOOK
示例#2
0
        private void CloseGrabber()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(CLOSEGRABBER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            CANController.SetPWMOutput(map.GetFlagGrabberServo_ID(), percentOut); //move servo
        }
示例#3
0
        private void deliver()
        {
            Robotmap map        = Robotmap.GetInstance();
            float    pulses     = LinearInterpolation.Calculate(DELIVER, -1.0f, minPWMSignalRange, 1.0f, maxPWMSignalRange);
            float    percentOut = pulses / pwmOutput;

            deliverServo.EnablePWMOutput((int)map.GetDeliverMec_ID(), true);
            deliverServo.SetPWMOutput(map.GetDeliverMec_ID(), percentOut); //move servo
        }
    public void OnLoop()
    {
        float pulse = Platform.Tasks.taskMeasurePulseSensors.GetMeasuredPulseWidthsUs(CANifier.PWMChannel.PWMChannel3);

        /* scale [0,8000] us to [0,360' Hue Deg */
        float hue = LinearInterpolation.Calculate(pulse, 0f, 0f, 8000f, 360f);

        Platform.Tasks.taskHSV_ControlLedStrip.Hue        = hue;
        Platform.Tasks.taskHSV_ControlLedStrip.Saturation = 1;
        Platform.Tasks.taskHSV_ControlLedStrip.Value      = 0.05f; /* hardcode the brightness */
    }
示例#5
0
    bool _running; //!< Track if we are running so TaskMainLoop can keep "starting" this task with no extra init work.

    public void OnLoop()
    {
        /* just grab three axis and direct control the components */
        float axis = Hardware.gamepad.GetAxis(Constants.GamePadAxis_y);
        /* scale to typical pwm withds */
        float pulseUs = LinearInterpolation.Calculate(axis, -1, 1000f, +1, 2000f); /* [-1,+1] => [1000,2000]us */
        /* scale to period */
        float periodUs = 4200;                                                     // hardcoded for now, this will be settable in future firmware update.

        _percentOut = pulseUs / periodUs;
        /* set it */
        Hardware.canifier.SetPWMOutput(Constants.kMotorControllerCh, _percentOut);
    }
示例#6
0
        public float GetDutyCyclePerc(Channel channel)
        {
            float retval = GetDutyCycleUs(channel);

            retval = LinearInterpolation.Calculate(retval, 1000, -1, 2000, 1);

            if (retval < -1)
            {
                retval = -1;
            }
            else if (retval > +1)
            {
                retval = +1;
            }

            return(retval);
        }
    public void OnLoop()
    {
        float rightStickY = Hardware.gamepad.GetAxis(5);  // Ensure Positive is turn-right, negative is turn-left

        CTRE.Util.Deadband(ref rightStickY);

        _percentOut = rightStickY;                                                    // [-1,1]
        _percentOut = LinearInterpolation.Calculate(_percentOut, -1, -13f, +1, +13f); // scale to [-13V, +13V]
        _percentOut = CTRE.Util.Cap(_percentOut, 13f);                                // cap to 13V

        Subsystems.Wheel.SetPercentOutput(_percentOut);

        /* if Talon was reset, redo config.  This is generally not necessary */
        if (Subsystems.Wheel.MotorController.HasResetOccured())
        {
            Subsystems.Wheel.Setup();
        }
    }