How-to use SSM

SSM can be used by following these steps:

  • Launch SSM
  • Launch the sensor driver programs
  • Launch the programs that use the sensor data

The following utility programs are also available upon usage:

  • lsssm: Lists all the sensors registered in SSM
  • ssmlogger: Records the data for sensors currently registered in SSM as separate log files
  • ssmmultiplayer: Simultaneously plays the recorded sensor data
  • ssmtransport: Shares the sensor data in SSM with other PC

Launching SSM

SSM needs to be launched by running ssm (or ./ssm in the directory). Using the utility programs

lsssm

Running lsssm while ssm and SensorA_driver (for instance) running gives something like the following:

./lsssm
No. |  sensor name   | suid |  size  |  num | tnum | cycle[s] |
----+----------------+------+--------+------+------+----------+
000 |    sensor_A    |    0 |     20 |  143 |  143 |    0.100 |
----+----------------+------+--------+------+------+----------+
Total 1 sensors.
The registered sensors are listed in the given fashion.

ssmlogger

ssmlogger records the data of registered sensors into individual files. Any data from sensors registered in SSM can be recorded.

./ssmlogger -n <sensor name> -i <sensor_id> -l <file_name>
Multiple ssmlogger can be run simultaneously in order to record multiple data.

Ex. Recording the SensorA data using ssmlogger Launch SensorA_driver, then

./ssmlogger -n sensor_A -l sensor_A.log
and hit ctrl+c twice when enough data is taken. There should be a file called “sensor_A.log” generated in the directory.

Multiple logs can be generated when ssmlogger is run several times. For example, enter

./ssmlogger -n sensor_A -l sensor_A.log & ./ssmlogger -n sensor_B -l sensor_B.log
while both SensorA_driver and SensorB_driver are running.

Shell scripts would also come in handy. Entering

./logging.sh <directory_name>
creates a directory and generates all the log files under it.

ssmmultiplayer

ssmmultiplayer plays the recorded sensor data via corresponding log files.

./ssmmultiplayer <log_file1> <log_file2> <log_file3> …
Ex. Playing multiple logs simultaneously (sensor A and sensor B)
./ssmmultiplayer sensor_A.log sensor_B.log
The time frame for the replay begins at where the first log file starts at.

If all log files are contained in a single directory, entering

./ssmmultiplayer <directory_name>/*
would play them all.

WARNING: Since ssmmultiplayer refers to the timestamp while log files are being played, the time lag between the sensor measurement and the PC reading (e.g. due to communication delay) gets ignored. Therefore, the replay data may slightly differ from the actual sensor measurement.

ssmtransport

This is the software that allows multiple PCs to share the sensor data. Using this software, sensors connected to a PC may also be used by another PC.

The communication between PCs needs to be 1v1. Data from multiple sensors can (potentially) be transferred. Both PCs have to contain a file called send_sensors with sensor names and IDs of the sensors that need to be sent from corresponding PCs written, and the server runs

./ssmtransport
while the client runs
./ssmtransport <server_IP>
in order to start the communication.

WARNING: Do not write the same sensor name into send_sensors for both PCs. Also, it is highly recommended for the PCs to synch their time using NTP etc.

Registering Data with Higher Capacity

Image data usually requires relatively higher memory capacity (about 24MB/s); because SSM accumulates the data into the shared memory, the amount that can be recorded depends on the amount of the shared memory. The size of the shared memory reserved can be checked at

/proc/sys/kernel/shmmax
The size can temporarily be changed by entering
echo <new_size> /proc/sys/kernel/shmmax
but it can also be eternally fixed by adding
kernel.shmmax = <new_size>
into files such as /etc/sysctl.conf.