示例#1
0
 internal GoPiGo(I2cDevice device)
 {
     if (device == null) throw new ArgumentNullException(nameof(device));
     DirectAccess = device;
     _motorController = new MotorController(this);
     _encoderController = new EncoderController(this);
 }
示例#2
0
 internal GoPiGo()
 {
     this.Driver        = new I2cDriver(ProcessorPin.Pin2, ProcessorPin.Pin3);
     this.I2CController = Driver.Connect(GoPiGoAddress);
     _motorController   = new MotorController(this);
     _encoderController = new EncoderController(this);
 }
示例#3
0
 private void InitMotorControl()
 {
     _motorControl           = _kernel.Get <IMotorController>();
     _motorControl.MotorPin1 = ConnectorPin.P1Pin11;
     _motorControl.MotorPin2 = ConnectorPin.P1Pin13;
     _motorControl.Initialize();
 }
示例#4
0
        // ----- 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;
            }
        }
示例#5
0
 private void InitMotorControl()
 {
     _motorControl = _kernel.Get<IMotorController>();
     _motorControl.MotorPin1 = ConnectorPin.P1Pin11;
     _motorControl.MotorPin2 = ConnectorPin.P1Pin13;
     _motorControl.Initialize();
 }
示例#6
0
        public RemoteSensoredGearbox(float unitsPerRevolution, IMotorController master, IFollower[] followers, RemoteFeedbackDevice remoteFeedbackDevice) : base(master, followers)
        {
            _unitsPerRevolution   = unitsPerRevolution;
            _rotationsPerUnit     = 1f / _unitsPerRevolution;
            _remoteFeedbackDevice = remoteFeedbackDevice;

            _motor.ConfigSelectedFeedbackSensor(_remoteFeedbackDevice, 0);
        }
示例#7
0
        protected RemoteSensoredGearbox(float unitsPerRevolution, IMotorController master) : base(master)
        {
            _unitsPerRevolution   = unitsPerRevolution;
            _rotationsPerUnit     = 1f / _unitsPerRevolution;
            _remoteFeedbackDevice = RemoteFeedbackDevice.RemoteFeedbackDevice_None;

            /* child class takes care of sensor */
        }
示例#8
0
 public void SetMotor(int axis, IMotorController motorController)
 {
     if (axis > 2)
     {
         throw new ArgumentOutOfRangeException("axis");
     }
     motor[axis] = motorController;
 }
示例#9
0
 public DeviceController(IMotorController motorController, IHallEffectController hallEffectController, IObjectDetectionController objectDetectionController, ITiltController tiltController, ITofController tofController, IButtonController buttonController)
 {
     this.motorController           = motorController;
     this.hallEffectController      = hallEffectController;
     this.objectDetectionController = objectDetectionController;
     this.tiltController            = tiltController;
     this.tofController             = tofController;
     this.buttonController          = buttonController;
 }
示例#10
0
 internal GoPiGo(I2cDevice device)
 {
     if (device == null)
     {
         throw new ArgumentNullException(nameof(device));
     }
     DirectAccess       = device;
     _motorController   = new MotorController(this);
     _encoderController = new EncoderController(this);
 }
示例#11
0
        public Linkage(IMotorController master, IFollower[] followers)
        {
            _motor     = master;
            _followers = new IFollower[followers.Length];

            for (int i = 0; i < _followers.Length; ++i)
            {
                _followers[i] = followers[i];
            }

            Setup();
        }
示例#12
0
        public Tank(IMotorController m1, IMotorController m2, bool leftInvert, bool rightInvert)
        {
            /* Create 2 single motor gearboxes */
            Gearbox temp1 = new Gearbox(m1);
            Gearbox temp2 = new Gearbox(m2);

            _left  = temp1;
            _right = temp2;

            _left.SetInverted(leftInvert);
            _right.SetInverted(rightInvert);

            _gearBoxes = new Gearbox[] { _left, _right };
        }
示例#13
0
        /** Contstructor that takes 4 SimpleMotorcontrollers */
        public Mecanum(IMotorController m1, IMotorController m2, IMotorController m3, IMotorController m4)
        {
            //GroupMotorControllers.Register(m1); // commented out to compile

            /* Creat 4 single motor gearboxes */
            Gearbox temp1 = new Gearbox(m1);
            Gearbox temp2 = new Gearbox(m2);
            Gearbox temp3 = new Gearbox(m3);
            Gearbox temp4 = new Gearbox(m4);

            _1 = temp1;
            _2 = temp2;
            _3 = temp3;
            _4 = temp4;
        }
