B.1.5.2 circle-to-line with homing sample, B.1.6 polygon sample, B.1.6.1 polygon – ElmoMC Multi-Axis Motion Controller-Maestro User Manual
Page 260
Maestro
Software Manual
Appendix B: Sample Programs
MAN-MASSW (Ver. Q)
B.1.5.2
Circle-to-Line with Homing Sample
function run()
a1.rm = 0 //The reference is generated by the interpreter
command or by the user program.
a2.rm
=
0
sync(0, 10) //send a sync signal to CAN bus 0 every 10ms
homing()
v1.vum=1 //build trajectory in max. velocity mode
v1.vsc=1 //smooth intersection with max. velocity
v1.vtm=1 //enable PVT motion initialization
v1.vac = 28000000 //max acceleration
v1.vdc = 28000000 //max deceleration
v1.starts() //begin trj
v1.vsp = 30000 //max. velocity
v1.vse = 30000 //end velocity
v1.addcircle(
5000,180,180
)
//create 5000 count radius
circle from -180 to 180
v1.vsp = 10000 //max velocity
v1.vse = 0 //end velocity
v1.addline( 10000,15000) //create line from current point
to coordinate
//10,000 on X and 15,000 on Y
v1.ends() //end trj
while
(a1.ms==2)||(a2.ms==2)//wait until both axes have
stopped
wait(10)
end
while
end function
function homing()
int x_home_pos, y_home_pos
x_home_pos = 0
y_home_pos = 0
v1.mo
=
1
// homing a1
a1.hm[2] = x_home_pos
a1.hm[3] = 0
a1.hm[4] = 0
a1.hm[5] = 0
a1.hm[1] = 1
// homing a2
a2.hm[2] = y_home_pos
a2.hm[3] = 0
a2.hm[4] = 0
a2.hm[5] = 0
a2.hm[1] = 1
end function
B.1.6
Polygon Sample
B.1.6.1 Polygon
function run()
sync(0, 10)
//synchronize CAN Bus 0 every 10 ms
v1.mo=0 //motor
off
a1.px=-64000
//set coor. x to 64000
a2.px=128000
//set coor. y to 128000
v1.mo=1 //motor
on
v1.vsc=1
//maximum velocity smooth factor
v1.starts()
//
begin
trajectory
v1.vsp = 50000 //max velocity
v1.vse = 50000 //end velocity
//first line and corner
v1.addline ( 64000, 128000 )
v1.addcircle( 64000,90,-90 )
//second line and corner
v1.addline ( 128000, -64000 )
v1.addcircle( 64000,0,-90 )
//third line and corner
v1.addline ( -64000, -128000 )
v1.addcircle( 64000,-90,-90 )
//last line and corner
B-8