From ee06e4ce59109a7375a18d07eef96ca1fc8d5526 Mon Sep 17 00:00:00 2001 From: watts Date: Wed, 8 Nov 2023 15:01:39 +0100 Subject: [PATCH] Update Orocos Configuration --- Orocos-Configuration.md | 64 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/Orocos-Configuration.md b/Orocos-Configuration.md index 00f009c..3036e36 100644 --- a/Orocos-Configuration.md +++ b/Orocos-Configuration.md @@ -14,12 +14,72 @@ The module names for your hardware can be found on the [Comedi website](https:// ## Identify Device Numbers -The device numbers assigned to each card can be found in the kernel message log, which is printed with `dmesg` (might need `sudo dmesg`). There can be a lot of messages to sort through, so you can narrow it down with `dmesg | grep comedi`. This should produce output like: +The device numbers assigned to each card can be found in the kernel message log, which is printed with `dmesg` (might need `sudo dmesg`). There can be a lot of messages to sort through, so you can narrow it down with `dmesg | grep comedi`. This should produce output that includes lines like: + ``` -[ +[ 2.507480] comedi4: ni_660x: +[ 2.507890] comedi: cannot get unshared interrupt, will not use RT interrupts. +[ 2.511676] comedi1: ni_pcimio: +[ 2.544959] comedi2: ni_pcimio: +[ 2.546311] comedi: cannot get unshared interrupt, will not use RT interrupts. +[ 2.547515] comedi2: ni_pcimio: possible problem - never saw adc go busy? +[ 2.698319] comedi3: n1231: +[ 2.698331] comedi3: found n1231a at PCI bus 3, slot 0 +[ 2.698525] comedi3: N1231 now attached. +[ 2.699254] comedi0: ni_660x: ``` +This corresponds to: +- NI-6602 (ni_660x) assigned device number 0 +- NI-6733 (ni_pcimio) assigned device number +- Agilent N1231 assigned device number 3 +- NI-6289 (ni_pcimio) assigned device number + +We are looking for messages in the format of `comedi4: ni_660x:`, which tells us that an NI6602 card (with `ni_660x` kernel module) has been assigned the device number `4` by Comedi. ## Editing start.ops +The device numbers must be assigned correctly in the `start.ops` file used to configure Orocos. The first section of the `start.ops` file for PolLux looks like: +``` +// deployer-gnulinux -s start.ops -linfo + +import("SensorAgilent") +import("SensorAttocube") +import("PIDLoop") +import("ComController") +import("zmqStreamer") +import("AnalogOutputComedi") +import("DigitalOutputComedi") +import("TrajectoryGenerator") +import("PositionSampler") +import("RealtimeSampler") +import("DigitalInputComedi") + + +loadComponent("Sensor1","SensorAgilent") +loadComponent("Sensor2","SensorAttocube") +loadComponent("PID0","PIDLoop") +loadComponent("PID1","PIDLoop") +loadComponent("PID2","PIDLoop") +loadComponent("ComCon", "ComController") +loadComponent("zmqStream0", "ZmqStreamer") +loadComponent("AO1", "AnalogOutputComedi") +loadComponent("DO1", "DigitalOutputComedi") +loadComponent("TrajGen","TrajectoryGenerator") +loadComponent("PosSampler","PositionSampler") +loadComponent("RtSampler","RealtimeSampler") +loadComponent("DI1", "DigitalInputComedi") +``` + +Take note of each `loadComponent` command where the imported object (second argument) has "Sensor", "Input" or "Output" in the name. Each of these will need to be assigned a device number, using the name given in the first argument of the command. + +In this case, we should declare the following assignments: +``` +Sensor1.deviceNr=3 +Sensor2.deviceNr=4 +AO1.deviceNr=2 +DO1.deviceNr=2 +DI1.deviceNr=2 +``` +These assignments must be declared before the corresponding devices are configured with a command like `Sensor1.configure()`.