# note: excluding code for configuring 3-phase motor
# create a velocity profile
profile = [{'velocity': 10000, 'acceleration': 5000},
{'velocity': 0, 'acceleration': 5000}]
# generate the velocity profile table
segments = pm.mtr_create_velocity_profile(0, profile, servomode = 1, elec_cycle_div=elec_cycle_div)
# write the table to the PiMotion trajectory table memory
# at segment 0
pm.mtr_write_table(0,segments)
# start the motor at segment 0 without waiting for trigger
pm.mtr_start(0,pilib.TRIG_SRC_NONE)
# wait while the trajectory genorator is busy
print ('Waiting while trajectory generator is busy...')
while(pm.mtr_get_traj_gen_busy()):
time.sleep(1)
print("Done... turning off trajectory generator.")
# turn off the trajectory generator
# the target position wil track the actual position
pm.mtr_set_traj_gen_enable(0)