|
// Asynchronous Motion Example:
// Demonstrates using MoveIncremental(), MoveAbsolute() and MoveFreerun() axis-based motion.
program
// Enable and home the axes.Enable([X, Y, Z])
Home([X, Y, Z])
// Configure the axis-based ramping settings.
// X and Y will use Linear ramping. Z will use Sine ramping.SetupAxisRampType([X, Y], RampType.Linear)
SetupAxisRampType(Z, RampType.Sine)
// X, Y, and Z will use a ramp rate of 1000.0 units/sec/sec.
SetupAxisRampValue([X, Y, Z], RampMode.Rate, 1000.0)
SetupAxisRampValue(Z,0,500)
// Move X, Y, and Z to an initial position of 10 units.
// Move all axes at 20 units/second. // Note: The AeroScript program flow immediately continues after an asynchronous move // is started, so we must explicitly wait for the moves to complete.MoveAbsolute([X, Y, Z], [10.0, 10.0, 10.0], [20.0, 20.0, 20.0])
WaitForInPosition([X, Y, Z])
// Trigger a data collection snapshot in Studio.
AppDataCollectionSnapshot()
// Perform independent axis moves on X and Y using absolute target positions, followed by
// a move on Z using an incremental distance. // Move X and Y independently to (27.0 units, 13.5 units). // X will move at a maximum speed of 50 units/second. // Y will move at a maximum speed of 75 units/second.MoveAbsolute([X, Y], [27.0, 13.5], [50.0, 75.0])
WaitForMotionDone([X, Y])
// Move Z from its current location by -15.5 units at a speed of 20.0 units/second.
MoveIncremental(Z, -15.5, 20.0)
WaitForMotionDone(Z)
// Perform a freerun move on the Z axes to a constant velocity of +30.0 units/second.
// After 2 seconds, change the speed to -40.0 units/second. // After 2 additional seconds, stop the motion.Dwell(1.0)
MoveFreerun(Z, 30.0)
Dwell(2.0)
MoveFreerun(Z, -40.0)
Dwell(2.0)
MoveFreerunStop(Z)
WaitForMotionDone(Z)
// Stop data collection.
AppDataCollectionStop()
// Disable the axes.
Disable([X, Y, Z])
end
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-8-2 19:53
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社