CROS and System Shell
CROS and System Shell
System Shell
UMI-R3-171
CROS and System Shell
Revision History Date
ii May 2000
Contents
Chapter 1 ..................................................................................................................... 1
Introduction ................................................................................... 1
Chapter 2 ..................................................................................................................... 3
The Basics ...................................................................................... 3
The Operating System: CROS .................................................... 4
The System Shell....................................................................... 5
Running CROS.......................................................................... 6
Starting CROS ..................................................................... 6
Shutting Down CROS .......................................................... 6
Accessing the System Shell........................................................ 7
Starting With CROS Not Yet Running ................................... 7
Accessing With CROS Already Running ................................ 7
Starting Additional System Shells......................................... 7
Exiting Out of a Shell........................................................... 8
Checking System Shell Version Number ............................... 8
Using the Shell: Basics .............................................................. 9
Entering Commands ............................................................ 9
Command History................................................................ 9
Working With Directories..........................................................10
Changing the Current Directory ..........................................10
Listing the Contents of a Directory ......................................11
Creating a Directory............................................................12
Working with Files....................................................................13
Viewing the Contents of a File .............................................13
Deleting a File.....................................................................14
Accessing System Tools and Applications ..................................15
Accessing the Application Shell (ash) ...................................15
Accessing the Teach Pendant ..............................................15
Installing CROS on the PC ........................................................18
Installing CROS on the Controller .............................................18
Testing CROS on the Controller...........................................18
Chapter 3 ................................................................................................................... 19
System Shell Commands................................................................19
Categories of Commands ..........................................................20
Command Names: CROS, UNIX, and DOS ...........................23
Path Separators ..................................................................24
Wildcards ...........................................................................25
General Command Format........................................................26
Detailed Descriptions................................................................27
file_name ............................................................................27
ash.....................................................................................28
auto ...................................................................................28
axst ....................................................................................29
cd.......................................................................................29
chmod ................................................................................30
cksum ................................................................................31
compile...............................................................................31
iv May 2000
1
CHAPTER 1
Introduction
This Guide describes the CROS operating system and the system
shell. CROS handles the controller resources and permits different
processes to have access to these resources. CROS monitors point of
control to the robot, so that, for safety reasons, only one process or
application can command the robot at one time.
The system shell provides user access to the CROS operating system.
From a computer running Robcomm3 or a suitable terminal
emulator, you can access a system shell which permits
communication directly with the CROS operating system. The system
shell gives you command line access to the CROS operating system
on the controller, so that you can work with system directories and
files, system memory, and robot applications.
If you have a POLARA lab system, CROS for Windows NT is installed
on your PC so that you can run RAPL 3 programs on the PC as well
as the controller. Note however, that if CROS is installed on your
computer and on a controller, the versions must be compatible in
order to ensure proper operation of your applications.
2 CROS and System Shell: Introduction
May 2000
3
CHAPTER 2
The Basics
This chapter describes how to use the CROS Operating System and
the Shell (ash). There are nine sections:
• The Operating System: CROS
• The System Shell
• Running CROS
• Accessing the System Shell
• Using the Shell: Basics
• Working With Directories
• Working With Files
• Accessing System Tools and Applications
• Installing CROS.
4 CROS and System Shell: The Basics
May 2000
CROS and System Shell: The Basics 5
May 2000
6 CROS and System Shell: The Basics
Running CROS
When the controller is powered on, CROS is started up. In CROS, the
init process starts a system shell. You do not have to start a system
shell yourself to access CROS.
Starting CROS
CROS is started by the controller's start up sequence. You can power
on the controller before opening a terminal session on your computer,
but if you start a terminal session before powering on the controller,
you can follow the controller boot sequence. The terminal window
buffer captures all CROS start up messages which can be checked if
there is a problem at start up.
1. Start a terminal session. (If you have Robcomm3, start
Robcomm3, and open the terminal window. On the tool bar, click
the terminal icon, or from the C500 drop-down menu, select the
Terminal command.)
2. At the controller, turn on power at the controller's main power
switch.
May 2000
CROS and System Shell: The Basics 7
May 2000
8 CROS and System Shell: The Basics
May 2000
CROS and System Shell: The Basics 9
Entering Commands
Shell commands and parameters are entered as strings of characters
separated by spaces:
command file_name
If a string is recognized as a valid shell command with properly
specified parameters, then the corresponding CROS command is
called and executed. If the command string is not recognized as a
valid shell command, the shell assumes that the string is calling an
executable program (application) and searches for that executable in
the current directory and then in the bin directory. If an executable is
not found in either directory, a message is displayed to the effect that
the string is not recognized.
If the command is recognized but the parameters given are incorrect,
the command usage is displayed.
Command History
The command line remembers the previous 10 commands. To review
or repeat previous commands, you can move through the list of
commands. To re-issue a previous command when it is displayed,
press the Enter key.
There are also other command line editing features which can be
used in conjunction with the standard keyboard editing functions to
construct command line inputs.
The following table shows how to display the remembered commands:
May 2000
10 CROS and System Shell: The Basics
May 2000
CROS and System Shell: The Basics 11
May 2000
12 CROS and System Shell: The Basics
Creating a Directory
You can create a new directory or sub-directory with the md
command. A new directory is created in the active directory.
1. Change to the directory you want as the parent directory with the
cd command.
2. Use md and name the new directory.
$ md newname
$ md examples
The directory specified is created as a sub-directory of the working
directory. You can check that your directory was created with the ls
or dir command.
Note: You cannot make a directory and sub-directory at the same
time, but you can make a sub-directory of an existing directory using
the directory path. For example, to make a new directory ‘lab’ with
the sub directory ‘analysis’, enter:
$ md lab
$ md lab\analysis
May 2000
CROS and System Shell: The Basics 13
May 2000
14 CROS and System Shell: The Basics
Deleting a File
To delete files from CROS, use the system shell rm (remove)
command. Refer to the system shell commands.
Note: A deleted file cannot be recovered. To set aside a file until you
are certain you will not need to recover it, create a directory with a
name such as trash and move the file to that directory using the mv
(move) command. Later, delete the contents of trash when you are
certain you do not need the file.
As an example, if you want to replace an existing variable file for your
‘trim’ application stored in app/trim directory, enter the following
commands (assuming the root directory is the active directory):
$ md trash
$ mv /app/trim/trim.v3 /trash/trim_old.v3
When you want to delete the file from the root directory, enter:
$ rm /trash/trim_old.v3
Refer to the System Shell Commands chapter of this guide for details
of the mv and rm commands.
May 2000
CROS and System Shell: The Basics 15
May 2000
16 CROS and System Shell: The Basics
RAPL-3 programs can be run from the teach pendant, the application
shell, or the system shell.
In fact, running a robot application from the system shell is more
efficient than running it from the application shell. Without the
application shell loaded into memory, the system can use that
memory during execution. During application development, you must
have the application shell to teach locations and move the arm.
May 2000
CROS and System Shell: The Basics 17
May 2000
18 CROS and System Shell: The Basics
May 2000
19
CHAPTER 3
This chapter describes the commands that you can use through the
system shell. There are three sections:
• Categories of commands
• Similarities to UNIX and DOS
• Detailed descriptions of all commands listed alphabetically
20 CROS and System Shell: System Shell Commands
Categories of Commands
Details of the commands are given in the alphabetical listing.
May 2000
Chapter 2: System Shell Commands 21
May 2000
22 CROS and System Shell: System Shell Commands
May 2000
Chapter 2: System Shell Commands 23
May 2000
24 CROS and System Shell: System Shell Commands
Path Separators
CROS allows both the / (forward slash) familiar to UNIX users and
the \ (backslash) familiar to DOS users as separators between
directories and files in a path. Since they are equally valid, they could
be mixed in a path.
CROS CROS
(UNIX-style) (DOS-style)
/app/test/test.r \app\test\test.r
May 2000
Chapter 2: System Shell Commands 25
Wildcards
The CROS system shell can handle simple wildcards. The special
characters recognized are:
* matches zero or more of any character
? matches exactly one of any character
May 2000
26 CROS and System Shell: System Shell Commands
May 2000
Chapter 2: System Shell Commands 27
Detailed Descriptions
These are detailed descriptions of all system shell commands listed
alphabetically.
Where a command has two names, there is an entry for each. For
example, there is an entry for ls and an entry for dir. Details are only
at one entry. A cross-reference directs you from the other entry to the
one with details.
file_name
Description Runs the specified file. Running a robot application program from the
system shell is more efficient than running it from the application
shell.
Format The following short-forms are used in the next table:
xpath the path to the executable program file
xname the executable program file name
vpath the path to the variable file
vname the variable file name
May 2000
28 CROS and System Shell: System Shell Commands
ash
application shell
Description Starts up a new application shell.
The application shell interprets application commands.
Syntax ash [application_name [variable_file_name]]
Parameters Takes an optional application name parameter. If the application is
specified, then the variable file name can be optionally specified.
application_name the application to open when ash loads
variable_file_name the variable file to load into the database
with or without the .v3 extension
If no application name is specified, the shell prompts for the
application name. If no variable file name is specified, the shell loads
the variable file name with the same name as the application.
Examples ash test alpha use application “test” with v3 file “alpha.v3”
ash test test use application “test” with v3 file “test.v3”
ash test use application “test” with v3 file “test.v3”
ash prompt the user for which application to use
See Also exit (in application shell) exits from application shell
auto
set autostart commands
Description The auto command is used to update the /conf/startup.sh file. This
file is a list of commands that gets executed by the shell after the rc
(initialization) file, when the system first starts up. The auto
command can be used to set the system to automatically launch a
program at start up for turnkey applications.
Syntax auto [-options] [command]
auto [-options]
Parameters The command takes two optional sets of parameters:
options An option. See the options list below.
command The system shell command to add to the conf/startup.sh
file. If command is omitted, then the auto command
calls up the editor (edit).
May 2000
Chapter 2: System Shell Commands 29
Option Description
-a append append command to the end of the startup.sh
file, or simply edit the existing file if command
is not specified. (default)
-d delete simply delete the startup.sh file. Used to
cancel a previously defined set of startup
commands.
-h help display a usage message
-?
-x overwrite discard the existing startup.sh file and create
a new one.
axst
axis status
Description Continually displays low-level axis status information. This
information is displayed as a set of 8 hexadecimal numbers, one per
axis. The data is of diagnostic use only, and is not useful to general
users.
Syntax axst
Parameters This command takes no parameters.
Example axst
cd
change directory
Description Changes the current working directory to the directory specified.
Syntax cd path
Parameters Takes one required parameter, specifying the absolute or relative path
to the directory to change to.
path any absolute or relative directory path
Paths can be absolute or relative; absolute paths start with either “/”
or “\” and specify the location of a directory from the root of the
directory tree.
May 2000
30 CROS and System Shell: System Shell Commands
Examples
cd test cd into the test directory, (which must be a child of the current
working directory.)
cd /dev cd into the dev directory, (which must be a child of the root of
the directory tree.)
cd \ cd into the root directory
cd cd from the current directory into the app directory, and from
app\test there into the test directory.
cd .. cd one level up in the directory tree into the parent of the
current working directory.
cd ../.. cd two levels up in the directory tree.
See Also pwd print working directory
ls (or dir) list contents of directory
chmod
change modes
Description Changes the access modes of an object (file, device, fifo, or socket).
Syntax chmod modes object_names…
Parameters This command accepts two arguments: modes, which specifies how
the modes of the listed objects are to be changed, and object_names…
which is a list of object names.
The modes argument consists of a list of the following key letters,
possibly with + or – characters before them. The mode key letters are:
r permit reading from the object
w permit writing to the object
x permit executing the object
s mark this as a system object
The ‘+’ sign indicates that the following mode bits are to be set for
(added to) the object; the ‘-‘ indicates that the mode bits are to be
cleared (removed from) the object. If no ‘+’ or ‘-‘ appears, then the
access modes are simply set as indicated. For example:
+w add the w flag to the object
-xw remove the x and w flags from the object
May 2000
Chapter 2: System Shell Commands 31
cksum
checksum
Description Calculates and prints the checksum of a file. The checksum is a
number determined by a mathematical calculation on the bits of the
file, and can be used to compare files to ensure that they are
identical. Prints the hexadecimal checksum, the decimal integer
number of bytes of the file, and the filename. At present, the
checksum is a simple 32-bit sum of each of the 8-bit bytes in the file.
Syntax cksum file_name [file_name_2] [file_name_3]
Parameters Takes one or more parameters:
file_name the name of the file to check
Example cksum sieve.r
Result 0x00006b8a 416 sieve.r
Example cksum teachflo.r teachint.r teachloc.r
Result 0x000085db 788 teachflo.r
0x00009e23 912 teachint.r
0x0000704c 628 teachloc.r
compile
invoke the RAPL-3 Compiler
Allows the user to recompile RAPL-3 programs.
See r3c
copy
copy objects
Copies the contents of one object to the contents of a second object.
See cp
May 2000
32 CROS and System Shell: System Shell Commands
cp
copy
copy objects
copy objects
Description Copies the contents of one object to the contents of a second object. If
the second object does not exist, then it is created. If the second
object already exists, over-writes the existing contents of the second
object. This is similar to the operation of the copy command in DOS
and the cp command in Unix. Typically, copy is used to copy files; it
can also be used to copy a file to a device or to copy a file to a fifo.
Syntax cp source_object_name destination_object_name
cp source_object_name [source_object_name_2...]
destination_directory_name
Parameters To copy one object to another, cp takes two required parameters:
source_object_name the object to copy from (can include a path)
destination_object_name the object to copy to (can include a path)
To copy one or more object to another directory, cp takes at least two
required parameters:
source_object_name the object to copy from
source_object_name_2 one or more additional objects to copy from
destination_directory_name the directory to copy to (can include a path)
Example cp lab_test.r lab.r
copy alpha.r alpha.v3 \app\trash
See Also ln makes a link to an object
rm (or del) removes (deletes) an object or link
mv (or move) moves or renames an object
crosver
CROS version
Description Displays the version of the operating system (CROS) being used.
Syntax crosver
Parameters No parameters.
Example crosver
Result System type: ‘CROS on a C500’
Version: 1.11.424
Click size: 64
msec/tick: 10
See Also ver (in the system shell) displays version of system shell
ver (in the application shell) displays version of application shell
May 2000
Chapter 2: System Shell Commands 33
date
date
Description Displays or sets the current date and time.
Syntax date
date [yyyy mo dd hh mi ss]
Parameters To display the date, takes no parameters.
To set the date, takes six required space-separated parameters:
yyyy year 1970, 1971, ... 2037
mo month 1, 2, ... 12
dd day 1, 2, ... 31
hh hour 0, 1, ... 23
mi minutes 0, 1, ... 59
ss seconds 0, 1, ... 59
All parameters are integer numbers. A first leading zero is optional
(00, 01, 02, ...). The date command performs some error checking for
correct combination of day with month or year.
Example date
Result Wed Jan l 00:00:00 1997
Example date 1997 07 01 15 30 00
Result the date is set to Tue Jul 1 15:30:02 1997
del
delete
Deletes (removes) an object (file, device, fifo, or socket).
See rm
df
disk free space
Description Displays the number of free bytes on the file system.
May 2000
34 CROS and System Shell: System Shell Commands
/diag/cal
recalibrate specified axes of the robot.
Description This command is used to recalibrate and home selected axes of the
robot. WARNING: the cal command will overwrite your existing
calibration files! The axes in question should be properly zeroed
before performing this procedure. Under normal operation you will
never have to recalibrate the robot.
Syntax /diag/cal [axes…]
Parameters Optionally takes a list of axes to recalibrate and home; if the list is
omitted, then all robot axes are recalibrated.
Example /diag/cal recalibrate and home all axes
/diag/cal 5 recalibrate and home axis 5
See Also home (in the application shell) home specified robot axes
home (in the system shell) home specified robot axes
May 2000
Chapter 2: System Shell Commands 35
/diag/calgrip
recalibrate the servogripper
Description This command is used to recalibrate the servo gripper. WARNING:
the calgrip command will overwrite your existing servo gripper
calibration file! Under normal conditions, you will never have to
recalibrate the servogripper; this command is generally used to set up
the gripper when it is first installed.
The calgrip program opens the servo gripper and prompts for you to
enter the distance that the jaws are open (typical is 2.0 inches); then
the program closes the gripper and asks what distance the jaws are
open (typically 0.0 inches.) The program then calibrates the gripper
and exits.
Syntax /diag/calgrip
Parameters This command takes no parameters.
Example /diag/calgrip
See Also /diag/cal (in the system shell) calibrates and homes robot
axes
/diag/cal (in the application shell) calibrates and homes robot
axes
gtype (in the application shell) sets the type of gripper
/diag/configur
configure robot
In earlier versions of CROS, the name for /diag/setup.
See /diag/setup
/diag/encres
F3 encoder reset
Description Resets the absolute encoders on an F3 robot.
WARNING: this command is generally used in preparation to calibrating the
robot and is not used in normal operations. Please refer to the F3 operation
manual for details on the use of this command.
Syntax /diag/encres
Parameters This command takes no parameters.
Example /diag/encres
Result The F3 encoders are reset.
May 2000
36 CROS and System Shell: System Shell Commands
/diag/f3diag
F3 diagnostics
Description This program allows the user to perform several F3 specific
diagnostics.
Syntax f3diag
Parameters The command takes no parameters.
Example f3diag
Result F3diag v. 2.19
Commands available:
(M)odule Detection (N)etwork Scan
(C)alibration Info (J)oint Limits
(H)elp (Q)uit
Command:M
Waist amp detected.
Wrist amp detected.
EOA-IO or SG-IO board detected.
A total of 3 modules detected.
Command:Q
/diag/f3pack
F3 packing position.
Description This command is used prior to shipping an F3 robot, to place the
robot in its packing (curled-up) position.
Syntax f3pack
Parameters This command takes no parameters.
Example f3pack
/diag/setup
robot setup.
Description This command asks the user a series of questions about the system
and robot and writes a new /conf/robot.cfg file based on the answers.
This command was called configur in early versions of CROS.
Syntax /diag/setup
Parameters This command takes no parameters.
Example Note that what the computer prints is in regular type;
sample user input is underlined.)
$configur
May 2000
Chapter 2: System Shell Commands 37
Robot is configured.
This may cause a PIC TIMEOUT ERROR and a LOSS OF ARM
POWER
Please restart controller to allow new settings to take
effect.
$
See Also /diag/cal (in the system shell) calibrates and homes robot axes
/diag/cal (in the application shell) calibrates and homes robot axes
gtype (in the application shell) sets the type of gripper
/diag/xzero
axis zero position registers
Description Zeros the position registers of a particular robot axis.
May 2000
38 CROS and System Shell: System Shell Commands
/diag/zero
zero position registers
Description Zeros the position registers of all robot axes.
dir
list directory
Lists the contents of a directory
See ls
do
do shell script
Description This command tells the shell to execute a text file containing a list of
system shell commands. The file should consist of shell commands,
one command per line, possibly interspersed with ‘#’ delimited
comments.
Syntax do script_file_name
Parameters There is one parameter:
script_file_name The name of the text file containing the shell
commands. The system will search for this file in
the current working directory and then in /bin.
Example Given a file test.sh that contains this:
# This is a comment
echo Hello
pause Hit any key to continue
echo Done.
# This is another comment
The “do test.sh” will print out the message “Hello” and “Hit any key
to continue”, then wait for the user to hit a key, and print out the
message “Done.”
May 2000
Chapter 2: System Shell Commands 39
echo
echo a message to the console
Description Echoes a message to the console. This is useful inside scripts.
Syntax echo [-n] [text…]
Parameters There are two optional parameters:
edit
edit a text file
Description This command invokes the command line text editor. edit can be
used to create and modify configuration and source files.
Syntax edit [-options] filename
Parameters The command takes one optional sets of parameters and one required
parameter:
options an option (see the list below)
filename the name of the file to edit
Option Description
-n no menu do not display the editor help menu on startup.
-h help display a usage message
-?
-l use default use the default command history log file
command log (/log/command.log) for inserting. This allows
a program to dump out its command history to
a file and permits the editor to select lines
from that history list to insert.
-L filename use the specified same as –l, but loads a specific command
May 2000
40 CROS and System Shell: System Shell Commands
exit
exit the shell
Description Terminates the current shell. Takes one optional parameter, which is
the exit code to return to the parent process.
If you have only one system shell running, the exit command exits
from that shell, but the init process starts up a new shell to ensure
that you always have communication with the system.
Syntax exit [code]
Parameters There is one optional parameter:
code The exit code to return to the parent process.
help
help
Description Displays help on system shell commands. Displays the command
name, its parameters, and a brief description.
You must be in the system shell to get help on commands that are
accessed only from the system shell. In the application shell, the help
command gives help on commands that are accessed from the
application shell.
Syntax help [command_name]
Parameters Takes one optional parameter:
command_name the command for which you want help.
No parameter gives a list of all system shell commands.
Examples help ls
help shutdown
help
See Also help (in the application shell) displays help on ash accessible
commands.
May 2000
Chapter 2: System Shell Commands 41
kill
kill
Description Sends a specified signal to a set of processes. Typically this can be
used to terminate (kill) the processes.
By default, an INT (interrupt) signal (7) is sent, which is the
equivalent of pressing Ctrl E. The kill signal (1) is the only signal that
cannot be masked or caught by the target process; this signal can be
sent in extreme cases to terminate an errant process.
Syntax kill [ -signal] process_number…
Parameters
signal the signal name or number
process_number… a list of process id numbers
To obtain the process number and the process state, use the ps command.
Signals
Number Name RAPL-3 Description Default
Symbol Action
1 KILL SIGKILL kill; cannot be caught or masked terminate
2 SEGV SIGSEGV segmentation violation terminate
3 SIGILL SIGILL illegal instruction terminate
4 FPE SIGFPE floating point exception terminate
5 SYS SIGSYS bad argument to system call terminate
6 ABRT SIGABRT abort terminate
7 INT SIGINT interrupt terminate
8 ALRM SIGALRM alarm clock terminate
9 HUP SIGHUP hang up terminate
10 PIPE SIGPIPE write to pipe, but no process to read it terminate
11 SOCK SIGSOCK write to socket, but no process to read it terminate
12 RPWR SIGRPWR robot power failed terminate
13 13 SIG13 user defined terminate
14 14 SIG14 user defined terminate
15 15 SIG15 user defined terminate
16 16 SIG16 user defined terminate
17 CHLD SIG17 child process died ignore
18 18 SIG18 user defined ignore
19 19 SIG19 user defined ignore
20 20 SIG20 user defined ignore
21 21 SIG21 user defined ignore
22 22 SIG22 user defined ignore
23 23 SIG23 reserved for CRS use ignore
24 24 SIG24 reserved for CRS use ignore
May 2000
42 CROS and System Shell: System Shell Commands
lcd
display text on or clear the front panel LCD display.
Description The lcd command allows messages to be displayed on the C500C
front panel LCD (liquid crystal display). It also allows clearing the
display.
Syntax lcd [first_line [second_line]]
Parameters There are two optional parameters to this command:
first_line text to appear on the first (top) line of the
display.
second_line text to appear on the second (bottom) line of
the display.
May 2000
Chapter 2: System Shell Commands 43
ln
link
Description Makes a hard link to an object (file, device, fifo, or socket). Can be
used to create another name for an object. Can be used to rename an
object, if the ln command is followed by an rm of the original name.
If all links to an object (like a file) are removed (with rm, for example),
then the object ceases to exist.
Hard links are presently supported only within a CROS-500 mfs
filesystem or a CROSnt CFS filesystem; in particular, the CROSnt
hostfs (which allows access the host filesystem) does not support
hard links, as Windows NT™ itself does not support hard links.
Syntax ln source_object target_object_name
Parameters Takes two required parameters:
source_object the object identified by an existing name
target_object_name the new name
Examples ln sample_alpha.v3 sample_beta.v3
See Also rm (or del) breaks a link
cp (or copy) copies an object
mv (or move) moves or renames an object
ls
dir
list directory
list directory
Description Lists the directory, sub-directories, entities, and/or information
about them depending on optional parameters.
Syntax ls [-options] [directory_name]
Parameters Takes two optional parameters:
options the options list (see below)
directory_name the name of a specified directory
If no option is given, lists the contents by name.
If no directory name is given, lists the current directory.
May 2000
44 CROS and System Shell: System Shell Commands
Option Description
-a all lists all including any normally hidden files
which begin with a . (dot), the current
directory, and the parent directory
-I inode lists the inode (internal node; the index of
number where object information is actually
stored) for each sub-directory or object
-l long lists the current or specified directory with
(the letter l) details as described in the output sample
below
–R Recursive lists recursively (lists the contents of all
sub-directories, sub-sub-directories, etc.
starting at the specified directory)
–1 1 (single) lists the current or specified directory, one
(the number 1) sub-directory or object per line
Long Option
The long option is described below with example command, resulting
output, and description of output categories.
Example ls -l
Result The output displays without any column names.
file mode links size or date name
device
d---rwx 2 160 Jul 1 12:00 ./
d---rwx 12 416 Jul 1 12:00 ../
-f-Sr-x 1 9320 Jul 1 12:00 fastacid
-f-Sr-x 1 35468 Jul 1 12:00 robotsrv
-f--r-x 1 47716 Jul 1 12:00 stpv3
Description The long option gives five columns of information: file mode, links,
size or device, date, and name.
file mode
File mode contains seven sub-columns of information: type of
object, flash location (primary or secondary), system ownership,
and mode of protection (read, write, or execute).
May 2000
Chapter 2: System Shell Commands 45
File Mode
–
file in in a can can can
primary secondary system read write execute
flash flash object
v
device – – – – – –
p
pipe
not in not in not a cannot cannot cannot
s primary secondary system read write execute
socket flash flash object
md
make directory
Makes a new directory.
See mkdir
May 2000
46 CROS and System Shell: System Shell Commands
mem
memory available
Description Displays a summary of free space in memory and the percentage of
fragmentation of that space. Zero percent indicates that free memory
is completely contiguous.
Syntax mem
Parameters This command takes no parameters.
Example mem
Result 152512 bytes free
5% fragmentation
See Also sync flushes file buffers and defragments memory
mkdev
make device
Description Makes a new device. A device is an object in the file system (usually
in the device directory) which is necessary to communicate with
peripherals. These peripherals are also called devices.
Most devices correspond to external hardware components like those
connected through the GPIO or the front communication port. In
addition, CROSnt includes some special purpose device drivers
supporting communication between CROSnt programs and native
WindowsNT™ programs.
Every device has a device driver that instructs CROS how to perform
various communication functions with the external device. The device
entry in the file system, created by mkdev, tells CROS which device
driver to use when communicating with the external device through
the internal device driver software.
Syntax mkdev device_name major minor
Parameters Takes three required parameters:
device_name the name of the device
major the major identifier of the device driver
minor the minor identifier of the device driver
Examples mkdev \dev\terminal 1 1
Same As RAPL-3 mknod() makes device, fifo, or socket
See Also chmod changes protection mode
May 2000
Chapter 2: System Shell Commands 47
mkdir
md
make directory
make directory
Description Makes new directories.
Syntax mkdir directory_name…
Parameters Where:
directory_name the name of the directory
Examples mkdir lab
mkdir lab\analysis
See Also rmdir removes (deletes) a directory
mkfifo
make fifo
Description Makes a new fifo. A fifo is a queue-like object for one-way
communication between processes. It causes items to be taken out of
the queue in the order that they were put in (first in, first out).
Syntax mkfifo fifo_name
Parameters Takes one required parameter:
fifo_name the name of the fifo
Examples mkfifo \dev\propos
Same As RAPL-3 mknod() makes fifo, device, or socket
pipe() creates a private set of fifos
See Also chmod changes protection mode
May 2000
48 CROS and System Shell: System Shell Commands
mksock
make socket
Description Makes a new socket. A socket is an object for two-way
communication between processes.
A socket supports a client-server configuration for one server and
many clients with the sockets like a set of two-way pipes connected to
the server hub and the clients unable to talk to each other.
Syntax mksock socket_name
Parameters Takes one required parameter:
socket_name the name of the socket
Examples mksock \dev\carousel
Same As RAPL-3 mknod() makes socket, fifo, or device
socketpair() makes a private pair of sockets
See Also chmod changes protection mode
more
display more and more of a file
Description Displays the contents of the file at the terminal window 20 lines at a
time. More accurately, copies the contents of the file to the console
screen.
Syntax more file_name
Parameters Takes one required parameter:
file_name the name of the file (absolute or relative path)
Examples more \log\acid.log
May 2000
Chapter 2: System Shell Commands 49
mount
mount file system
Description Mounts a second file system at a point on the first file system.
Mounting a file system allows access to its files which are on a
different drive, device, or computer from the primary file system. The
mount point becomes the root of the second file system.
The mount command can only be used with systems using multiple
file systems, like those running CROS-NT.
Syntax mount [–r] hostfs mount_point filesystem_to_mount
msleep
millisecond sleep
Description Puts the shell to sleep for a number of milliseconds. Similar to the
effect of an msleep() call or delay() call within a program.
Syntax msleep number
Parameters Takes one required parameter:
number an integer specifying the number of milliseconds
Examples msleep 1000 # sleep for 1 second
May 2000
50 CROS and System Shell: System Shell Commands
mv
ren
move object
rename object
Description Moves or renames an object. At present you cannot move a directory.
Syntax mv old_object_name new_object_name
mv object_names… directory
Parameters To rename an object takes two required parameters. If the new name
already exists, the system displays a message and does not overwrite
it.
old_object_name the name being deleted
new_object_name the name being created
To move entities from one directory to another, takes at least two
required parameters:
object_names… a space-separated list of the objects being moved
directory the directory to move the objects into
Examples mv lab_test lab_1
move \app\test\dispense.r \app\dispense\dispense.r
mv beta.r beta.v3 \app\test
See Also cp (or copy) copies an object
ln makes a link to an object
rm (or del) removes (deletes) an object or link
odometer
robot armpower odometer
Description This command allows the user to examine the robot armpower
odometer, which gives how long the robot armpower has been on
since firmware installation.
Syntax odometer
Parameters None.
Example odometer
Result The robot has been running for 123.4 hours.
panel
front panel menu shell
Description This command uses the front panel F1 and F2 buttons and the lcd
display to provide a simple menu for selecting and executing shell
commands.
May 2000
Chapter 2: System Shell Commands 51
Option Description
-d label specify Specifies that if the front panel buttons
default menu have not been touched, the menu item
item with label label should be executed after
the timeout specified with the –T option
has elapsed.
-f filename read items Reads the list of selection items from a
from file file. It is expected that they are listed one
item per line in the file.
-h help Display a usage message.
-?
-n don’t take Normally, panel takes control of the robot
control of the when it starts up and after each command
robot has executed (for safety reasons.) The –
n option disables this behaviour.
-s sort Sort all of the selection entries
alphabetically, by their labels.
-T nnnn set timeout Specifies that if the panel has not been
touched, then after nnnn seconds the
default action will be taken if the –d option
has been supplied.
-t title set title Sets the title shown on the lcd display
when panel first starts up.
May 2000
52 CROS and System Shell: System Shell Commands
placed in quotes so that panel knows that it is just one item altogether.
panel –f /conf/panel.cfg
Load menu items from the specifed file (which is, in this case, a sample
file provided with the system.)
ps
process status
Description Displays the current status of every process on the system.
Syntax ps
Parameters none.
Example ps
Sample Result
pid ppid status flags prio time mem command
52 8 RUN ---r 2 0.120 7.43750K ps
7 6 READY t-pr 2 1.72e+3 11.3750K /sbin/robotsrv
6 1 READY t-pr 2 4.66e+3 11.3750K /sbin/robotsrv
5 3 IWIO --pr 2 3.28 13.4375K /sbin/fastacid
4 3 READY --pr 2 17.3 13.4375K /sbin/fastacid
3 1 WSEM --pr 2 0.683 13.4375K /sbin/fastacid
8 1 WAIT --pr 2 12.8 10.5000K shell
1 0 WAIT --p- 2 0.138 4.00000K (init)
Description The ps command gives nine columns of information: pid, ppid, status,
flags, prio, time, slip, mem, and command.
pid
process identification number
The identification number of the process. Assigned by the
operating system. During a session, each new process is assigned
a new number.
ppid
parent process identification number
The identification number of the parent process. The parent
process is the process that initiated the process identified by pid.
status
May 2000
Chapter 2: System Shell Commands 53
process status
The process is in one of the following states.
IWIO interruptible, waiting for input/output
READY ready to run, not currently running
RUN currently running (executing)
SLEEP waiting for sleep (time delay) to elapse
STOP execution stopped for diagnostic purpose
WAIT waiting for child process to finish running
WIO waiting for input/output
WSEM waiting for semaphore
WSOCK waiting to send or receive a message on a socket
ZOMB zombie: process has terminated, but the table entry
exists until the parent task deletes it from the
process table
flags
attribute flags
Indicators of attributes of the process. The first two are used for
CRS testing.
t timed out of wait; not yet revived
I interrupted; not yet re-started
p privileged: can change its priority above normal; can
mount and unmount directories
r RAPL-3 process, not a binary process
prio
priority level
The indicator of the level of priority for processing. Higher priority
processes get CPU time before lower priority processes.
1 high
2 normal
3 low
time
process time
The total time the process has been executing.
mem
memory used
Amount of memory used in Kbytes.
command
command name
The name of the process when called by the user at the prompt or
by another process.
system running time
The total time the system has been running during this session,
expressed in seconds. Large numbers of seconds are expressed in
exponential notation, like 2.3e+5
See Also kill terminate a process
May 2000
54 CROS and System Shell: System Shell Commands
pause
pause for the user to hit the return key
Description Optionally displays a prompt on the console and waits for the user to
hit the return key. This is useful inside scripts.
Syntax pause [-n] [text…]
Parameters There are two optional parameters:
pedit
pendant edit
Description This command invokes the teach pendant text editor. pedit can be
used to create and modify configuration and source files.
If no filename is specified, the pendant displays files to edit.
Syntax pedit [filename]
Parameters The command takes one optional parameter:
filename the name of the file to edit.
May 2000
Chapter 2: System Shell Commands 55
pwd
print working directory
Description Displays (prints to terminal screen) the current working directory.
Displays the full absolute path.
Syntax pwd
Parameters Takes no arguments.
Example pwd
Results /
/dev
/app/test
See Also cd changes current working directory
ls (or dir) lists contents of directory
r3c
compile
invoke the RAPL-3 compiler
Description The r3c command allows the user to recompile RAPL-3 programs.
There are a great number of command line options, many of which
are of interest only in very special circumstances.
Syntax r3c [-options} file1.r3 [file2.r3…]
Parameters There are two sets of parameters:
options options, from the table below.
file1.r3… a list of files to compile.
Option Description
-h help Display a complete usage message for
-? the compiler, listing all options.
-L libname use library Search the specified library for
-l line numbers Force line number information to be
included in the output file, even if
stripping all symbols (see –s and –x,
below.)
-o filename specify output Causes the compiled file to be written to
file name filename instead of to the default name.
(The default output name for file “x.r3” is
“x”.)
-P pipe Use pipes instead of temporary files
when compiling (saves file space during
May 2000
56 CROS and System Shell: System Shell Commands
Option Description
the compile.)
-s strip symbols Strip all symbols from the output file (to
save space)
-v verbose Be verbose when compiling.
-Wall warn on all Generate all possible warnings about
questionable code.
-Wmax maximum Warn on even remotely questionable
warnings code.
-Wnone warn on none Generate no questionable code
warnings.
-x exclude Exclude all symbols that are neither
symbols global nor exported. Used to minimize
the size of a library.
rc1
RAPL-3 compiler pass 1
Description The rc1 program is the main pass of the RAPL-3 compiler. It is not
generally accessible from the command line, but is instead called by
the r3c compiler driver program.
Syntax rc1 [-options][filename]
Parameters There are two optional parameters:
options options, from the table below.
filename name of the source file. If this is omitted,
then the compiler reads source from the
standard input.
Option Description
-? help Display a complete usage message for
the compiler, listing all options.
-L libname use library Search the specified library for
-l line numbers Force line number information to be
included in the output file, even if
stripping all symbols (see –s and –x,
below.)
May 2000
Chapter 2: System Shell Commands 57
Option Description
-o filename specify output Causes the compiled file to be written to
file name filename instead of to the default name.
(The default output name for file “x.r3” is
“x”.)
-s strip symbols Strip all symbols from the output file (to
save space)
-v verbose Be verbose when compiling.
-Wall warn on all Generate all possible warnings about
questionable code.
-Wmax maximum Warn on even remotely questionable
warnings code.
-Wnone warn on none Generate no questionable code
warnings.
-x exclude Exclude all symbols that are neither
symbols global nor exported. Used to minimize
the size of a library.
ren
rename object
Moves or renames an object.
See mv
rm
del
remove
delete
Description Removes (deletes) a reference to a set of objects (files, devices, fifos, or
sockets). When all references to an object have been deleted, the
object ceases to exist.
Syntax rm object_names…
Parameters Takes one parameter:
object_names… a space-separated list of objects to be removed
May 2000
58 CROS and System Shell: System Shell Commands
Examples rm test.r
See Also ln makes a link to an object
cp (or copy) copies an object
mv (or move) moves or renames an object
rmdir
remove directory
Description Removes (deletes) a directory. Only empty directories may be deleted;
an error message will be displayed if one attempts to remove a
directory that is not empty.
Syntax rmdir directory_names…
Parameters Takes one required parameter:
directory_names… a space separated list of the directories to be deleted.
Examples rmdir temp_test
See Also mkdir (or md) makes a directory
rpp
RAPL-3 pre-processor
Description The rpp program is the part of the RAPL-3 compiler that handles
.define macros and .ifdef conditionals. It is not generally accessible
from the command line, but is instead called by the r3c compiler
driver program.
Syntax rpp [-options] [infile [outfile]]
Parameters There are three options parameters:
options a set of options, from the table below
infile input file name (input is taken from the
standard input if this is omitted.)
outfile output file name (output is sent to the
standard output if this is omitted.)
Option Description
-? help Display a complete usage message for
–h the compiler, listing all options.
–H
-L no line Disable the automatic inclusion of line
numbers number information in the output file.
-Dname define Has the same effect as placing a
-Dname=value symbol “.define name 1” or “.define name value”
directive at the start if the input file.
May 2000
Chapter 2: System Shell Commands 59
Option Description
Note that if no value is given, the value
is defined to be “1”.
Example rpp myprog.r3 myprog.out
Result The RAPL-3 program myprog.r3 will be preprocessed and the
output placed in myprog.out.
shell
system shell
Description Starts a new system shell from a system shell or from an application
shell. The system shell interprets system commands.
Syntax shell
Parameters Takes no parameters.
Examples shell
See Also exit terminates a shell
ash starts a new application shell
shutdown
shut down
Description Shuts down the system in a controlled fashion. The system should
always be shut down before turning off the controller power.
Failure to shut down before power off can result in loss of all data on the
controller.
May 2000
60 CROS and System Shell: System Shell Commands
siocfg
serial input/output configuration
Description Changes the configuration of the serial ports.
The C500C controller has a total of four configurable serial ports:
ports 0 and 1 (/dev/sio1 and /dev/sio1) are available for application
use, port 2 (/dev/sio2) is reserved for the teach pendant, and port 3
(/dev/sio3) is used for the console.
The C500 controller only has two configurable serial ports: port 0
(/dev/sio0) is reserved for the teach pendant and port 1 (/dev/sio1) is
used for communications with the console.
CROSnt supports up to 64 serial ports: com1 corresponds to port 0
(/dev/sio0), com2 corresponds to port 1 (/dev/sio1), etc.
Be careful when changing the console port; if this gets set so that you
can no longer communicate with the robot, then the only way to
recover is to restore the C500C controller to its most basic port
settings by holding down the F1, F2, Pause/Continue, and Home
buttons during the controller’s boot-up cycle. If you perform a reset to
basic settings, the console port reverts to SIO0 on the back of the
controller. You will need a null modem serial cable to connect your
console to SIO0.
serial port association and baud rate
port C500 C500C (standard) C500C (reset)
sio0 pendant, 19200 57600 console, 57600
sio1 console, 38400 57600 57600
sio2 N/A pendant, 19200 pendant, 19200
sio3 N/A console, 57600 57600
Syntax siocfg -c port [-b baud] [-d data] [-p parity] [-s stop] [-v]
May 2000
Chapter 2: System Shell Commands 61
sync
synchronize filesystem buffers
Description Synchronizes (flushes) filesystem buffers in CROS-NT and
defragments memory in CROS-NT and CROS-500.
For CROS on a C500, primarily used to defragment memory.
For CROS on NT, the system buffers are flushed. In other words, any
information that CROS has not written to storage is written out.
Syntax sync
Parameters Takes no parameters.
Examples sync
See Also mem displays fragmentation of free space in memory
touch
touch file modification times
Description The touch command changes the modification time of a file to the
current time. It can be used, for example, to force programs like ash
to rebuild the v3 file for an executable.
Syntax touch file1 [file2…]
Parameters The touch command accepts a list of files to set the timestamps of.
Example touch myprog
Result The timestamp of myprog is set to the current time. If
ash is used to run myprog, ash will detect that myprog’s
v3 file is older than the program, and will use v3make to
rebuild the v3 file.
unmount
unmount file system
Description Unmounts a second file system from the mount point.
The mount and unmount commands can only be used with systems
using multiple file systems, like those running under CROS-NT.
Syntax unmount mount_point
Parameters Takes one required parameter:
mount_point the mount point of the file system to be dismounted
Examples unmount /mnt
See Also mount mounts a file system
May 2000
62 CROS and System Shell: System Shell Commands
v3make
make or update a v3 file for a program
Description The v3make command creates or updates (if the v3 file already
exists) the v3 file for a RAPL-3 executable. It is generally not used
directly by the user, but is instead run automatically from ash.
Syntax v3make [-options] exec_filename
Parameters There are two sets of parameters, one of which is required:
options a set of options, from the table below
exec_filename the name of the executable to construct /
update the v3 file for.
Option Description
-? help Display a usage message for program.
–h
-an add missing / Add any missing variables to the v3 file;
no adjust do not adjust any variables whose types
have changed. (this is the default
mode.)
-af add missing / Add any missing variables to the v3 file;
fix changed attempt to fix any variables whose types
have changed. [currently
unimplemented]
-ai add missing / Add any missing variables to the v3 file;
interactive fix ask the user about fixing any variables
whose types have changed. [currently
unimplemented]
-ar add missing / Add any missing variables to the v3 file;
replace replace variables whose types have
changed (causing their old values to be
lost.)
-d delete Delete any v3 variables that aren’t
needed.
-o filename output file Use filename as the v3 file instead of
automatically constructing the name
from the exec_filename.
-r replace Just replace any v3 file that currently
exists; all data in the old file is lost.
-v verbose be verbose
-V version print v3update’s version string and exit.
-w warnings give extra warnings.
Example v3make –an myprog
May 2000
Chapter 2: System Shell Commands 63
ver
version
Description Displays the version of the system shell being used.
Syntax ver
Parameters Takes no parameters.
Examples ver
Result CROS System Shell -- $Revision: 1.15 $
See Also crosver displays version of CROS
ver (in the application shell) displays version of application shell
May 2000
64 CROS and System Shell: System Shell Commands
May 2000
Running applications directly from the system shell is more efficient because it uses less memory, as the application shell or teach pendant is not loaded into memory, thus freeing resources . Using the application shell or teach pendant consumes additional controller resources, affecting resource availability for running the application .
The 'msleep' command pauses the execution of the shell for a specified number of milliseconds. This can be critical in script execution and process scheduling to ensure that certain tasks are temporally synchronized or delayed to accommodate processing time or resource availability .
The 'df' command should be used to check free bytes on a CROS system with multiple file systems. The command takes an optional directory or filename parameter specifying which file system to check. Without a parameter, it defaults to the current directory. For CROS on systems like Windows NT, specifying the directory ensures accurate disk space reporting .
To execute a RAPL-3 program in CROS, the object file, created upon successful compilation, must exist on the controller. Executables have no extensions while source files use .r3 and variable files .v3 extensions . The command line is used to navigate to the directory containing the executable, and the program name is executed directly. Use the 'ps' command to verify the running process by viewing it in the process table .
When starting with CROS not yet running, a terminal session can be opened beforehand, and it will connect automatically during CROS startup, displaying startup messages before the $ prompt appears . If CROS is already running, a new terminal session can be opened, and pressing Enter will access the system shell prompt. System shells can be started and managed independently without needing a terminal open continuously .
Using the 'rm' command in CROS permanently deletes a file, making it unrecoverable . An alternative strategy involves creating a 'trash' directory and moving files into this directory using the 'mv' command. This allows for temporary storage until the user is certain the files can be permanently deleted .
To check the system shell version number, the command 'ver' should be entered at the system shell prompt. This command will display the version of the system shell currently being used .
A user would use the 'mv' command in the system shell, which allows moving an object and renaming it simultaneously. The syntax requires listing the old file name and desired new file path/name. For example, moving and renaming a file could be done with 'mv old_object_name new_object_name' or in the context of directories 'mv object_names... directory' .
The 'ash' command accesses the application shell within CROS, allowing users to specify an application name to open it directly or list available shells if no name is given . This command provides a method to manage and execute applications efficiently within a development environment, and users can exit back to the system shell or open additional shells as needed .
The 'crosver' command displays the version of the operating system being used, crucial for system management and compatibility checks. It uses no parameters and outputs details such as system type and version number, facilitating system audits and version control .