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
-
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.
-
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.
-
Prints the received values in the terminal. Mostly useful for debugging.
No example featuring a Reader block is currently distributed.
-
Prints received values in a popup window and with a nicer formatting than Reader.
No example featuring a Dashboard block is currently distributed.
-
Displays real-time images from a camera.
Refer to the displayer.py example for a use case.
Data recording
-
Writes received data to a file, usually in a .csv.
Refer to the tensile_1.py example (among others) for a use case.
-
Writes received data to an hdf5 file.
Refer to the spectrum.py example for a use case.
Data processing
-
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.
-
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
-
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.
-
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
-
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.
-
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.
-
Same as Disve except the computation is done on a Cuda-compatible GPU.
No example featuring a GPUve block is currently distributed.
-
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
-
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.
-
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.
-
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
-
Controls one or several actuators according to the received command signal.
Refer to the custom_actuator.py example for a use case.
-
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.
-
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.
-
Controls one camera and reads images from it.
Refer to the custom_camera.py example for a use case.
Others
-
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.
-
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.
-
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
-
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.
-
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.
-
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.
-
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 asetup
install, see Installation for details.Important
This camera object hasn’t been tested on recent releases !
-
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.
-
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 asetup
install, see Installation for details.Important
This camera object hasn’t been tested on recent releases !
-
Allows reading images from a PiCamera, using a Raspberry Pi.
Important
Can only be run on a Raspberry Pi !
-
Allows reading images from a Seek Thermal Compact Pro infrared camera.
-
Successively reads images already saved in a folder, and returns them. No image acquisition is performed and no hardware is required.
-
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 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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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 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.
Supported Sensors and outputs
Acquisition boards
-
Controls Labjack’s T7 acquisition board.
-
Controls Labjack’s UE9 acquisition board.
-
Controls Labjack’s T7 acquisition board in streaming mode.
-
Controls the Open-DAQ acquisition board. Communicates over USB.
-
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.
-
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.
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.
-
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 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 data from Opsens’ single channel signal conditioner for fiber-optics temperature, strain, pressure or position measurement. Communicates over serial.
-
Reads voltages from Spectrum’s M2i 4711 EXP high-speed ADC communicating over PCIexpress.
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.
-
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. -
Same as NI DaQMX, except it relies on the
PyDAQmx
module. The differences between the two modules weren’t further investigated.
Outputs
-
Drives a single GPIO on a Raspberry Pi.
Important
Only works on a Raspberry Pi !
-
Controls a PWM output on a single GPIO of a Raspberry Pi.
Important
Only works on a Raspberry Pi !
-
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.
Real-time data processing (Modifiers)
-
Stretches a given image according to the received strain and adds it in the link with the chosen label. The image is a parameter of the modifier, as well as the labels for the strains and the label of the stretched image. Used in the examples for emulating video-extensometry images.
-
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.
-
Calculates the time derivative of a given label.
-
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.
-
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.