public SmartQuadrupedController(QuadrupedIkDriver driver)
 {
     _driver = driver ?? throw new ArgumentNullException(nameof(driver));
     _driver.Setup();
     _lastWrittenPosition = _driver.ReadCurrentLegPositions();
     Task.Run(MainControllerLoop).ConfigureAwait(false);
 }
Example #2
0
        public FunctionalGaitEngine(QuadrupedIkDriver driver) : base(driver)
        {
            Driver.Setup();
            var   currentPosition = driver.ReadCurrentLegPositions();
            float average         = (currentPosition.LeftFront.Z +
                                     currentPosition.RightFront.Z +
                                     currentPosition.LeftRear.Z +
                                     currentPosition.RightRear.Z) / 4;

            if (average > -9)
            {
                Driver.MoveLegsSynced(RelaxedStance.Transform(new Vector3(0, 0, -LegHeight)));
                Thread.Sleep(1000);
            }
            _lastWrittenPosition = RelaxedStance;
            Driver.MoveLegsSynced(_lastWrittenPosition);
            StartEngine();
        }