Пример #1
0
        /// <summary>
        /// Traverses axis in a full range several times.
        /// </summary>
        public static PlanBuilder BackAndForwardAxisTraversal()
        {
            var traverseDelta = 400;
            var builder       = new PlanBuilder();

            for (var i = 0; i < 30; ++i)
            {
                var distance     = Constants.MaxStepsX;
                var acceleration = Coord2DController.CreateAcceleration(Constants.StartDeltaT, traverseDelta)[0];
                var deceleration = Coord2DController.CreateAcceleration(traverseDelta, Constants.StartDeltaT)[0];
                distance -= Math.Abs(acceleration.StepCount);
                distance -= Math.Abs(deceleration.StepCount);

                if (i % 2 == 0)
                {
                    builder.AddXY(acceleration, null);
                    builder.AddConstantSpeedTransitionXY(distance, 0, Speed.FromDeltaT(traverseDelta));
                    builder.AddXY(deceleration, null);
                }
                else
                {
                    builder.AddXY(acceleration.WithReversedDirection(), null);
                    builder.AddConstantSpeedTransitionXY(-distance, 0, Speed.FromDeltaT(traverseDelta));
                    builder.AddXY(deceleration.WithReversedDirection(), null);
                }
            }

            builder.ChangeXYtoUV();
            return(builder);
        }