- Posts: 476
- Thank you received: 52
Orient component revised
6 years 9 months ago #155724
by alkabal
Replied by alkabal on topic Orient component
Thanks lol
Did you think i better to speak about this over github ?
Br
Did you think i better to speak about this over github ?
Br
Please Log in or Create an account to join the conversation.
- tommylight
-
- Offline
- Moderator
-
6 years 9 months ago #155748
by tommylight
Replied by tommylight on topic Orient component
You can speak here, that is OK, but you might have to wait till Andy gets to read this as he is the original programmer of the orient component.
Please Log in or Create an account to join the conversation.
6 years 9 months ago #156276
by nkp
Replied by nkp on topic Orient component
Do you use shome ?
(spindle home)
(spindle home)
Please Log in or Create an account to join the conversation.
6 years 9 months ago - 6 years 9 months ago #156282
by alkabal
Replied by alkabal on topic Orient component
Hi
Not for now but i already have think about that and i does not found a correct way for include this to the component, because IMH the "motion system" need to know what append.
I'm not sure if this can do after machine homing or at first tool change ? (i don't play with orient for ATC)
IMO the best way is something like call a MDI_COMMAND G33 from component when machine is homed like Andy suggest in other forum topic or add some logic to the homing sequence.
Br
Not for now but i already have think about that and i does not found a correct way for include this to the component, because IMH the "motion system" need to know what append.
I'm not sure if this can do after machine homing or at first tool change ? (i don't play with orient for ATC)
IMO the best way is something like call a MDI_COMMAND G33 from component when machine is homed like Andy suggest in other forum topic or add some logic to the homing sequence.
Br
Last edit: 6 years 9 months ago by alkabal.
Please Log in or Create an account to join the conversation.
6 years 9 months ago #156286
by nkp
Replied by nkp on topic Orient component
Code:
/* sudo halcompile --install shome.comp */
component shome "Provides a PID command input used for spindle homing";
pin out bit homing ;
pin out bit homed ;
pin in bit enable ;
pin io bit index_enable ;
pin out float command ;
pin in float velocity = 100 ;
variable int last_enable = 0;
option fp yes;
function _ "Spindle homing helper. Sets the encoder index-enable and waits for the falling of this signal.";
author "Diego Weizel";
description "";
license "GPL";
;;
FUNCTION(_) {
if (enable) {
if (enable ^ last_enable) { // positive edge on enable
homed = 0;
homing = 1;
index_enable=1;
command=velocity;
}
if (homing && !index_enable) { // falling edge on enable
homed = 1;
homing = 0;
command=0;
}
}
else
{
homed = 0;
homing = 0;
command=0;
}
last_enable = enable;
}
Please Log in or Create an account to join the conversation.
6 years 9 months ago - 6 years 9 months ago #156287
by nkp
Replied by nkp on topic Orient component
Code:
loadrt orient
addf orient.0 servo-thread
loadrt mux2 count=2
addf mux2.0 servo-thread
addf mux2.1 servo-thread
loadrt shome
addf shome.0 servo-thread
loadrt near count=2
addf near.0 servo-thread
addf near.1 servo-thread
loadrt not count=1
addf not.0 servo-thread
# reley 5
setp near.1.in1 0.0
net spindle-cmd near.1.in2
net reley-5 near.1.out not.0.in
net reley not.0.out hm2_7i92.0.7i77.0.0.output-01
#-spindle-at-speed
net spindle-vel-cmd => near.0.in1
net spindle-vel => near.0.in2
# 10%
setp near.0.scale 1.1
loadrt or2 count=2
addf or2.0 servo-thread #
addf or2.1 servo-thread
net or2-0-in0 or2.0.in0 <= near.0.out
net orient-mode or2.0.in1
#net spindle-at-speed motion.spindle-at-speed or2.0.out
setp motion.spindle-at-speed 1
# encoder feedback
setp hm2_7i92.0.encoder.05.counter-mode 0
setp hm2_7i92.0.encoder.05.filter 1
setp hm2_7i92.0.encoder.05.index-invert 0
setp hm2_7i92.0.encoder.05.index-mask 0
setp hm2_7i92.0.encoder.05.index-mask-invert 0
setp hm2_7i92.0.encoder.05.scale 4096
# spindle HOME
net spindle-index shome.0.index-enable hm2_7i92.0.encoder.05.index-enable
# PWM Generator signals/setup
setp hm2_7i92.0.7i77.0.1.analogout5-scalemax 1500
setp hm2_7i92.0.7i77.0.1.analogout5-minlim -1500
setp hm2_7i92.0.7i77.0.1.analogout5-maxlim 1500
# spindle enable
setp hm2_7i92.0.7i77.0.1.spinena 1
##################################################
#loadrt pid (main.hal)
addf pid.vel.do-pid-calcs servo-thread # Velocity
addf pid.pos.do-pid-calcs servo-thread # Position
net spindle-pos pid.pos.feedback orient.0.position
net shome-enable0 axis.2.homed classicladder.0.in-00
net shome-enable1 shome.0.enable classicladder.0.out-00
net mux1in0 mux2.1.in0 pid.vel.output
net mux1in1 mux2.1.in1 shome.0.command
net mux1sel mux2.1.sel shome.0.homing
setp shome.0.velocity -3
net spindle-vel pid.vel.feedback hm2_7i92.0.encoder.05.velocity
net spindle-vel-cmd motion.spindle-speed-out pid.vel.command
net spindle-vel-pid mux2.1.out mux2.0.in0
net spindle-pos pid.pos.feedback orient.0.position hm2_7i92.0.encoder.05.position
net spindle-pos-cmd orient.0.command pid.pos.command
net spindle-angle motion.spindle-orient-angle orient.0.angle
net spindle-pos-pid pid.pos.output mux2.0.in1
# this switches modes
net orient-mode motion.spindle-orient orient.0.enable pid.pos.enable mux2.0.sel
net velocity-mode motion.spindle-on pid.vel.enable
setp scale.0.gain -1
##+++++++++++
loadrt limit2
addf limit2.0 servo-thread
setp limit2.0.maxv 1000
net spindle-cmd mux2.0.out => scale.0.in
net scaleout scale.0.out hm2_7i92.0.7i77.0.1.analogout5
#net spindle-ramped <= limit2.0.out => hm2_7i92.0.7i77.0.1.analogout5
# Tune the PID from the INI values
setp pid.vel.Pgain [SPINDLE]PGAIN_V
setp pid.vel.Igain [SPINDLE]IGAIN_V
setp pid.vel.Dgain [SPINDLE]DGAIN_V
setp pid.vel.FF0 [SPINDLE]FF0_V
setp pid.vel.FF1 [SPINDLE]FF1_V
setp pid.pos.Pgain [SPINDLE]PGAIN_P
setp pid.pos.Igain [SPINDLE]IGAIN_P
setp pid.pos.Dgain [SPINDLE]DGAIN_P
setp pid.pos.FF0 [SPINDLE]FF0_P
setp pid.pos.FF1 [SPINDLE]FF1_P
Last edit: 6 years 9 months ago by nkp.
Please Log in or Create an account to join the conversation.
Time to create page: 0.140 seconds