Download Lube component

More
1 year 11 months ago #314677 by Aciera
Replied by Aciera on topic Download Lube component
War mehr als Einstieg gedacht zum Anpassen. Fertiglösung zum Einkopieren hab ich nicht zur Hand.

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

More
1 year 11 months ago #314680 by Steffen
Replied by Steffen on topic Download Lube component
Danke Dir, ich muss mich damit beschäftigen, ich kapier es nicht.

Habe jetzt vorerst mal einen custom M Code gemacht, den ich an den Anfang oder ans Ende des Programms setzte, der 2 Sek. einen Schmierimpuls auslöst.

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

More
1 year 11 months ago - 1 year 11 months ago #314737 by Aciera
Replied by Aciera on topic Download Lube component
Versuchs mal mit dieser python Komponente.

1. Code unten als 'interval.py' im gleichen Ordner wie deine .ini Datei abspeichern und als Ausführbare Datei markieren.

Code:
#!/usr/bin/env python3 import time import hal h = hal.component("interval") h.newpin("enable", hal.HAL_BIT, hal.HAL_IN) # HIGH enables the interval timer h.newpin("reset", hal.HAL_BIT, hal.HAL_IN) # On change LOW->HIGH restarts the interval h.newpin("start-with-pulse", hal.HAL_BIT, hal.HAL_IN) # If TRUE the interval starts with a pulse h.newpin("out", hal.HAL_BIT, hal.HAL_OUT) # Output of the the interval timer, LOW if 'enable' is LOW h.newpin("delay-time", hal.HAL_FLOAT, hal.HAL_IN) # Interval low time in milliseconds h.newpin("pulse-time", hal.HAL_FLOAT, hal.HAL_IN) # Interval high time in milliseconds h.newpin("time-elapsed", hal.HAL_FLOAT, hal.HAL_OUT) # Elapsed low/high time in milliseconds h.ready() running = False reset = False try:     while 1:         if h['enable']:             delay_time = h['delay-time']             pulse_time = h['pulse-time']             if not h['reset']: reset = False             if h['reset'] and not reset:                 running = False                 reset = True             if not running:                 timer = round(time.time()*1000)                 running = True                 h['out'] = h['start-with-pulse']             else:                 h['time-elapsed'] = round(time.time()*1000) - timer             if not h['out'] and round(time.time()*1000) >= timer + delay_time:                 h['out'] = True                 timer = round(time.time()*1000)             if h['out'] and round(time.time()*1000)  >= timer + pulse_time:                 h['out'] = False                 timer = round(time.time()*1000)         else:             h['out'] = False             h['time-elapsed'] = 0             running = False except KeyboardInterrupt:     raise SystemExit


2. in der ini unter [HAL] diese Zeilen hinzfügen.


Code:
HALCMD = loadusr -W ./interval.py HALCMD = setp interval.delay-time 2000 HALCMD = setp interval.pulse-time 500

3. das 'Show HalConfiguration' tool öffnen, im linken Teil die 'interval' Komponente suchen und im 'Watch' tab die pins anzeigen. Dann 'interval.enable' auf True setzen und der Timer sollte laufen. :

 
Last edit: 1 year 11 months ago by Aciera. Reason: Add more functionality to the component
The following user(s) said Thank You: Steffen

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

More
1 year 11 months ago - 1 year 11 months ago #314805 by Steffen
Replied by Steffen on topic Download Lube component
Ich komm leider auch damit nicht weiter, bei usr/bin/env kommt Verzeichnis nicht gefunden, wenn ich das env wegmache kommt permission denied. 

Ich hab zwei System, richtig arbeiten tut LinuxCNC 2.81, auf einem Raspberry Pi zum Testen hab ich auch 2.93 auf einem zweiten RPI installiert, die Fehler oben kommen vom dem 2.93 System, auf 2.81 passiert garnichts, vermutlich wegen alter Python Version.

Kann es auch ein grundsätzliches Problem an der RPI Installation sein?

Danke
Grüsse
Steffen
Last edit: 1 year 11 months ago by Steffen.

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

More
1 year 11 months ago #314827 by Aciera
Replied by Aciera on topic Download Lube component
1.

"python3\r": Datei oder Verzeichnis nicht gefunden


Das deutet auf Windows-Textformatierung. Verwendest du Windows um den Text zu kopieren?

2.

execv(./interval.py): Permission denied

Deutet darauf hin, dass du die Datei 'interval.py' nicht zum Ausführen freigegeben hast.
The following user(s) said Thank You: Steffen

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

More
1 year 11 months ago #314855 by Steffen
Replied by Steffen on topic Download Lube component
Punkt 1 war es, hab das alles mit Windows kopiert, LCNC hängt nicht am Internet.

Jetzt funktioniert es und müsste noch mit dem Ausgangspin für die Zentralschmierung verknüpft werden?
Die Komponente muss auch von Hand gestartet werden, liesse sich das mit dem Start von LCNC automatisch starten?

Grüsse
Steffen

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

Moderators: Muecke
Time to create page: 0.097 seconds
Powered by Kunena Forum