Can't get xyzx motors to work
I'm a beginner. Built my machine myself but haven't managed to do anything with it yet. I don't know gcode. I'e been learning some of the CAD/CAM programs out there.
I have a Gecko g540. 4 motors. two of them need to control one axis. Some time ago, I had it working with one on each, but the gantry wasn't stiff enough.
Running Ubuntu with emc2 2.4.6 (trying to anyway)
if I run with
COORDINATE = x y z a
in my ini file, I am able to control all four motors independently in manual control.
If I put it to
COORDINATE = x y z
only one of my x motors works.
From reading around two motors on a single axis is fairly common so surely this can be done with EMC2. Reading through older posts, it seems that others are having similar issues.
What's the trick?
here are my ini and hal.
I'd be most grateful if someone can help me. I've been working on this thing off and on for over a year and I really want to cut something!
Miles
[EMC]
MACHINE = BDW24368
DEBUG = 0
[DISPLAY]
DISPLAY = axis
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 1.2
INTRO_GRAPHIC = emc2.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/miles/emc2/nc_files
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = emc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 30382
SERVO_PERIOD = 1000000
[HAL]
HALUI = halui
HALFILE = gantry.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal
[HALUI]
# add halui MDI commands here (max 64)
[TRAJ]
AXES = 4
COORDINATES = X Y Z
MAX_ANGULAR_VELOCITY = 10.00
DEFAULT_ANGULAR_VELOCITY = 1.00
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 1.00
MAX_LINEAR_VELOCITY = 10.00
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[AXIS_0]
NAME = X1
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 10.0
MAX_ACCELERATION = 10.0
STEPGEN_MAXACCEL = 12.5
SCALE = 8000
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -36.0
MAX_LIMIT = 36.0
HOME_OFFSET = 0.0
[AXIS_1]
NAME = Y
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 10
MAX_ACCELERATION = 10.0
STEPGEN_MAXACCEL = 12.5
SCALE = 8000
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -24.0
MAX_LIMIT = 24.0
HOME_OFFSET = 0.0
[AXIS_2]
NAME = Z
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 1.0
MAX_ACCELERATION = 10.0
STEPGEN_MAXACCEL = 12.5
SCALE = 8000
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -4.0
MAX_LIMIT = 4.0
HOME_OFFSET = 0.0
[AXIS_3]
NAME = X2
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 10.0
MAX_ACCELERATION = 10.0
STEPGEN_MAXACCEL = 12.5
SCALE = 8000
FERROR = 0.05
MIN_FERROR = 0.01
MIN_LIMIT = -36.0
MAX_LIMIT = 36.0
HOME_OFFSET = 0.0
############################## Kinematics & Motion Controller ####################################
# Kinematics
loadrt gantrykins coordinates=XYZX
# Settings for gantrykins
setp gantrykins.joint-0 0
setp gantrykins.joint-1 1
setp gantrykins.joint-2 2
setp gantrykins.joint-3 0
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hal_parport cfg="0x378 out "
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0,0
addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf parport.0.write base-thread
addf parport.0.reset base-thread
addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
#addf pwmgen.update servo-thread
#net spindle-cmd <= motion.spindle-speed-out => pwmgen.0.value
#net spindle-enable <= motion.spindle-on => pwmgen.0.enable
#net spindle-pwm <= pwmgen.0.pwm
#setp pwmgen.0.pwm-freq 100.0
#setp pwmgen.0.scale 1166.66666667
#setp pwmgen.0.offset 0.114285714286
#setp pwmgen.0.dither-pwm true
#net spindle-cw <= motion.spindle-forward
net estop-out => parport.0.pin-01-out
# Invert pins to make motors move in right direction
setp parport.0.pin-02-out-invert 1
setp parport.0.pin-03-out-invert 1
# Hook up the step and dir signals to the parport pins
# Axis X and X2 are the same axis but different motors
net xstep => parport.0.pin-02-out
setp parport.0.pin-02-out-reset 1
net xdir => parport.0.pin-03-out
net ystep => parport.0.pin-04-out
setp parport.0.pin-04-out-reset 1
net ydir => parport.0.pin-05-out
net zstep => parport.0.pin-06-out
setp parport.0.pin-06-out-reset 1
net zdir => parport.0.pin-07-out
net astep => parport.0.pin-08-out
setp parport.0.pin-08-out-reset 1
net adir => parport.0.pin-09-out
net spindle-cw => parport.0.pin-14-out
net spindle-pwm => parport.0.pin-16-out
net xenable => parport.0.pin-17-out
# Hook up estop pins
#net estop-ext <= parport.0.pin-10-in-not
setp stepgen.0.position-scale [AXIS_0]SCALE
setp stepgen.0.steplen 1
setp stepgen.0.stepspace 0
setp stepgen.0.dirhold 35000
setp stepgen.0.dirsetup 35000
setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL
net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd
net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb
net xstep <= stepgen.0.step
net xdir <= stepgen.0.dir
net xenable axis.0.amp-enable-out => stepgen.0.enable
setp stepgen.1.position-scale [AXIS_1]SCALE
setp stepgen.1.steplen 1
setp stepgen.1.stepspace 0
setp stepgen.1.dirhold 35000
setp stepgen.1.dirsetup 35000
setp stepgen.1.maxaccel [AXIS_1]STEPGEN_MAXACCEL
net ypos-cmd axis.1.motor-pos-cmd => stepgen.1.position-cmd
net ypos-fb stepgen.1.position-fb => axis.1.motor-pos-fb
net ystep <= stepgen.1.step
net ydir <= stepgen.1.dir
net yenable axis.1.amp-enable-out => stepgen.1.enable
setp stepgen.2.position-scale [AXIS_2]SCALE
setp stepgen.2.steplen 1
setp stepgen.2.stepspace 0
setp stepgen.2.dirhold 35000
setp stepgen.2.dirsetup 35000
setp stepgen.2.maxaccel [AXIS_2]STEPGEN_MAXACCEL
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb
net zstep <= stepgen.2.step
net zdir <= stepgen.2.dir
net zenable axis.2.amp-enable-out => stepgen.2.enable
setp stepgen.3.position-scale [AXIS_3]SCALE
setp stepgen.3.steplen 1
setp stepgen.3.stepspace 0
setp stepgen.3.dirhold 35000
setp stepgen.3.dirsetup 35000
setp stepgen.3.maxaccel [AXIS_3]STEPGEN_MAXACCEL
net apos-cmd axis.3.motor-pos-cmd => stepgen.3.position-cmd
net apos-fb stepgen.3.position-fb => axis.3.motor-pos-fb
net astep <= stepgen.3.step
net adir <= stepgen.3.dir
net aenable axis.3.amp-enable-out => stepgen.3.enable
#net estop-out <= iocontrol.0.user-enable-out
#net estop-ext => iocontrol.0.emc-enable-in
net estop-out => parport.0.pin-01-out
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
Have a look in Halmeter to make sure that aenable is going true when you power on.
(the name doesn't mean anything, by the way, it is totally unrelated to the COORDINATES= line)
For clarity you might want to edit that section to read:
net x2pos-cmd axis.3.motor-pos-cmd => stepgen.3.position-cmd
net x2pos-fb stepgen.3.position-fb => axis.3.motor-pos-fb
net x2step <= stepgen.3.step
net x2dir <= stepgen.3.dir
net x2enable axis.3.amp-enable-out => stepgen.3.enable
But that is purely for human readability, EMC2 doesn't care.
It looks like you have a single amp-enable pin on the Parport, shared between all the drives? That should be fine, as all the axis.N.enables switch together.
(Thinks)
The problem might be that you can't move the X2 motor with the arrow keys. Your system will start up in "Joint Mode" and the extra-X is only joggable by selecting "joint 3" and using + and -.
Once you home the machine you should be able to switch to "World" mode ($ key, I think) and then both X motors should move together.
Please Log in or Create an account to join the conversation.
So I took the normal three axis setup and attempted to morph it into something like the stepper-gantry setup.
The one I'm using now is a variant of something I got from another post on this forum.
If there's a way to make the canned setup work, i'd be happy to use it.
I tried homing each axis and then switched to world mode.
I get a different behavior that is both closer and farther away,
when I try to move in manual mode, I get one step (I think on both motors) and get the errors:
joint 0 following error
command (EMC_TRAJ_SET_TELOP_VECTOR) cannot be executed until the machine is out of estop and turned on.
as for the amp-enables, I'm not reading the output of pin 17
bit TRUE xenable
<== axis.0.amp-enable-out
==> parport.0.pin-17-out
==> stepgen.0.enable
but TRUE aenable
<== axis.3.amp-enable.out
==> stepgen.3.enable
Having found the machine -> show hal configuration, I think I might be able to make some progress on the boxed config.
I've got my fingers crossed.
Please Log in or Create an account to join the conversation.
www.linuxcnc.org/component/option,com_ku...tart,0/lang,english/
At any rate if you have a configuration that was working and you do not need to home the 2 sides of the gantry separately you can just drive both sides with the same signal. Just edit your working configuration.
If you are running steppers with two axis that are the same and you are not going to install separate home or limit switches you can just output the step signals to two sets of parallel port pins. Just use the standard XYZ setup and something like this...
x axis
net xdir => parport.0.pin-04-out
setp parport.0.pin-05-out-invert 1
net xstep => parport.0.pin-05-out
setp parport.0.pin-05-out-reset 1
slave axis
setp parport.0-08-out-invert 1
net xdir => parport.0.pin-08-out
setp parport.0.pin-09-out-invert 1
net xstep => parport.0.pin-09-out
setp parport.0.pin-09-out-reset 1
That should be close but from memory. The one is reversed here because if you had two motors at opposite sides and they both pointed inward a move would be with one clockwise and the other counter clockwise, but it is easy to switch.
Rick G
The above slave axis has the direction signal inverted
Please Log in or Create an account to join the conversation.
John
Please Log in or Create an account to join the conversation.
1) I like the idea of using two limits as a way to square everything up. My limit switches are triggered by some screws that extend from the gantry. I can adjust these to square everything up.
2) (this is less legitimate). Over the time that I've been working on this thing I started with 1/4 20 lead screws. I've converted one side to 1/2 10 acme but haven't gotten to the other side.
Anyway, I have made some progress. First, the main manual mode is "joint" mode. I probably want to disable this mode. given that one axis is driven by two screws, I really don't want to move them independently.
So as I indicated in my last post, I'm also getting some joint following errors. That's helped. I've upped the allowable error. now if I issue an actual G code to move things, the motors do operate together.
But I'm getting some latency type errors. I imagine this is my next real hurdle. running the RTAI latency test actually hangs the system. probably not good. I've turned off the audio driver and I get one of the recommended matrox display cards. (actually gets better resolution than onboard so that's an added bonus for my $14)
It's a learning process. The released configuration could be better commented. maybe I'll do a writeup when everything's working.
Thanks everyone for your help so far. I"m not out of the woods, but I think things are moving forward.
Miles
Please Log in or Create an account to join the conversation.
If you have not so far take a look here...
wiki.linuxcnc.org/emcinfo.pl?TroubleShooting
Are you running 8.04 or 10.04?
Does the system hang with both the on board and the add in display card?
Which video driver are you using?
Did you disable the on board video?
Joint mode may be helpful to square up the gantry.
Glad to hear you are making progress.
Rick G
Please Log in or Create an account to join the conversation.
I am using the mga driver. I don't remember whether I turned up the onboard driver.
I have made some progress however!
when running the latency tests, I noticed that the big jumps in time (to 3M) correlated with disk accesses. I could hear it. I'm running with three HDs. one holds the main system and the other two are RAID'd together. (software raid). To hold everything I care about.
So I copied my emc2 files to the main system drive, shutdown, disconnected the other two and rebooted. Latency is now generally 15k and maxing at 22k. I let it run to half an hour. I was not abusing it, as the directions say but I'm assuming (hoping) that it'll be ok. I don't intend to do other stuff on the machine while stuff is cutting.
So that left me with the joint following error. The instructions say that I may have too high a step speed, so I reduced them. jogging around a bit, everything seems to work now. I haven't done any real testing.
I still need to adjust my base period and try to get a better step speed. Since I'm using a g540, I need 200*10*20 steps per inch (200 for the motor, 10 step microstepping that the gecko does, and 20 TPI on the screw.). 40000 steps/inch. If I set my base period at 30k (given the latency I saw), I should be able to do half that many steps/sec right? I could max out at 40k/15k. inch every 3 sec and 20IPM
Is my math right on that? doesn't seem right.
Miles
Please Log in or Create an account to join the conversation.
With 40,000 steps/inch and 30,000 latency about 30ipm is about max speed.
John
Please Log in or Create an account to join the conversation.