HAL M19 Orient dont work

More
12 Mar 2023 17:16 #266503 by Stefan321
Hello,

so I have the problem that despite the example I always get the error that "the command is not known" with net orient-angle. I changed this in the ini: [RS274NGC] PARAMETER_FILE = linuxcnc.var ORIENT_OFFSET = 0 but the focus is more in the hal.


Here is the most important thing from my hal, the whole thing is from talla83, it somehow doesn’t work properly for me. I've tried other things with no success.

The spindle is a servo spindle with step and dir, encoder signals are also there and I take the index via an npn sensor.

loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config="num_encoders=5 num_pwmgens=1 num_stepgens=9 sserial_port_0=3xxxxx" 
setp    [HMOT](CARD0).pwmgen.pwm_frequency 20000
setp    [HMOT](CARD0).pwmgen.pdm_frequency 6000000
setp    [HMOT](CARD0).watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,spindle-pid 
loadrt near      names=spindle-at-speed,spindle-at-pos
#loadrt near

addf [HMOT](CARD0).read          servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
#addf pid.s.do-pid-calcs       servo-thread
#addf near.0                   servo-thread
addf [HMOT](CARD0).write         servo-thread




#*******************
#  SPINDLE 

# ---Encoder feedback signals/setup---

setp    [HMOT](CARD0).encoder.04.counter-mode 0
setp    [HMOT](CARD0).encoder.04.filter 1
setp    [HMOT](CARD0).encoder.04.index-invert 0
setp    [HMOT](CARD0).encoder.04.index-mask 0
setp    [HMOT](CARD0).encoder.04.index-mask-invert 0
setp    [HMOT](CARD0).encoder.04.scale [SPINDLE_0]ENCODER_SCALE

# Step Gen signals/setup

setp   [HMOT](CARD0).stepgen.04.dirsetup        [SPINDLE_0]DIRSETUP
setp   [HMOT](CARD0).stepgen.04.dirhold         [SPINDLE_0]DIRHOLD
setp   [HMOT](CARD0).stepgen.04.steplen         [SPINDLE_0]STEPLEN
setp   [HMOT](CARD0).stepgen.04.stepspace       [SPINDLE_0]STEPSPACE
setp   [HMOT](CARD0).stepgen.04.position-scale  [SPINDLE_0]OUTPUT_SCALE
setp   [HMOT](CARD0).stepgen.04.step_type        0
setp   [HMOT](CARD0).stepgen.04.control-type     1
setp   [HMOT](CARD0).stepgen.04.maxaccel        [SPINDLE_0]STEPGEN_MAXACCEL
setp   [HMOT](CARD0).stepgen.04.maxvel          [SPINDLE_0]STEPGEN_MAXVEL

# ---setup spindle control signals---    

loadrt limit2    names=spindle-ramp            
#loadrt near      names=spindle-at-speed,spindle-at-pos
loadrt timedelay names=spindle-active-delay    
loadrt orient      names=spindle-orient
#loadrt pid      names=spindle-pid 
loadrt mux2     names=spindle-pwm-switch
loadrt or2       count=0
loadrt not     count=0
loadrt and2     count=0
loadrt offset     count=0

    
addf spindle-ramp             servo-thread            
addf spindle-at-speed         servo-thread
addf spindle-at-pos         servo-thread
addf spindle-active-delay    servo-thread
addf spindle-orient           servo-thread
addf spindle-pid.do-pid-calcs    servo-thread
addf spindle-pwm-switch      servo-thread
addf or2.0             servo-thread
addf not.0             servo-thread    
addf and2.0             servo-thread
addf offset.0.update-output    servo-thread

    
setp   spindle-pid.Pgain     [SPINDLE_0]P
setp   spindle-pid.Igain     [SPINDLE_0]I
setp   spindle-pid.Dgain     [SPINDLE_0]D
setp   spindle-pid.bias      [SPINDLE_0]BIAS
setp   spindle-pid.FF0       [SPINDLE_0]FF0
setp   spindle-pid.FF1       [SPINDLE_0]FF1
setp   spindle-pid.FF2       [SPINDLE_0]FF2
setp   spindle-pid.deadband  [SPINDLE_0]DEADBAND
setp   spindle-pid.maxoutput [SPINDLE_0]MAX_OUTPUT
setp   spindle-pid.error-previous-target true

