Current functionalities

Here are listed all the blocks, hardware and other objects currently distributed with Crappy. Information on how to use them can be found in Tutorials, as well as guidelines for adding your own functionalities.

Functionalities (Blocks)

Data plotting

  • Grapher

    Plots real-time 2D graphs. Possible to plot several data sets on a same graph.

    Most of the examples include a Grapher block, refer to them for a use case.

  • Drawing

    Displays data on top of a static image, e.g. for having a real-time temperature map.

    Refer to the drawing.py example for a use case.

  • Reader

    Prints the received values in the terminal. Mostly useful for debugging.

    No example featuring a Reader block is currently distributed.

  • Dashboard

    Prints received values in a popup window and with a nicer formatting than Reader.

    No example featuring a Dashboard block is currently distributed.

  • Displayer

    Displays real-time images from a camera.

    Refer to the displayer.py example for a use case.

Data recording

  • Recorder

    Writes received data to a file, usually in a .csv.

    Refer to the tensile_1.py example (among others) for a use case.

  • HDF Recorder

    Writes received data to an hdf5 file.

    Refer to the spectrum.py example for a use case.

Data processing

  • Mean

    Calculates the average of the received labels over a given period. One average is given for every label, it is not meant to average several labels together. Can be used as a less computationally-intensive Multiplexer.

    Refer to the mean.py example for a use case.

  • Multiplexer

    Allows putting labels emitted at different frequencies on a same time basis. Useful for plotting curves made of two labels from different blocks, as the timestamps of the data points would otherwise never match. Also used before saving data to ease post-processing.

    Refer to the multiplexer.py example for a use case.

Real-time correlation

  • Discorrel

    Performs real-time Dense Inverse Search (DIS) image correlation using cv2’s DISOpticalFlow, and projects the displacement field on a predefined basis.

    Refer to the discorrel_basic.py example for a use case.

  • GPUCorrel

    Same as Discorrel except the computation is done on a Cuda-compatible GPU.

    Refer to the gpucorrel_fake_test.py example for a use case.

Video-extensometry

  • VideoExtenso

    Performs real-time video-extensometry on two to four dots and returns the x and y strains.

    Refer to the ve_fake_test.py example for a use case.

  • Disve

    Performs DIS correlation just like Discorrel but only on the areas selected by the user, and returns the x and y displacement for each area. Can be used to replace VideoExtenso on speckled samples, each area playing the same role as a dot.

    No example featuring a Disve block is currently distributed.

  • GPUve

    Same as Disve except the computation is done on a Cuda-compatible GPU.

    No example featuring a GPUve block is currently distributed.

  • Autodrive

    Allows moving a camera performing video-extensometry and mounted on an actuator, so that the barycenter of the dots remains in the center of the image.

    No example featuring an Autodrive block is currently distributed.

Signal generation

  • Generator

    Generates a signal following a predefined pattern. See the tutorials for information on how to use it.

    Refer to the generator.py example for a use case.

  • GUI

    Generates a signal when the user clicks on a button in a GUI. Useful for triggering a behavior during an assay.

    Refer to the videoextenso_reset_def.py example for a use case.

  • PID

    Generates a signal based on the target and measured inputs according to a PID controller logic.

    Refer to the pid.py example for a use case.

Hardware control

  • Machine

    Controls one or several actuators according to the received command signal.

    Refer to the custom_actuator.py example for a use case.

  • IOBlock

    Controls one inout object, allowing to read data from it and/or to give it inputs.

    Refer to the custom_in.py and custom_out.py examples for use cases.

  • UController

    Controls a microcontroller over serial. A template of a MicroPython script to run on the microcontroller is provided in Crappy. This block can start or stop the script on the microcontroller, send commands, and receive data.

    Refer to the microcontroller.py example for a use case.

  • Camera

    Controls one camera and reads images from it.

    Refer to the custom_camera.py example for a use case.

Others

  • Client Server

    Sends and/or receives data from an MQTT server. Can also start a Mosquitto MQTT broker. Used for communicating with distant devices over a network, e.g. for remotely controlling an assay.

    No example featuring a Client Server block is currently distributed.

  • Fake machine

    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.

    Refer to the fake_test.py example (among others) for a use case.

  • Sink

    Discards any received data. Used for prototyping and debugging only.

    No example featuring a Sink block is currently distributed.

Supported hardware (cameras, inouts, actuators)

