1. Halcmd

halcmd is a command line tool for manipulating the HAL. There is a rather complete man page for halcmd, which will be installed if you have installed LinuxCNC from either source or a package. The manpage provides usage info:

man halcmd

Wenn Sie LinuxCNC für "run-in-place" kompiliert haben, müssen Sie das rip-environment Skript als Quelle angeben, um die Manpage verfügbar zu machen:

cd toplevel_directory_for_rip_build
. scripts/rip-environment
man halcmd

Das HAL Tutorial enthält eine Reihe von Beispielen für die Verwendung von halcmd und ist ein gutes Tutorial für halcmd.

2. Halmeter

Halmeter is a voltmeter for the HAL. It lets you look at a pin, signal, or parameter, and displays the current value of that item. It is pretty simple to use. Start it by typing halmeter in an X windows shell. Halmeter is a GUI application. It will pop up a small window, with two buttons labeled "Select" and "Exit". Exit is easy - it shuts down the program. Select pops up a larger window, with three tabs. One tab lists all the pins currently defined in the HAL. The next lists all the signals, and the last tab lists all the parameters. Click on a tab, then click on a pin/signal/parameter. Then click on "OK". The lists will disappear, and the small window will display the name and value of the selected item. The display is updated approximately 10 times per second. If you click "Accept" instead of "OK", the small window will display the name and value of the selected item, but the large window will remain on the screen. This is convenient if you want to look at a number of different items quickly.

You can have many halmeters running at the same time, if you want to monitor several items. If you want to launch a halmeter without tying up a shell window, type halmeter & to run it in the background. You can also make halmeter start displaying a specific item immediately, by adding pin|sig|par[am] _<name>_ to the command line. It will display the pin, signal, or parameter <name> as soon as it starts - if there is no such item, it will simply start normally. And finally, if you specify an item to display, you can add -s before the pin|sig|param to tell halmeter to use a small window. The item name will be displayed in the title bar instead of under the value, and there will be no buttons. Useful when you want a lot of meters in a small amount of screen space.

Weitere Informationen finden Sie im Abschnitt Halmeter Tutorial.

halmeter can be loaded from a terminal or from AXIS. halmeter is faster than halshow at displaying values. halmeter has two windows, one to pick the pin, signal, or parameter to monitor and one that displays the value. Multiple ``halmeter``s can be open at the same time. If you use a script to open multiple ``halmeter``s you can set the position of each one with -g X Y relative to the upper left corner of your screen. For example:

loadusr halmeter pin hm2.0.stepgen.00.velocity-fb -g 0 500

Siehe die Manpage für weitere Optionen und den Abschnitt Halmeter.

Halmeter-Auswahlfenster
Abbildung 1. Halmeter-Auswahlfenster
Halmeter-Watch Fenster
Abbildung 2. Halmeter-Watch Fenster

3. Halshow

halshow (complete usage description) can be started from the command line to show details for selected components, pins, parameters, signals, functions, and threads of a running HAL. The WATCH tab provides a continuous display of selected pin, parameters, and signal items. The File menu provides buttons to save the watch items to a watch list and to load an existing watch list. The watch list items can also be loaded automatically on startup. For command line usage:

halshow --help
Usage:
  halshow [Options] [watchfile]
  Options:
           --help    (this help)
           --fformat format_string_for_float
           --iformat format_string_for_int

Hinweise:
       Erstellen Sie einen watchfile in halshow mit: 'File/Save Watch List'.
       LinuxCNC muss für die Standalone-Nutzung ausgeführt werden.
Halshow Watch Tab
Abbildung 3. Halshow Watch Tab

A watchfile created using the File/Save Watch List menu item is formatted as a single line with tokens "pin+", "param+", "sig=+", followed by the appropriate pin, param, or signal name. The token-name pairs are separated by a space character.

Einzeiliges Watchfile-Beispiel
pin+joint.0.pos-hard-limit pin+joint.1.pos-hard-limit sig+estop-loop

Eine Überwachungsdatei, die mit dem Menüpunkt Datei/Beobachtungsliste speichern (mehrzeilig) erstellt wurde, wird mit separaten Zeilen für jedes Element formatiert, das wie oben beschrieben mit Token-Name-Paaren identifiziert wird.

Beispiel für eine Watchfile mit getrennten Zeilen
pin+joint.0.pos-hard-limit
pin+joint.1.pos-hard-limit
sig+estop-loop