setp   spindle-ramp.maxv         [SPINDLE_0]ACCELERATION         
setp   spindle-at-speed.difference     [SPINDLE_0]MAX_ERROR
setp   spindle-at-pos.difference     0.01
setp   spindle-at-pos.in1        0    
setp   spindle-active-delay.on-delay     0
setp   spindle-active-delay.off-delay    [SPINDLE_0]OFF_DELAY    

# ---Setup spindle at speed signals---

# orient mit motion verknuepfen
net orient-angle     motion.spindle-orient-angle => spindle-orient.angle
net orient-mode     motion.spindle-orient-mode  => spindle-orient.mode      
net orient-enable     motion.spindle-orient       => => and2.0.in1     

# Position vom Encoder in den pid / orient und motion schieben   
net spindle-pos        => spindle-pid.feedback     => spindle-orient.position
net spindle-pos            <= motion.spindle-revs      <= [HMOT](CARD0).encoder.04.position

# Encodergeschwindigkeit U/sek in den near und motion schieben 
net spindle-fb-rps     motion.spindle-speed-in     <= [HMOT](CARD0).encoder.04.velocity   => spindle-at-speed.in2

# Positionsvorgabe vom orient in den pid schieben
setp offset.0.offset 1
net spindle.otient-cmd  spindle-orient.command      => offset.0.in
net spindle-orient-cmd1  offset.0.out     => spindle-pid.command

# Drehzahlvorgabe U/min aus motion in das limit2 schieben
net spindle-speed-rpm   motion.spindle-speed-out     => spindle-ramp.in

# Drehzahlvorgabe U/sek aus motion in das near schieben
net spindle-speed-rps   motion.spindle-speed-out-rps => spindle-at-speed.in1 

# Wenn Solldrehzahl gleich Istdrehzahl dann aus near das bit in motion schieben
net spindle-at-speed    spindle-at-speed.out         => motion.spindle-at-speed 

# Wenn Sollpositon gleich Istpositon dann aus near das bit in motion schieben
net spindle-pos-err     spindle-at-pos.in2          <= spindle-pid.error    
net spindle-at-pos      spindle-at-pos.out           =>                 
net spindle-on0      motion.spindle-on            => spindle-active-delay.in
net spindel-on1         spindle-active-delay.out     => or2.0.in0   => not.0.in 
net spindel-on2         and2.0.in0                   <= not.0.out
  
# orient und pid aktivieren
net orient-active       and2.0.out => or2.0.in1 => spindle-pwm-switch.sel 
net orient-active       => spindle-pid.enable   => spindle-orient.enable 
net spindle-enable      or2.0.out             => [HMOT](CARD0).stepgen.04.enable 

# motion gibt Signal an Encoder das beim naechsten Z Signal auf 0 gestellt werden soll
net  spindle-sync         motion.spindle-index-enable  => [HMOT](CARD0).encoder.04.index-enable    
sets spindle-sync     1

# pwm Signal entweder vom motion oder orient
net pwm-switch-in0   spindle-pwm-switch.in0         <= spindle-ramp.out  
net pwm-switch-in1   spindle-pwm-switch.in1         <= spindle-pid.output
net pwm-switch-out   spindle-pwm-switch.out         => [HMOT](CARD0).stepgen.04.velocity-cmd

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 10:11 #266539 by jpg
Replied by jpg on topic HAL M19 Orient dont work
"addf orient.0 servo-thread" ?

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 14:33 #266556 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
Thanks for the help but it still doesn't work, I still get errors when starting linuxcnc.
added with: addf failed
without : pin motion.spindle-orient-angle does not exist

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 15:11 - 13 Mar 2023 15:15 #266557 by PCW
Replied by PCW on topic HAL M19 Orient dont work
addf spindle-orient servo-thread