Supported cameras

  • Bispectral

    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.

  • Camera GStreamer

    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.

  • Camera OpenCV

    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.

  • Camera link

    Allows reading 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 are only available using a setup install, see Installation for details.

    Important

    This camera object hasn’t been tested on recent releases !

  • Fake Camera

    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.

  • File Reader

    Successively reads images already saved in a folder, and returns them. No image acquisition is performed and no hardware is required.

  • JAI

    Allows reading from a Jai GO-5000M-PMCL camera. It relies on the Camera link object.

    Important

    This camera object relies on C++ libraries, which are not distributed with pip. They are only available using a setup install, see Installation for details.

    Important

    This camera object hasn’t been tested on recent releases !

  • PiCamera

    Allows reading images from a PiCamera, using a Raspberry Pi.

    Important

    Can only be run on a Raspberry Pi !

  • Seek Thermal Pro

    Allows reading images from a Seek Thermal Compact Pro infrared camera.

  • Webcam

    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.

  • Xi API

    Allows reading images from any Ximea camera. The backend is the official Ximea API.

Supported Actuators

  • Biaxe

    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.

  • Biotens

    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.

  • CM Drive

    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.

  • Fakemotor

    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.

  • Motorkit pump

    Drives Adafruit’s DC & Stepper Motor HAT for Raspberry Pi in Volts, using Adafruit’s Blinka library.

    Important

    This actuator was written for a specific application, so it may not be usable as-is in the general case.

  • Oriental

    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.

  • Pololu Tic

    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.

  • Servostar

    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.

  • TRA6PPD

    Drives Newport’s TRA6PPD miniature linear stepper motor actuator, in speed or in position.

Supported Sensors and outputs

Acquisition boards

  • Labjack T7

    Controls Labjack’s T7 acquisition board.

  • Labjack UE9

    Controls Labjack’s UE9 acquisition board.

  • T7 Streamer

    Controls Labjack’s T7 acquisition board in streaming mode.

  • Waveshare AD/DA

    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.

  • Waveshare AD/DA FT232H

    Almost the same code as Waveshare AD/DA, except it’s been optimized for use with a FT232H USB to SPI adapter. Communicates over SPI.

  • Waveshare High Precision

    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.

Sensors

  • ADS1115

    Reads voltages from Adafruit’s ADS 1115 ADC. Communicates over I2C.

  • Agilent 34420A

    Reads voltages or resistances from Agilent’s 34420A precision multimeter. Communicates over serial.

  • MCP9600

    Reads temperatures from Adafruit’s MCP9600 thermocouple amplifier. Communicates over I2C.

  • MPRLS

    Reads pressures from Adafruit’s MPRLS pressure sensor. Communicates over I2C.

  • NAU7802

    Reads voltages from Sparfun’s ‘Qwiic Scale’ NAU7802 load cell conditioner. Communicates over I2C.

  • PiJuice

    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.

  • Opsens

    Reads data from Opsens’ single channel signal conditioner for fiber-optics temperature, strain, pressure or position measurement. Communicates over serial.

  • Spectrum

    Reads voltages from Spectrum’s M2i 4711 EXP high-speed ADC communicating over PCIexpress.

Multi-device drivers

  • Comedi

    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.

  • NI DaQMX

    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.

  • DaQMX

    Same as NI DaQMX, except it relies on the PyDAQmx module. The differences between the two modules weren’t further investigated.

Outputs

  • GPIO switch

    Drives a single GPIO on a Raspberry Pi.

    Important

    Only works on a Raspberry Pi !

  • GPIO PWM

    Controls a PWM output on a single GPIO of a Raspberry Pi.

    Important

    Only works on a Raspberry Pi !

  • GSM

    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

  • Kollmorgen

    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.

Real-time data processing (Modifiers)

  • Demux

    Takes the signal returned by a streaming device and transforms it into a signal similar to the one of a regular device. This modifier is mandatory for plotting data from a streaming device.

  • Differentiate

    Calculates the time derivative of a given label.

  • Integrate

    Integrates a given label over time.

  • Mean

    Returns the mean value of a label over a given number of points. Only returns a value once every number of points.

  • Median

    Returns the median value of a label over a given number of points. Only returns a value once every number of points.

  • Moving average

    Returns the moving average of a label over a given number of points. Returns a value at the same frequency as the label.

  • Moving med

    Returns the moving median of a label over a given number of points. Returns a value at the same frequency as the label.

  • Trig on change

    Returns the received label only if the new value differs from the previous one.

  • Trig on value

    Returns the received label only if the value is in a predefined list.