/**
 * Copyright (c) 2021, 2026 Contributors to the Eclipse Foundation
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */
import "tutorial_ext.machine" 
import "tutorial.setting"

// area settings.
val width = 300   // <1>
val height = 300
val right = width/2  // <2>
val left = width/-2
val homeLeft = left - 10
val homeRight = right + 10
val center = left + (right - left)/2
// timings
val breakTiming = 100e-3

//profiles (artificial)
val vRSlow = 0.5
val aRSlow = 0.5
val jRSlow = 0.5
val sRSlow = 0.1
val vRNormal = vRSlow*2
val aRNormal = vRSlow*2
val jRNormal = vRSlow*2
val sRNormal = 0.1
val clampLow = 1
val clampSD = 0.1

Robot.give.M { // <3>
  Axis X {
    Profiles { 
      slow (V = vRSlow, A = aRSlow, J = jRSlow, S = sRSlow) // <4>
      normal (V = vRNormal, A = aRNormal, J = jRNormal)
    }
    Positions { 
      Transfer = left
      Home = homeLeft
      Flip = center
    }
  }
}

Robot.take.M { // <3>
  Axis X {
    Profiles {
      slow (V = vRSlow, A = aRSlow, J = jRSlow, S = sRSlow)
      normal (V = vRNormal, A = aRNormal, J = jRNormal)
    }
    Positions {
      Transfer = right
      Home = homeRight
      Flip = center
    }
  }
}

Robot.C { // <5>
  Timings {
    clamp = Normal(mean = clampLow+clampSD, sd = clampSD)  // <6>
    unclamp = 0.9
  }
}

Flipper.F {
    Axis C {
        Profiles {
             normal (V = 1, A = 1, J = 2)
        }
        Distances {  // <7>
            HalfRound = 0.5 
        }
    }
}

Flipper.C {
  Timings {
    clamp = 0.5
    unclamp = 0.9
  }
}