B.1.2.2 add point sample – ElmoMC Multi-Axis Motion Controller-Maestro User Manual
Page 256
v1.vdc = 28000000 //max deceleration
v1.vsp=10000 // max velocity
v1.circle(5000, 180, 90) // create circle
v1.bg // start motion
while
(a1.ms==2)||(a2.ms==2)//wait until both axes have stopped
wait(10)
end
while
end function
B.1.2.2 Add Point Sample
float alfa,alfa0
float px0,px1,py0,py1,vx,vy,t
float R
float PI
float Vmax
function run()
initialization()
drawTrj()
v1.bg
while((a1.ms==2)||(a2.ms==2))
wait(10)
end
while
// reUseTrajectory()
end function
function initialization()
global float alfa,alfa0
global float px0,px1,py0,py1,vx,vy,t
global float R
global float PI
global float Vmax
alfa=0
alfa0
=0
PI=3.14159265358979323
R=100000
t=100 // time to move from pt to pt
Vmax = 10000
InitAxis(a1)
InitAxis(a2)
a1.px=R
a2.px=0
v1.mo=1
wait(50)
a1.pa=R
a2.pa=0
v1.bg
end function
function drawTrj()
// this routine calculates pvt info
// based on the center point of a circle
global float alfa,alfa0
global float px0,px1,py0,py1,vx,vy,t
global float R
global float PI
global float Vmax
sync(0,
10)
v1.vtm=1 // init pvt
v1.startp(pvtdata)
// start building trajectory
// store in abyrvalg file for re-use
// for re-use of same circle, trajectory,
start position
px0 = R
py0 = 0
vy = vx = 0
v1.addpoint(px0,vx,py0,vy,200)
//the 1st point of the trajectory is on the
//circumference of the circle at (R,0)
vy = Vmax
v1.addpoint(px0,vx,py0,vy,t)
// second point
//alfa0
=
0
while( alfa<=2*PI )
px1=R*cos(alfa) // calculate x-position
py1=R*sin(alfa)
// calculate y-position
alfa = alfa0 + (Vmax/R)*t/1000
// increment angle
vx = -Vmax*sin(alfa)
// update speed of x-axis
vy = Vmax*cos(alfa)
// update speed of y-axis
alfa0 = alfa // update angle
v1.addpoint(px1,vx,py1,vy,t) // next point
px0=px1;
py0=py1
end
while
v1.ends()
end function
// this function re-uses a trajectory that was built above
function reUseTrajectory()
//v1.vdt
=
500
v1.vdt
=
30
v1.dotrj(pvtdata)
while((a1.ms==2)||(a2.ms==2))
wait(10)
end
while
end function
function InitAxis(AXIS axis)
axis.rm = 0 //The reference is generated by the
// interpreter command or by the user
//
program.
axis.mo
=
0
wait(10)
axis.sf = 0
axis.um = 5
axis.ll[2]
=
-833333
axis.hl[2] = 833333
axis.VH[2] = 750000
axis.VL[2]
=
-750000
axis.ll[3]
=
-1000000000
axis.hl[3] = 1000000000
axis.VL[3]
=
-999999990
axis.VH[3] = 999999990
end function
Maestro
Software Manual
Appendix B: Sample Programs
MAN-MASSW (Ver. Q)
B-4