예제 #1
0
 public SmartQuadrupedController(QuadrupedIkDriver driver)
 {
     _driver = driver ?? throw new ArgumentNullException(nameof(driver));
     _driver.Setup();
     _lastWrittenPosition = _driver.ReadCurrentLegPositions();
     Task.Run(MainControllerLoop).ConfigureAwait(false);
 }
예제 #2
0
 public void DetachDriver()
 {
     if (!_engineTask.IsCompleted)
     {
         throw new InvalidOperationException("Engine has to be stopped before detaching the driver");
     }
     Driver = null;
 }
예제 #3
0
 public InterpolationGaitEngine(QuadrupedIkDriver driver) : base(driver)
 {
     Driver.Setup();
     _lastWrittenPosition = Driver.ReadCurrentLegPositions();
     if (_moves.TryDequeue(out var deqeueuedLegPosition))
     {
         _nextMove = deqeueuedLegPosition;
     }
     StartEngine();
 }
예제 #4
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();
        }
예제 #5
0
 protected QuadrupedGaitEngine(QuadrupedIkDriver driver)
 {
     Driver = driver ?? throw new ArgumentNullException(nameof(driver));
 }