Current functionalities
On this page are listed all the objects currently distributed with Crappy and exposed to the users. Information on how to use them can be found in the Tutorials, as well as guidelines for creating your own objects. For most Blocks, one or several directly runnable example scripts are available in the examples folder of the GitHub repository. For each object listed on this page, you can click on its name to open the complete documentation given in the API.
Functionalities (Blocks)
The Blocks are the base bricks of Crappy, that fulfill various functions. In the tutorials, you can learn more about how to use Blocks and how to create new Blocks.
Data display
-
Displays the data it receives on top of a static image, e.g. for having a real-time temperature map.
The examples folder on GitHub contains one example of the Canvas Block.
-
Prints the values it receives in a popup window with a nicer formatting than Link Reader. Unlike the Grapher Block, only the latest value is displayed for each label.
The examples folder on GitHub contains one example of the Dashboard Block.
-
Plots real-time 2D graphs. It is possible to plot several datasets on a same graph. The x axis can be the time information, or any other label that the Grapher receives. Unlike the Dashboard Block, the displayed data is persistent and allows to visualize the history of a label.
The examples folder on GitHub contains one example of the Grapher Block specifically, but it is also used in most of the other examples.
A tutorial section is also dedicated to the Grapher Block.
-
Prints the values it receives in the terminal. Mostly useful for debugging.
The examples folder on GitHub contains one example of the Link Reader Block.
Data recording
-
Writes the data it receives to a .hdf5 file. Only compatible with the IOBlock in streamer mode. The Recorder should be used for recording any other type of data.
The examples folder on GitHub contains one example of the HDF Recorder Block.
-
Writes the data it receives to a .csv file, for recording it. It is compatible with data from any Block, except data coming from an IOBlock in streamer mode. The HDF Recorder should be used instead in this situation.
The examples folder on GitHub contains one example of the Recorder Block.
A tutorial section is also dedicated to the Recorder Block.
Data processing
-
Calculates the average of the received labels over a given period, and sends it to downstream Blocks. One average value is given for each label, it is not meant to average several labels together. Can be used as a less computationally-intensive Multiplexer.
The examples folder on GitHub contains one example of the Mean Block.
-
Allows putting labels emitted at different frequencies on a same time basis. Useful for plotting curves out of two labels from different Blocks with a Grapher, as the timestamps of the data points would otherwise never match. Also used before saving data with a Recorder to simplify the post-processing.
The examples folder on GitHub contains one example of the Multiplexer Block.
-
Allows putting labels emitted at different frequencies on the same time base as a reference label. Very similar to the Multiplexer Block, except the Multiplexer takes an independent time base for interpolation. Used when the original values of a label need to be preserved while the other labels can be interpolated, for example when the reference is the output of a low-frequency image-processing.
Real-time image correlation
-
Child of the Camera Block that can acquire, record and display images. In addition, it performs real-time Dense Inverse Search (DIS) image correlation on the acquired images using
cv2
’s DISOpticalFlow, and projects the displacement field on a predefined basis. The result is then sent to downstream Blocks.The examples folder on GitHub contains several examples of the DIS Correl Block.
-
Same as DIS Correl, except the computation is performed on a Cuda-compatible GPU.
There is currently no example featuring this Block distributed in the examples folder on GitHub.
Important
This Block hasn’t been maintained nor tested for a while, it is not sure that it still works as expected ! On the long-term, it should be replaced by another Block.
Warning
This Block cannot run with CUDA versions greater than 11.3 ! This is due to a deprecation in pycuda, and is unlikely to be fixed anytime soon in Crappy or pycuda.
Video-extensometry
-
This Block drives an Actuator, just like the Machine Block. However, it does it in a very specific context. It allows moving a Camera performing video-extensometry and mounted on an Actuator, so that the barycenter of the tracked dots remains in the center of the image. To do so, it takes the output of a Video Extenso Block as its input.
The examples folder on GitHub contains one example of the Auto Drive Block.
-
Child of the Camera Block that can acquire, record and display images. In addition, it performs image correlation on four patches on the acquired images. From the correlation, it deduces the x and y displacement of each patch, and can then calculate the global strain on the filmed sample. The displacements and the strain values are sent to downstream Block. Can be used to replace Video Extenso on samples with a speckle drawn on them, each patch playing the same role as a dot.
The examples folder on GitHub contains several examples of the DIC VE Block.
-
Same as DIC VE, except the computation is done on a Cuda-compatible GPU.
There is currently no example featuring this Block distributed in the examples folder on GitHub.
Important
This Block hasn’t been maintained nor tested for a while, it is not sure that it still works as expected ! On the long-term, it should be replaced by another Block.
Warning
This Block cannot run with CUDA versions greater than 11.3 ! This is due to a deprecation in pycuda, and is unlikely to be fixed anytime soon in Crappy or pycuda.
-
Child of the Camera Block that can acquire, record and display images. In addition, it performs real-time video-extensometry on the acquired images. It can track from two to four spots drawn on the filmed sample, and tracks the position of each spot to get their displacement. Based on the displacements, a global x and y strain values are computed. The strain and the displacement values are sent to downstream Blocks. The DIC VE Block performs a similar task but uses image correlation for tracking the areas.
The examples folder on GitHub contains one example of the Video Extenso Block.
Signal generation
-
Creates a small graphical window with a button in it, and generates a signal when the user clicks on the button. This signal is sent to downstream Blocks. Useful for triggering a behavior at a user-chosen moment during a test.
The examples folder on GitHub contains one example of the Button Block.
-
Generates a signal following a pattern given by the user (like sine waves, triangles, squares, etc.), and sends this signal to downstream Blocks. It can only output a combination of Generator Paths.
The examples folder on GitHub contains several examples of the Generator Block specifically, but it is also used in many of the other examples.
A tutorial section is also dedicated to the Generator Block, and another one is dedicated to the creation of custom Generator Paths.
-
Takes a setpoint target as an input, as well as an actual measured value. Then, calculates a command value following a PID controller logic, and sends it to downstream Blocks (usually to the actuator that drives the system on which the measured value is acquired). Useful for driving a system whose exact characteristics are unknown or can vary.
The examples folder on GitHub contains one example of the PID Block.
Hardware control
-
Acquires images from a Camera object, and then displays and/or records the acquired images. It is the base class for other Blocks that can also perform image processing, in addition to the recording and display. This Block usually doesn’t have input nor output Links, but can in some specific situations.
The examples folder on GitHub contains several examples of the Camera Block.
A tutorial section is also dedicated to the Camera Block, and another one is dedicated to the creation of custom Camera objects.
-
Controls one InOut object, allowing to read data from sensors and/or to give it commands to set on hardware. It is originally intended for interfacing with DAQ boards, but can also be used to drive a variety of other devices. It has output Links when acquiring data, and input Links when setting commands.
The examples folder on GitHub contains several examples of the IOBlock Block.
A tutorial section is also dedicated to the IOBlock Block, and another one is dedicated to the creation of custom InOut objects.
-
Drives one or several Actuator in speed or in position, based on the received command labels. Can also acquire the current speed and/or position from the driven Actuators, and return it to the downstream Blocks. This Block is intended for driving motors and similar devices.
The examples folder on GitHub contains several examples of the Machine Block.
A tutorial section is also dedicated to the Machine Block, and another one is dedicated to the creation of custom Actuator objects.
-
Controls a microcontroller over serial. A MicroPython and an Arduino template to use along with this Block are provided with Crappy. This Block can start or stop the script on the microcontroller, send commands, and receive data.
The examples folder on GitHub contains on example of the UController Block.
Others
-
Sends and/or receives data over a local network via an MQTT server. Can also start a Mosquitto MQTT broker. Used for communicating with distant devices over a network, e.g. for remotely controlling a test.
The examples folder on GitHub contains on example of the Client Server Block.
-
Emulates the behavior of a tensile test machine, taking a position command as input and outputting the force and the displacement. Mainly used in the examples because it doesn’t require any hardware, but may as well be used for debugging or prototyping.
The examples folder on GitHub contains on example of the Fake Machine Block.
-
Discards any received data. Used for prototyping and debugging only.
The examples folder on GitHub contains on example of the Sink Block.
-
Stops the current Crappy script if the received data meets one of the given criteria. One of the clean ways to stop a script in Crappy.
The examples folder on GitHub contains on example of the Stop Block.
Refer to the dedicated tutorial section to learn more about how to properly stop a script in Crappy.
-
Stops the current Crappy script when the user clicks on a button in a GUI. One of the clean ways to stop a script in Crappy.
The examples folder on GitHub contains on example of the Stop Button Block.
Refer to the dedicated tutorial section to learn more about how to properly stop a script in Crappy.
Supported hardware (Cameras, InOuts, Actuators)
Supported Cameras
-
Allows reading images from a camera communicating over Camera Link plugged to a microEnable 5 ironman AD8-PoCL PCIexpress board. May as well work with similar boards.
Important
This Camera object relies on C++ libraries, which are not distributed with
pip
. They can only be used after a local install, after cloning the repo.Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected ! On the long-term, it should be totally removed.
-
This Camera object opens video streams using the Python binding of Gstreamer. It can open a camera by path (in Linux) or number (in Windows and Mac), in which case the GStreamer pipeline is generated automatically. Alternatively, it can also open a stream following a custom pipeline given by the user.
Compared to the Camera OpenCV camera, the GStreamer one is less CPU-intensive and is compatible with more devices. Its dependencies are however harder to install (especially on Windows) and it is harder to make it work properly.
Important
This Camera object can only be used at its fullest on Linux, and only if the v4l-utils package is installed on the system !
-
This Camera object opens video streams using OpenCV. It allows tuning the device number, as well as the image format and the number of channels. It is mostly compatible with USB cameras, and its dependencies are straightforward to install.
Important
This Camera object can only be used at its fullest on Linux, and only if the v4l-utils package is installed on the system !
-
Simply displays an animated image of a chosen size and at a given frequency. Doesn’t require any hardware, used mainly for debugging and prototyping.
-
Successively reads images already saved in a folder, and returns them as if they just had been acquired by a real camera. No real image acquisition is performed though, and no hardware is required.
-
Allows reading images from a Jai GO-5000M-PMCL camera. It relies on the Basler Ironman Camera Link object.
Important
This Camera object relies on C++ libraries, which are not distributed with
pip
. They can only be used after a local install, after cloning the repo.Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected ! On the long-term, it should be totally removed.
-
Allows reading images from a Raspberry Pi Camera, with Crappy running on a Raspberry Pi. It has been tested on Raspberry Pi 3 and 4, with a variety of official Raspberry Pi cameras.
Important
Can only be run on a Raspberry Pi ! Also, it is for now only compatible with the Buster version of Raspberry Pi OS, or with Bullseye in legacy camera mode.
-
Allows reading images from a Seek Thermal Compact Pro infrared camera.
-
Reads images from a video device recognized by OpenCV. Usually webcams fall into this category, but some other cameras as well. This class is really basic and is intended for demonstration, see Camera OpenCV and Camera GStreamer for classes providing a finer controls over the devices.
-
Allows reading images from any Ximea camera. The backend is the official Ximea API.
Supported Actuators
-
Drives up to 4 DC motors using Adafruit’s DC & Stepper Motor HAT for Raspberry Pi, using either Adafruit’s Blinka library or
smbus2
if driven from a Raspberry Pi. Although this component can also drive stepper motors, this feature was not implemented.Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Emulates the dynamic behavior of a DC motor, but doesn’t drive any hardware. Used in the examples, may also be used for prototyping or debugging.
-
Emulates the dynamic behavior of a stepper motor used as a linear actuator, but does not drive any actual hardware. It is used in examples, and can also be used for debugging. Unlike the Fake DC Motor, it can drive the motor in position.
-
Drives JVL’s MAC140 integrated servomotor in speed or in position. Probably works with other integrated servomotors from JVL, although it hasn’t been tested.
Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Drives Kollmorgen’s Servostar 300 servomotor conditioner in position or sets it to the analog driving mode. This is the same conditioner as for the Biaxe Actuator, but this object was designed for an other application.
Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Drives Newport’s TRA6PPD miniature linear stepper motor actuator, in speed or in position.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Drives Oriental Motor’s ARD-K stepper motor driver in speed or in position. Probably works with other stepper motor drivers in the same range of products, although it hasn’t been tested.
Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Drives 4A bipolar stepper motors using Phidget’s Stepper4A in speed or in position, by using several Phidget libraries.
Important
This Actuator must be connected to Phidget’s VINT Hub to work. See the following link https://www.phidgets.com/?prodid=1278#Tab_User_Guide to connect properly to the Hub.
-
Drives Pololu’s Tic stepper motor drivers in speed or in position. Designed for driving all the Tic drivers, but tested only on the 36v4 model.
-
Drives Schneider Electric’s MDrive 23 stepper motor in speed or in position. Probably works with other stepper motors in the same range of products, although it hasn’t been tested.
Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
Supported Sensors and outputs
Acquisition boards
-
Controls Labjack’s T7 acquisition board. It can acquire data from its ADCs, set the output of DACs, read and set the GPIOs, and also supports more advanced functions like reading thermocouples.
-
Controls Labjack’s T7 acquisition board in streaming mode. In this mode, it can only acquire data from the ADCs and does not support any other function.
-
Controls Labjack’s UE9 acquisition board. It can only read the input analog channels of the board.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Controls Waveshare’s AD/DA Raspberry Pi acquisition hat. May be used from any device with a proper wiring, but more convenient to use from a Raspberry Pi. Communicates over SPI.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Controls Waveshare’s High Precision HAT Raspberry Pi acquisition hat. It features a 10-channels 32 bits ADC. It may be used from any device able to communicate over SPI, but is originally meant for interfacing with a Raspberry Pi.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
Sensors
-
Reads voltages from Adafruit’s ADS 1115 ADC. Communicates over I2C.
-
Reads voltages or resistances from Agilent’s 34420A precision multimeter. Communicates over serial.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Can acquire the current RAM usage of the computer using the
psutil
module, and also instantiate useless objects to reach a target memory usage (if superior to the base memory usage). It supports the streamer mode for the data acquisition. Mainly intended for demonstration, and used in the distributed examples. -
Reads temperatures from Adafruit’s MCP9600 thermocouple amplifier. Communicates over I2C.
-
Reads pressures from Adafruit’s MPRLS pressure sensor. Communicates over I2C.
-
Reads voltages from Sparfun’s ‘Qwiic Scale’ NAU7802 load cell conditioner. Communicates over I2C.
-
Reads data from OpSens’ single channel signal conditioner for fiber-optics temperature, strain, pressure or position measurement. Communicates over serial.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Reads volatges from Phidget’s Wheatstone Bridge load cell conditioner, by using several Phidget libraries.
Important
This InOut must be connected to Phidget’s VINT Hub to work. See the following link https://www.phidgets.com/?prodid=957#Tab_User_Guide to connect properly to the Hub.
-
Reads the charging status and battery level of Kubii’s PiJuice Raspberry Pi power supply.
Important
This InOut was written for a specific application, so it may not be usable as-is in the general case.
-
Reads voltages from Spectrum’s M2i 4711 EXP high-speed ADC communicating over PCIexpress.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
Multi-device drivers
-
Reads voltages from an USB-DUX Sigma ADC (not manufactured anymore) using the Comedi driver. The code was written to work as-is on other acquisition boards supporting the Comedi driver, but this hasn’t been tested. Communicates over serial.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Same as NI DAQmx, except it relies on the
PyDAQmx
module. The differences between the two modules weren’t further investigated.Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
-
Controls National Instrument’s USB 6008 DAQ module using the
nidaqmx
module. The code was written to work as-is on other National Instruments acquisition modules, but this hasn’t been tested. Communicates over USB.Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
Outputs
-
Controls a PWM output on a single GPIO of a Raspberry Pi.
Important
Only works on a Raspberry Pi ! Tested on Raspberry Pi 3 and 4, with the Buster and Bullseye Raspberry Pi Os for the latter.
-
Drives a single GPIO on a Raspberry Pi, or any other board supporting Blinka.
Important
Only works on a Raspberry Pi ! Tested on Raspberry Pi 3 and 4, with the Buster and Bullseye Raspberry Pi Os for the latter.
-
Uses Waveshare’s GSM/GPRS/GNSS/Bluetooth hat for sending SMS. The other functionalities are not implemented. Usable from any device with a proper wiring, but more convenient to use with a Raspberry Pi. Communicates over serial.
Important
This InOut was written for a specific application, so it may not be usable as-is in the general case.
Enhanced Actuators
-
Drives Kollmorgen’s AKD PDMM servomotor controller. As this device supports many settings, it was decided to consider it as an InOut to fully take advantage of its versatility.
Important
This InOut was written for a specific application, so it may not be usable as-is in the general case.
Important
This object hasn’t been maintained nor tested for a while, it is not sure that it still works as expected !
LaMcube-specific hardware
-
An infrared camera acquiring on two wavelengths at the same time.
Important
Only intended for an internal use in our laboratory as it is not commercially available.
-
Drives Kollmorgen’s Servostar 300 servomotor conditioner in speed. May as well work on other conditioners from the same brand, although it hasn’t been tested.
Important
This Actuator was written for a specific application, so it may not be usable as-is in the general case.
-
A simple wrapper around the JVL Mac140 Actuator, to keep the legacy name of this object.
On-the-fly data modification (Modifiers)
-
Takes the signal returned by a streaming IOBlock and transforms it into a regular signal usable by most Blocks. This Modifier is mandatory for plotting data from a streaming device.
-
Calculates the time derivative of a given label.
-
Transmits the values to downstream Blocks only once every given number of points. The values that are not sent are discarded. The values are directly sent without being altered.
-
Integrates a given label over time.
-
Returns the mean value of a label over a given number of points. Only returns a value once every number of points.
-
Returns the median value of a label over a given number of points. Only returns a value once every number of points.
-
Offsets the given labels by a constant value calculated so that the first received value is offset to a given target.
-
Returns the moving average of a label over a given number of points. Returns a value at the same frequency as the label.
-
Returns the moving median of a label over a given number of points. Returns a value at the same frequency as the label.
-
Returns the received label only if the new value differs from the previous one.
-
Returns the received label only if the value is in a predefined list of accepted values.