Beim Laden einer Watchfile mit dem Menüpunkt File/Load Watch List können die Token-Namen-Paare als einzelne oder mehrere Zeilen erscheinen. Leerzeilen und Zeilen, die mit einem #-Zeichen beginnen, werden ignoriert.

4. Halscope

Halscope is an oscilloscope for the HAL. It lets you capture the value of pins, signals, and parameters as a function of time. Complete operating instructions should be located here eventually. For now, refer to section Halscope in the tutorial chapter, which explains the basics.

The halscope "File" menu selector provides buttons to save a configuration or open a previously saved configuration. When halscope is terminated, the last configuration is saved in a file named autosave.halscope.

Configuration files may also be specified when starting halscope from the commandline. Commandline help (-h) usage:

halscope -h
Usage:
  halscope [-h] [-i infile] [-o outfile] [num_samples]

5. Sim-Pin

sim_pin ist ein Kommandozeilenprogramm zur Anzeige und Aktualisierung einer beliebigen Anzahl von beschreibbaren Pins, Parametern oder Signalen.

sim_pin Usage
Usage:
        sim_pin [Options] name1 [name2 ...] &

Options:
        --help                (this text)
        --title title_string  (window title, default: sim_pin)

Note:  LinuxCNC (or a standalone HAL application) must be running
        A named item can specify a pin, param, or signal
        The item must be writable, e.g.:
          pin:    IN or I/O (and not connected to a signal with a writer)
          param:  RW
          signal: connected to a writable pin

        HAL item types bit,s32,u32,float are supported.

        When a bit item is specified, a pushbutton is created
        to manage the item in one of three manners specified
        by radio buttons:
            toggle: Toggle value when button pressed
            pulse:  Pulse item to 1 once when button pressed
            hold:   Set to 1 while button pressed
        The bit pushbutton mode can be specified on the command
        line by formatting the item name:
            namei/mode=[toggle | pulse | hold]
        If the mode begins with an uppercase letter, the radio
        buttons for selecting other modes are not shown

Vollständige Informationen finden Sie in der Manpage:

man sim_pin
sim_pin Example (with LinuxCNC running)
halcmd loadrt mux2 names=example; halcmd net sig_example example.in0
sim_pin example.sel example.in1 sig_example &
sim_pin Fenster
Abbildung 4. sim_pin Fenster

6. simulate_probe (Sonde simulieren)

simulate_probe ist ein einfaches GUI, um die Aktivierung des Pins motion.probe-input zu simulieren. Verwendung:

simulate_probe &
simulieren_probe Fenster
Abbildung 5. simulieren_probe Fenster

7. HAL Histogramm

hal-histogram ist ein Kommandozeilenprogramm zur Anzeige von Histogrammen für HAL-Pins.

Nutzung:
   hal-histogram --help | -?
or
   hal-histogram [Optionen] [Pinname]
Tabelle 1. Optionen:
Option Wert Beschreibung

--minvalue

minvalue

minimum bin, Voreinstellung: 0

--binsize

binsize

binsize, Voreinstellung: 100

--nbins

nbins

Anzahl der Bins, Standard: 50

--logscale

0/1

y-Achse logarithmische Skala, Voreintellung: 1

--text

Hinweis

Textanzeige, Standard: ""

-show

Anzahl der nicht angezeigten nbins anzeigen, Voreinstellung aus

--verbose

Fortschritt und Fehlersuche, standardmäßig aus

Anmerkungen:
  1. LinuxCNC (oder eine andere HAL-Anwendung) muss laufen.

  2. If no pinname is specified, default is: motion-command-handler.time.

  3. Diese App kann für 5 Pins geöffnet werden.

  4. Unterstützt werden die Pintypen float, s32, u32, bit.

  5. The pin must be associated with a thread supporting floating point. For a base thread, this may require using loadrt motmod ... base_thread_fp=1 .

hal-histogram Fenster
Abbildung 6. hal-histogram Fenster

8. Halreport

