Spindel problems in Gmoccapy
- tecno
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 1850
- Thank you received: 127
02 May 2017 10:28 #92504
by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
# spindle.hal
# holds all stuff related to the spindle control
# First load all needed rel time components
loadrt encoder num_chan=1
loadrt scale count=1
loadrt near count=1
# Next add them to a thread so they are updated periodicaly
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf scale.0 servo-thread
addf near.0 servo-thread
# Set initial pin values if needed
# position scale =
# The scaling for position feedback, position command, and velocity command, in steps per length unit.
# IMHO should be 1.0
setp stepgen.2.position-scale 0.9
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
setp stepgen.2.maxaccel 5000
setp scale.0.gain 60
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
# make needed connections to hardware
net spindle-step stepgen.2.step => parport.0.pin-06-out
net spindle-dir stepgen.2.dir => parport.0.pin-07-out
net spindle-signal parport.0.pin-10-in => encoder.0.phase-Z
net spindle-signal encoder.0.phase-A
# internal hal connections
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable
# encoder velocity is in units per seconds
# we use scale to get it in units per minutes
# in postgui.hal we connect the signal spindle-rpm to the gmoccapy pin
net spindle-rps encoder.0.velocity => scale.0.in
net spindle-rps motion.spindle-speed-in
net spindle-rpm scale.0.out
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-enable motion.spindle-on => stepgen.2.enable
net spindle-cmd-rpm stepgen.2.velocity-cmd <= motion.spindle-speed-out
#Spindle at speed ?
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-comanded near.0.in1
net spindle-rev_per_min near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
# holds all stuff related to the spindle control
# First load all needed rel time components
loadrt encoder num_chan=1
loadrt scale count=1
loadrt near count=1
# Next add them to a thread so they are updated periodicaly
addf encoder.update-counters base-thread
addf encoder.capture-position servo-thread
addf scale.0 servo-thread
addf near.0 servo-thread
# Set initial pin values if needed
# position scale =
# The scaling for position feedback, position command, and velocity command, in steps per length unit.
# IMHO should be 1.0
setp stepgen.2.position-scale 0.9
setp stepgen.2.steplen 5000
setp stepgen.2.stepspace 5000
setp stepgen.2.maxaccel 5000
setp scale.0.gain 60
setp encoder.0.position-scale 1
setp encoder.0.counter-mode 1
# make needed connections to hardware
net spindle-step stepgen.2.step => parport.0.pin-06-out
net spindle-dir stepgen.2.dir => parport.0.pin-07-out
net spindle-signal parport.0.pin-10-in => encoder.0.phase-Z
net spindle-signal encoder.0.phase-A
# internal hal connections
net spindle-index-enable motion.spindle-index-enable <=> encoder.0.index-enable
# encoder velocity is in units per seconds
# we use scale to get it in units per minutes
# in postgui.hal we connect the signal spindle-rpm to the gmoccapy pin
net spindle-rps encoder.0.velocity => scale.0.in
net spindle-rps motion.spindle-speed-in
net spindle-rpm scale.0.out
net spindle-position encoder.0.position => motion.spindle-revs
net spindle-enable motion.spindle-on => stepgen.2.enable
net spindle-cmd-rpm stepgen.2.velocity-cmd <= motion.spindle-speed-out
#Spindle at speed ?
setp near.0.scale 1.2
setp near.0.difference 10
net spindle-comanded near.0.in1
net spindle-rev_per_min near.0.in2
net spindle-at-speed near.0.out => motion.spindle-at-speed
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
Less
More
- Posts: 23315
- Thank you received: 4944
02 May 2017 10:35 #92506
by andypugh
Replied by andypugh on topic Spindel problems in Gmoccapy
Try stepgen.2.position scale -0.9 instead of the current +0.9
That is the quickest and easiest way to do it (you might also need to switch the sign of the encoder scale to get the velocity and position counts right)
That is the quickest and easiest way to do it (you might also need to switch the sign of the encoder scale to get the velocity and position counts right)
The following user(s) said Thank You: tecno
Please Log in or Create an account to join the conversation.
- tecno
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 1850
- Thank you received: 127
02 May 2017 10:43 #92507
by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
THANK YOU
Please Log in or Create an account to join the conversation.
- tecno
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 1850
- Thank you received: 127
02 May 2017 10:44 #92508
by tecno
Replied by tecno on topic Spindel problems in Gmoccapy
Now I will have to find Post-processor for Partmaster and Fusion 360
Please Log in or Create an account to join the conversation.
Moderators: newbynobi, HansU
Time to create page: 0.069 seconds