(it would be "addf orient.0 servo-thread" if not named in the loadrt line)
Last edit: 13 Mar 2023 15:15 by PCW.

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 15:37 - 13 Mar 2023 15:48 #266560 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
Thanks for the help when I do addf orient.0 I have to do loadrt orient.0 first and then I get the following 3 errors.

waitpif failed /usr/bin/rtapi_app orient.0
/user/bin/rtapi_app exited without becoming ready
insmod for orient.0 failed, reurned -1

if you have a working script i would exchange it too i only do it for positioning for the tool changer. Unfortunately, I'm very bad at programming and don't know much about it. I've already looked at some. also the wiki entry for orient So if I do it the way it should be, I always get: pin motion.spindle-orient-angle does not exist
Last edit: 13 Mar 2023 15:48 by Stefan321.

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 16:44 - 13 Mar 2023 16:49 #266571 by PCW
Replied by PCW on topic HAL M19 Orient dont work
You would never "addf orient.0 servo-thread" because that's the incorrect function name

if you:
loadrt orient count=1
 then:
addf orient.0 servo-thread
makes sense

but if you look at your hal file, it does:
loadrt orient names=spindle-orient
then the addf must use the correct function name:
addf spindle-orient servo-thread
 
Last edit: 13 Mar 2023 16:49 by PCW.

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 17:34 #266576 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
According to your statement it should work but it doesn't work, I have to do something else, I have in the ini: [RS274NGC]
PARAMETER_FILE = linuxcnc.var
ORIENT_OFFSET = 0 entered. and my spindle is equipped with additional things such as off_delay. but i always get "pin motion.spindle-orient-angle does not exist" when i hide this sentence in the hal gives me the next line. that this does not exist

Please Log in or Create an account to join the conversation.

More
13 Mar 2023 18:31 #266583 by PCW
Replied by PCW on topic HAL M19 Orient dont work
It does work (verified here)

You likely have the wrong name for spindle orient angle

(probably should be spindle.0.orient-angle with current LinuxCNC)

I would suggest you not guess at pin names and instead list them by:

1. Remove all hal lines that cause an error
2. Launch LinuxCNC
3. Run halcmd -kf
4. Issue a command like "show pin spindle"

Please Log in or Create an account to join the conversation.

More
14 Mar 2023 11:03 - 14 Mar 2023 11:09 #266650 by 0x2102
Replied by 0x2102 on topic HAL M19 Orient dont work
I don't remember all the details (has been a while) but I looked at my config and it is as PCW said:

Talla's org. config is for LinuxCNC 2.7. Since then PIN names have changed and you need to update your HAL. 

Replace "motion.spindle...." with "spindle.0." Check for correct PIN names. 

# orient mit motion verknuepfen
net orient-angle motion.spindle-orient-angle => spindle-orient.angle
net orient-mode motion.spindle-orient-mode => spindle-orient.mode
net orient-enable motion.spindle-orient => => and2.0.in1

should be
# orient mit motion verknuepfen
net orient-angle spindle.0.orient-angle => orient.spindle.angle
net orient-mode spindle.0.orient-mode => orient.spindle.mode
net orient-enable spindle.0.orient => and2.0.in1

Exclude the lines with an error in your HAL with a "#" in front until you can load LinuxCNC and then verify your PINs exist and fix the connections. 
Last edit: 14 Mar 2023 11:09 by 0x2102.

Please Log in or Create an account to join the conversation.

More
14 Mar 2023 12:15 #266655 by Stefan321
Replied by Stefan321 on topic HAL M19 Orient dont work
Thanks for all the help, so I was able to find the spindle pin but I still have an error, when I do "show pin motion" I don't see a motion.angle pin that is missing. and that's my fault. The other motion pins that I need are also missing, somewhere the worm is stuck.

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum