void ISpeedRegulator_evNewSpeedSettingCalculated(object sender, NewSpeedSettingCalculatedEventArgs args)
 {
     if (args.getSpeedSetting() > 0)
     {
         servoDriver.setThrottle(args.getSpeedSetting());
     }
     else
     {
         servoDriver.setThrottle(0.0);
     }
 }
 void PIDSpeedRegulator_evNewSpeedSettingCalculated(object sender, NewSpeedSettingCalculatedEventArgs args)
 {
     Logger.Log(this, String.Format("new speed setting calculated: {0}", args.getSpeedSetting()));
 }
        void SpeedRegulator_evNewSpeedSettingCalculated(object sender, NewSpeedSettingCalculatedEventArgs args)
        {
            this.Dispatcher.Invoke(
                new Action<TextBlock, string>((textBox, val)
                    => textBox.Text = val),
                        textBlock_steeringSpeed,
                        String.Format("{0:0.###}", args.getSpeedSetting())
            );

            //target for brake regulator
            double targetBrake = args.getSpeedSetting();
            if(targetBrake < 0)
            {
                targetBrake *= -1;
            }
            else
            {
                targetBrake = 0;
            }
            this.Dispatcher.Invoke(
                new Action<TextBlock, string>((textBlock, val)
                    => textBlock.Text = val),
                        textBlock_targetBrake,
                        String.Format("{0:0.###}", targetBrake)
            );
        }
예제 #4
0
 private void SpeedRegulator_evNewSpeedSettingCalculated(object sender, NewSpeedSettingCalculatedEventArgs args)
 {
     Model.CarInfo.SpeedSteering = args.getSpeedSetting();
     Model.CarInfo.TargetBrake = args.getSpeedSetting() * -1; //TODO: check this
 }
 void ISpeedRegulator_evNewSpeedSettingCalculated(object sender, NewSpeedSettingCalculatedEventArgs args)
 {
     model.SpeedSteering = args.getSpeedSetting();
 }