halreport ist ein Befehlszeilen-Dienstprogramm, das einen Bericht über HAL-Verbindungen für eine laufende LinuxCNC (oder andere HAL) Anwendung erzeugt. Der Bericht zeigt alle Signalverbindungen an und weist auf mögliche Probleme hin. Enthaltene Informationen:

  1. Systembeschreibung und Kernelversion.

  2. Signale und alle angeschlossenen Ausgangs-, E/A- und Eingangspins.

  3. Eines jeden Pin component_function, thread und addf-Reihenfolge.

  4. Non-realtime component pins having non-ordered functions.

  5. Identifizierung von unbekannten Funktionen für nicht behandelte Komponenten.

  6. Signals with no output.

  7. Signals with no inputs.

  8. Functions with no addf.

  9. Warning tags for components marked as deprecated/obsolete in docs.

  10. Real names for pins that use alias names.

Der Bericht kann über die Befehlszeile erstellt und in eine Ausgabedatei (oder stdout, wenn kein Ausgabedateiname angegeben ist) geleitet werden:

halreport Usage
Usage:
  halreport -h | --help (this help)
or
  halreport [outfilename]

Um den Bericht für jeden LinuxCNC-Start zu erzeugen, fügen Sie halreport und einen Ausgabedateinamen als [APPLICATIONS]APP-Eintrag in die INI-Datei ein.

halreport Example
[APPLICATIONS]
APP = halreport /tmp/halreport.txt

Die Reihenfolge, in der die Funktionen addiert werden, kann für Servoschleifen wichtig sein, bei denen die Reihenfolge der in jeder Servoperiode berechneten Funktionen wichtig ist. Typischerweise ist die Reihenfolge:

  1. Read input pins,

  2. die Funktionen für die Bewegungssteuerung und die Bewegungssteuerung ausführen,

  3. PID-Berechnungen durchführen und schließlich

  4. Ausgabepins schreiben.

Für jedes Signal in einem kritischen Pfad sollte die addf-Ordnung des Ausgangspins numerisch niedriger sein als die addf-Ordnung der kritischen Eingangspins, mit denen es verbunden ist.

For routine signal paths that handle switch inputs, non-realtime pins, etc., the addf-ordering is often not critical. Moreover, the timing of non-realtime pin value changes cannot be controlled or guaranteed at the intervals typically employed for HAL threads.

Example report file excerpts showing a pid loop for a hostmot2 stepgen operated in velocity mode on a trivkins machine with joint.0 corresponding to the X axis coordinate:

SIG:    pos-fb-0
  OUT:    h.00.position-fb                     hm2_7i92.0.read        servo-thread 001
          (=hm2_7i92.0.stepgen.00.position-fb)
    IN:     X_pid.feedback                     X_pid.do-pid-calcs     servo-thread 004
    IN:     joint.0.motor-pos-fb               motion-command-handler servo-thread 002
            ....................               motion-controller      servo-thread 003
...
SIG:    pos-cmd-0
  OUT:    joint.0.motor-pos-cmd                motion-command-handler servo-thread 002
          .....................                motion-controller      servo-thread 003
    IN:     X_pid.command                      X_pid.do-pid-calcs     servo-thread 004
...
SIG:    motor-cmd-0
  OUT:    X_pid.output                         X_pid.do-pid-calcs     servo-thread 004
    IN:     h.00.velocity-cmd                  hm2_7i92.0.write       servo-thread 008
            (=hm2_7i92.0.stepgen.00.velocity-cmd)

Im obigen Beispiel verwendet die HALFILE halcmd-Aliase, um die Pin-Namen für ein hostmot2-FPGA-Board mit Befehlen wie diesen zu vereinfachen:

alias pin hm2_7i92.0.stepgen.00.position-fb h.00.position-fb
Anmerkung

Eine fragwürdige Erkennung von Komponentenfunktionen kann auftreten bei

  1. nicht unterstützte (veraltete) Komponenten,

  2. vom Benutzer erstellte Komponenten, die mehrere Funktionen oder unkonventionelle Funktionsbezeichnungen verwenden, oder

  3. GUI-created non-realtime components that lack distinguishing characteristics such as a prefix based on the GUI program name.

Fragwürdige Funktionen sind mit einem Fragezeichen "?" gekennzeichnet.

Anmerkung
Komponentenstifte, die nicht mit einer bekannten Gewindefunktion verbunden werden können, melden die Funktion als "Unbekannt".

halreport generates a connections report (without pin types, and current values) for a running HAL application to aid in designing and verifying connections. This helps with the understanding what the source of a pin value is. Use this information with applications like halshow, halmeter, halscope or the halcmd show command in a terminal.