示例#14
0
        //--------------------- Constructors -----------------------------//
        /** Contstructor that takes 4 SimpleMotorcontrollers */
        public Mecanum(IMotorController m1, IMotorController m2, IMotorController m3, IMotorController m4)
        {
            /* Creat 4 single motor gearboxes */
            Gearbox temp1 = new Gearbox(m1);
            Gearbox temp2 = new Gearbox(m2);
            Gearbox temp3 = new Gearbox(m3);
            Gearbox temp4 = new Gearbox(m4);

            _1 = temp1;
            _2 = temp2;
            _3 = temp3;
            _4 = temp4;


            _gearBoxes = new Gearbox[] { _1, _2, _3, _4 };
        }
示例#15
0
        private static void Main(string[] args)
        {
            var kernel = new StandardKernel(new Bindings());

            kernel.Load(Assembly.GetExecutingAssembly());

            motorControl           = kernel.Get <IMotorController>();
            motorControl.MotorPin1 = ConnectorPin.P1Pin11;
            motorControl.MotorPin2 = ConnectorPin.P1Pin13;
            motorControl.Initialize();

            RegisterStopSwitches();

            motorControl.StartTestRun();

            while (true)
            {
            }
        }
示例#16
0
 internal static void Unregister(IMotorController motorController)
 {
     _mcs.Remove((object)motorController);
 }
示例#17
0
 internal static void Register(IMotorController motorController)
 {
     _mcs.Add(motorController);
 }
示例#18
0
 /**
  * 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.
  */
 public void Follow(IMotorController masterToFollow)
 {
     Follow(masterToFollow, FollowerType.PercentOutput);
 }
示例#19
0
 internal GoPiGo(I2cDevice device)
 {
     Device             = device;
     _motorController   = new MotorController(this);
     _encoderController = new EncoderController(this);
 }
示例#20
0
 public Gearbox(IMotorController mc0, IFollower mc1, IFollower mc2, IFollower mc3) : base(mc0, mc1, mc2, mc3)
 {
 }
示例#21
0
 public HardwareProxy(IMotorController motor, ILaser laser, IAssistantIO blowing)
 {
     this.Motor   = motor;
     this.Laser   = laser;
     this.Blowing = blowing;
 }
示例#22
0
 public Linkage(IMotorController mc0, IFollower mc1) : this(mc0, new IFollower[] { mc1 })
 {
 }
示例#23
0
 public Linkage(IMotorController mc0, IFollower mc1, IFollower mc2, IFollower mc3) : this(mc0, new IFollower[] { mc1, mc2, mc3 })
 {
 }
示例#24
0
 public FeedbackControlSystem(IMotorController motorController, IHallEffectController hallEffectController)
 {
     this.motorController      = motorController;
     this.hallEffectController = hallEffectController;
 }
示例#25
0
 protected RemoteSensoredGearbox(float unitsPerRevolution, IMotorController master, IFollower[] followers) : base(master, followers)
 {
     _unitsPerRevolution = unitsPerRevolution;
     _rotationsPerUnit   = 1f / _unitsPerRevolution;
     /* child class takes care of sensor */
 }
示例#26
0
        //--------------------- Constructors -----------------------------//
        /* Multiple constructors that take 1 to 4 motors per gearbox */
        public Linkage(IMotorController mc0)
        {
            _motor = mc0;

            Setup();
        }
示例#27
0
 public Gearbox(IMotorController mc0) : base(mc0)
 {
 }
 public void Follow(IMotorController masterToFollow)
 {
     _master = (IMotorController)(masterToFollow);
 }
示例#29
0
 public RemoteSensoredGearbox(float unitsPerRevolution, IMotorController mc0, IFollower mc1, IFollower mc2, RemoteFeedbackDevice remoteFeedbackDevice) : this(unitsPerRevolution, mc0, new IFollower[] { mc1, mc2 }, remoteFeedbackDevice)
 {
 }
示例#30
0
 public Gearbox(IMotorController master, IFollower[] followers) : base(master, followers)
 {
 }
示例#31
0
 public CommandServer(IMotorController motorController, IPacketParser packetParser)
 {
     _motorController = motorController;
     _packetParser    = packetParser;
 }
示例#32
0
 public Gearbox(IMotorController mc0, IFollower mc1) : base(mc0, mc1)
 {
 }