Private
Public Access
11
1
18
Orocos Configuration
watts edited this page 2025-10-29 18:10:13 +01:00

Orocos needs to be configured to your hardware, this involves:

  1. Identifying (or verifying) the /sys directory that the Linux kernel is assigning to each card
  2. Set the correct device addresses in the Orocos start.ops file
  3. Load and use the correct hardware drivers in the Orocos start.ops file

Identify Device Names/Numbers

The hardware drivers rely on the "comedi number" of each PCI card, which can change between reboots, but is automatically found via the /sys directory that is stable. Hardware locations in Orocos and Pixelator are configured using the deviceName option that must be set with the correct path string (e.g. "/sys/bus/pci/devices/0000:07:00.0/").

The command lspci will give a list of devices and you should note the numbers at the start of each line. These digits refer to the bus, device and function numbers that correspond to physical hardware slots in the computer. The command ls /sys/bus/pci/devices/0000*/comedi/ will list the hardware addresses of the devices recognised by comedi drivers in the Linux kernel. For example from PolLux:


control@x07da-stxm-1:~$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller (rev 09)
00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation 7 Series/C210 Series Chipset Family KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4)
00:1c.5 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 6 (rev c4)
00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a4)
00:1f.0 ISA bridge: Intel Corporation Q77 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 7 Series/C210 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)
02:00.0 Ethernet controller: Intel Corporation 82583V Gigabit Network Connection
03:00.0 Bridge: Agilent Technologies Device 0a00 (rev 01)
03:01.0 Unassigned class [ff00]: National Instruments PCI-6602 (rev 01)
03:02.0 Unassigned class [ff00]: National Instruments PCI-6733
03:03.0 Unassigned class [ff00]: National Instruments PCI-6289
03:04.0 Unassigned class [ff00]: National Instruments PCI-6602 (rev 01)

control@x07da-stxm-1:~$ ls /sys/bus/pci/devices/0000*/comedi/
'/sys/bus/pci/devices/0000:03:01.0/comedi/':
comedi1

'/sys/bus/pci/devices/0000:03:02.0/comedi/':
comedi0

'/sys/bus/pci/devices/0000:03:03.0/comedi/':
comedi3

'/sys/bus/pci/devices/0000:03:04.0/comedi/':
comedi2

We can use the above info to conclude:

  • The PCI-6733 uses the deviceName address of /sys/bus/pci/devices/0000:03:02.0/
  • The PCI-6602 uses the deviceName address of /sys/bus/pci/devices/0000:03:01.0/
  • The PCI-6602 uses the deviceName address of /sys/bus/pci/devices/0000:03:04.0/
  • The PCI-6289 uses the deviceName address of /sys/bus/pci/devices/0000:03:03.0/
  • The Agilent interferometer card uses the deviceName address of /sys/bus/pci/devices/0000:03:00.0/

Note that the Agilent PCI cards don't have a proper kernel driver (Orocos directly accesses via the PCI slot) and so doesn't have a "comedi" section in its /sys directory.

Setting Hardware Modules and Addresses In start.ops

The hardware must be configured with the correct modules and addresses 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("SensorAgilentPCI")
import("SensorAttocube")
import("PIDLoop")
import("ComController")
import("zmqStreamer")
import("AnalogOutputComedi")
import("DigitalOutputComedi")
import("TrajectoryGenerator")
import("PositionSampler") 
import("RealtimeSampler") 
import("DigitalInputComedi") 


loadComponent("Sensor1","SensorAgilentPCI")
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 deviceName, using the name given in the first argument of the command.

In this case, we should declare the following assignments:

Sensor1.deviceName= "/sys/bus/pci/devices/0000:03:00.0/"
Sensor2.deviceName= "/sys/bus/pci/devices/0000:03:01.0/"
AO1.deviceName= "/sys/bus/pci/devices/0000:03:04.0/"
DO1.deviceName= "/sys/bus/pci/devices/0000:03:04.0/"
DI1.deviceName= "/sys/bus/pci/devices/0000:03:04.0/"

These assignments must be declared after the corresponding device names are defined with loadComponent and before they are configured with a command like Sensor1.configure().

Note that the "configure" and "start" functions can optionally use parentheses (e.g. "configure()"), or not (e.g. "configure"). Orocos just doesn't care.

Configuring start.ops

The start.ops file tells Orocos how to define devices and how signals are interconnected. Note that the feedback loops are "PID0" for the X-axis, "PID1" for the Y-axis and "PID2" for the Z-axis.

It is probably best to start with the file configured for PolLux (PixelatorRealtime/startup/PolLux/start.ops) and adapting to your instrument. There are three things that might make PolLux different from your system:

  1. The PCI card deviceName addresses.
  2. The interferometer module(s).
  3. The number of interferometer axes being used.

Device Addresses

The section above discusses how to set the appropriate deviceName strings in start.ops.

Interferometer Module(s) and Axes

An interferometer module is first imported (import()) and then loaded and assigned a name (loadComponent()). PolLux uses an Agilent interferometer for the X- and Y-axes, and an Attocube interferometer for the Z-axis. You should only import the module(s) that you need for the interferometer type(s) used in your instrument. If you only have one interferometer type, then you should delete one of the import() commands and one of the loadComponent() commands so that the remaining commands refer to the interferometer module that you want to use. Further, ensure that the loadComponent() command uses a name (first argument, e.g. "Sensor1") that is used consistently for later commands.

Next, you should set the interferometer resolution for each channel, for example:

Sensor1.resolution[0]=0.000309078
Sensor1.resolution[1]=0.000309078
Sensor1.resolution[2]=0.000309078

It is OK to set as many channels as exists on the hardware (usually 3), even if you are not measuring that many axes. The resolution value is calculated by the laser wavelength (in microns) divided by the interpolator factor (Agilent N1231A is 512 and N1231B is 1024) and then divided by the number of laser paths (a double-pass, with 2 bounces off the mirror gives 4).

Next, you will need to modify or delete a bunch of commands, depending on whether you have a Z-axis interferometer.

Two Interferometer Axes (of same type)

If you have only X- and Y-axis interferometers, you can delete all commands (the full line) that include either "Sensor2" or "PID2" (or both). Need to include the line ComCon.nrPID=2 in start.ops.

Three Interferometer Axes (of same type)

If you have X-, Y- and Z-axis interferometers, you should first look at every connect() command and change any instance of "Sensor2.*Output_0" (where * is either "position" or "status") in that command to "Sensor1.*Output_2". After doing this throughout the file, you should delete any command (the full line) that still contains "Sensor2". Need to include the line ComCon.nrPID=3 in start.ops.