Difference between revisions of "HOWTO Read the laser in real time"

From GlueXWiki
Jump to: navigation, search
m (Technical Note)
Line 1: Line 1:
The laser measurement device, part of the FDC laser scanner system, is read via RS232 serial communication through the serial port on the Desktop computer located on the ground. The laser's default mode when powered on is to continuously read out depth measurements to this computer. Note that only one program can read from the serial port at a time so these instructions should only be followed if a full snake scan is not currently in progress.
+
The laser measurement device, part of the FDC laser scanner system, is read via RS232 serial communication through the serial port on the Desktop computer located on the ground. The laser's default mode when powered on is to continuously read out depth measurements to this computer. Note that only one program can read from the serial port at a time so ''these instructions should only be followed if a flatness scan is not currently in progress.''
  
 
To read the values reported by the laser device, perform the following:
 
To read the values reported by the laser device, perform the following:
  
# Make sure the laser is plugged in and is on. The plug is labeled and plugs into a power strip that sits on top of the granite rock, towards the right. If you do not see the laser reflecting off of whatever is directly in front of it, then unplug the laser and plug it back in to reset it.
+
# Make sure the laser's power and serial cords are plugged in, and that the laser is on. The power cord is labeled and plugs into a power strip that sits on top of the granite rock, towards the right. If you do not see the laser reflecting off of whatever is directly in front of it, then unplug the laser and plug it back in to reset it.
 
#:
 
#:
# Open up an window on the Linux Desktop computer and type:
+
# Double click on the '''Laser_Control''' icon on the desktop and then double click on '''ReadLaser'''.  When prompted, click on '''Run in Terminal'''.  Alternatively, you can click on Applications→Laser_Control→ReadLaser.
 +
#:[[Image:Laser_Control.png|center|300px]]
 +
#:[[Image:Run_In_Terminal.png|center|300px]]
 
#:
 
#:
#'''''minicom -o '''''
+
# Note that this utility checks for several possible software issues before opening the '''minicom''' application that reads data from the laser.  If a permission problem is detected, you will be prompted to type in the root password to fix it.  The password is posted in EEL 126.  When the checks are complete, a terminal should pop up and begin printing the laser's output to the screen.  The units are millimeters.
#:
+
 
#: This should immediately start reading the laser with numbers scrolling up the screen. The values are in mm.
+
The laser can also be read manually from the command line, bypassing the checks for possible problems, by entering ''' minicom -o''' in a terminal.  This should immediately start printing the laser's output to the screen.
  
 
= Troubleshooting =
 
= Troubleshooting =
  
* If you get an error message like:
+
* If you use the '''ReadLaser''' utility, this error should automatically be detected and prompt you to type in the root password to fix it.  But if you are reading from the laser manually, with the '''minicom -o''' command, you may get the following error message:
 
*:
 
*:
 
*:  ''Device /dev/ttyS0 access failed: Permission denied.''
 
*:  ''Device /dev/ttyS0 access failed: Permission denied.''
 
*:
 
*:
 
: The permissions are not set properly.  To set them, just double click on the ''laser_permission'' icon in the Laser_Control folder on the desktop and enter the password.
 
: The permissions are not set properly.  To set them, just double click on the ''laser_permission'' icon in the Laser_Control folder on the desktop and enter the password.
* If ''minicom'' refuses to make a connection, it is likely because another program has control of the serial port. Try killing the other process with the following:
+
* The '''ReadLaser''' utility automatically checks to see if the serial port is locked by another process and unlocks it.  But if you are running '''minicom''' manually, and it refuses to make a connection, you may need to kill the other process.  Do so with the following command:
 
*:
 
*:
 
*:  ''kill -9 `cat /var/lock/LCK..ttyS0`''
 
*:  ''kill -9 `cat /var/lock/LCK..ttyS0`''

Revision as of 14:30, 29 June 2009

The laser measurement device, part of the FDC laser scanner system, is read via RS232 serial communication through the serial port on the Desktop computer located on the ground. The laser's default mode when powered on is to continuously read out depth measurements to this computer. Note that only one program can read from the serial port at a time so these instructions should only be followed if a flatness scan is not currently in progress.

To read the values reported by the laser device, perform the following:

  1. Make sure the laser's power and serial cords are plugged in, and that the laser is on. The power cord is labeled and plugs into a power strip that sits on top of the granite rock, towards the right. If you do not see the laser reflecting off of whatever is directly in front of it, then unplug the laser and plug it back in to reset it.
  2. Double click on the Laser_Control icon on the desktop and then double click on ReadLaser. When prompted, click on Run in Terminal. Alternatively, you can click on Applications→Laser_Control→ReadLaser.
    Laser Control.png
    Run In Terminal.png
  3. Note that this utility checks for several possible software issues before opening the minicom application that reads data from the laser. If a permission problem is detected, you will be prompted to type in the root password to fix it. The password is posted in EEL 126. When the checks are complete, a terminal should pop up and begin printing the laser's output to the screen. The units are millimeters.

The laser can also be read manually from the command line, bypassing the checks for possible problems, by entering minicom -o in a terminal. This should immediately start printing the laser's output to the screen.

Troubleshooting

  • If you use the ReadLaser utility, this error should automatically be detected and prompt you to type in the root password to fix it. But if you are reading from the laser manually, with the minicom -o command, you may get the following error message:
    Device /dev/ttyS0 access failed: Permission denied.
The permissions are not set properly. To set them, just double click on the laser_permission icon in the Laser_Control folder on the desktop and enter the password.
  • The ReadLaser utility automatically checks to see if the serial port is locked by another process and unlocks it. But if you are running minicom manually, and it refuses to make a connection, you may need to kill the other process. Do so with the following command:
    kill -9 `cat /var/lock/LCK..ttyS0`
  • If you still can't get access to the serial port, reboot the Linux Desktop. On rare occasions, the serial device on the computer side gets confused to the point that only a reboot will clear it to the point that communications can be established.
  • If minicom does not display any readings, check that the serial cable is plugged in tightly (both to the back of the computer, and on top of the granite rock where the extension cord meets the laser's cable).
  • If the laser is not reading properly (too fast or too slow) try unplugging and plugging it back it.
  • If the laser reads only zeros, it probably means the distance between the read head and the surface being measured is out of range. The device has a very limited range of only 6.35mm centered around 21mm. Try slipping in a piece of paper to see if you can get non-zero numbers to come up. If so, then the surface is too far away. If not, then try moving the laser further from the surface.

Technical Note

In order to set permissions on /dev/ttyS0 the following line is in /etc/rc.local:

chmod 664 /dev/ttyS0

There is also a file located in /etc/udev/permissions.d/micah.permissions containing:

#name:user:group:mode
ttyS0:root:root:664

This seems to have worked at least once. The program udev is supposed to read this file whenever configuring ports.

Also noteworthy, user laser was apparently removed from the group uucp at some point. The graphical tool showed that laser was a member of uucp, but running groups laser from the terminal indicated otherwise. I remedied this with usermod -G uucp laser. Also, the desktop icon laser_permissions runs the following command, which should allow permissions to be temporarily set so that laser does not have to be a member of uucp.

kdesu "chmod 666 /dev/ttyS0"

Contact

David Lawrence davidl@jlab.org x5567