Git Product home page Git Product logo

hero_testexamples's People

Contributors

senseigia avatar

Forkers

ozrien

hero_testexamples's Issues

Phoenix Netmf: Not sure about this one Configuring OpenLoopRampRate

Issue
When using ConfigSetParameter/ConfigOpenloopRamp to configure the ramp rate, it appears that we always return an integer. When using ConfigSetParameter with the value of 2.25, we get the value of 2; when using ConfigOpenloopRamp with the value of 2.25, we get the value of 4. Both configSetParameter and ConfigOpenloopRamp scale the value to int losing the float precesion, do we care about this?

Test Code

using System;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using CTRE.Phoenix.MotorControl.CAN;
using CTRE.Phoenix.MotorControl;
using CTRE.Phoenix.Controller;
using CTRE.Gadgeteer.Module;
using CTRE.Phoenix;

/* Jacob's test upadated to Phoenix Framwork */
namespace GeneralPCMTest
{
    public class Program
    {
        /* Hardware */
        static TalonSRX _talon = new TalonSRX(0);
        static GameController _gamepad = new GameController(UsbHostDevice.GetInstance());

        /* All buttons */
        static bool[] _currentBtns = new bool[13];
        static bool[] _previousBtns = new bool[13];

        public static void Main()
        {
            /* Enable the status frame used to test configFactorDefault */
            _talon.SetStatusFramePeriod(StatusFrameEnhanced.Status_7_CommStatus, 10, 10);

            while (true)
            {
                /* Always enable actuators during this test */
                CTRE.Phoenix.Watchdog.Feed();

                /* Just get all buttons */
                _gamepad.GetButtons(_currentBtns);

                CTRE.ErrorCode _error;
                bool errorState = false;
                if(_currentBtns[2] && !_previousBtns[2]){
                    Debug.Print("Peforming random sets...");
                    /* Do a bunch of sets */
                    _error = _talon.ConfigSetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eContinuousCurrentLimitAmps, 10, 0, 0, 10);
                    if (_error != 0)
                        errorState = true;
                    //Thread.Sleep(1000);
                    _error = _talon.ConfigSetParameter(CTRE.Phoenix.LowLevel.ParamEnum.ePeakCurrentLimitAmps, 17, 0, 0, 10);
                    if (_error != 0)
                        errorState = true;
                    //Thread.Sleep(1000);
                    _error = _talon.ConfigOpenloopRamp(0.25f, 10);
                    //_error = _talon.ConfigSetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eOpenloopRamp, 2.25f, 0, 0, 10);
                    if (_error != 0)
                        errorState = true;
                    //Thread.Sleep(1000);
                    _error = _talon.ConfigSetParameter(CTRE.Phoenix.LowLevel.ParamEnum.ePeakCurrentLimitMs, 100, 0, 0, 10);
                    if (_error != 0)
                        errorState = true;
                    //Thread.Sleep(1000);
                    _error = _talon.ConfigSetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eMotMag_VelCruise, 1000, 0, 0, 10);
                    if (_error != 0)
                        errorState = true;
                    //Thread.Sleep(1000);
                    Debug.Print("Sets completed: " + (errorState ? "Error Somewhere" : "No Errors"));
                }else if (_currentBtns[4] && !_previousBtns[4])
                {
                    Debug.Print("All configurations cleared");
                    /* Need to add to param enum to higher level cs files */
                    _talon.ConfigSetParameter((CTRE.Phoenix.LowLevel.ParamEnum)500, 0xA5A5, 0, 0, 10);
                }else if (_currentBtns[6] && !_previousBtns[6])
                {
                    Debug.Print("Reading all configurations");
                    float[] Configurations = new float[5];
                    _talon.ConfigGetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eContinuousCurrentLimitAmps, out Configurations[0]);
                    _talon.ConfigGetParameter(CTRE.Phoenix.LowLevel.ParamEnum.ePeakCurrentLimitAmps, out Configurations[1]);
                    _talon.ConfigGetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eOpenloopRamp, out Configurations[2]);
                    _talon.ConfigGetParameter(CTRE.Phoenix.LowLevel.ParamEnum.ePeakCurrentLimitMs, out Configurations[3]);
                    _talon.ConfigGetParameter(CTRE.Phoenix.LowLevel.ParamEnum.eMotMag_VelCruise, out Configurations[4]);
                    Debug.Print("CCLA: " + Configurations[0] + " PCLA: " + Configurations[1] + " OLR: " + Configurations[2] + " PCLM: " + Configurations[3] + " MMVC: " + Configurations[4]);
                }
                System.Array.Copy(_currentBtns, _previousBtns, _currentBtns.Length);

                Thread.Sleep(5);
            }
        }
    }
}

Issues setting MotionMagicArc

It would appear that SetValueMotionProfie.Hold provides a different result form ....Enable. Using Vehicle SPY, it would appear that the HoldHeading Signal in the General Control frame is set to false sporadically.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.