v2.0.0
Version 2.0.0
The version 2.0.0 of Crappy is a backwards-incompatible release that contains almost one year's worth of work.
It brings notable changes at almost every level in the module, and constitutes a clean base for future developments of Crappy.
The transition from version 1.5 to version 2.0 is not seamless for users, but still clearly documented. Refer to a Discussion to come for more information about it.
The main changes in the module between versions 1.5 and 2.0 are listed below.
Main changes (in chronological order)
This list is a simplified overview of all the changes that occurred in the module. In particular, it does not list all the changes in the names of the files, classes, methods, or arguments. To get a better overview of all the names that changed, users should instead refer to the online documentation or check for DeprecationError
s when running their old code compatible with Crappy 1.5 in Crappy 2.0.
- The old
Camera
Block (and its children) could only perform the acquisition, processing and recording of the images in a sequential way. The display of images was delegated to theDisplayer
Block. Now, the newCamera
Block (and its children) performs the acquisition, display, recording and processing of the images in a parallelized way. This greatly improves the achievable frame rate for all these operations. - The
Displayer
Block was removed, as the display is now handled directly by theCamera
Block. Having a separate Block for the display was a source of bugs due to the limitation of the bandwidth between the Blocks. - The
CameraConfig
window now handles the case when no image can be grabbed by the camera, and displays an error image instead of freezing. It can also handle the case when the flow of images stops, still without freezing. - A special
trigger
setting was added to theCamera
object for handling the hardware trigger option that some cameras may possess. - The
open
,stop
andclose
methods were added to the definition of the baseActuator
object. - The
Machine
Block can now acquire the speed and the position of the driven Actuator regardless of the driving mode, and adjust the target speed at runtime in position mode via an incoming label. - The base
Block
was totally refactored to improve its stability and efficiency, using all the possibilities offered by themultiprocessing
module. All the Blocks were updated accordingly. - As a consequence of the point above, the methods to use for receiving data from upstream Blocks were totally changed. They now have a different name and a different behavior.
- A clean logging mechanism was added to Crappy, in place of the previous calls to
print
. The logs are both displayed in the console, and saved to a log file. - The instantiation of the hardware related objects (Actuator, Camera, InOut) is now always performed once the Process driving them has started, for compatibility with the spawn start method of the
multiprocessing
module. - The
Link
object was updated consistently with the improvements brought to the baseBlock
. The methods of theLink
now have a different name and a different behavior, and users are not expected to call them directly anymore. - A
debug
argument was added to all the Blocks, to let users choose the debug level to use between INFO and DEBUG for each Block individually. - All the classes relying on the
FT232H
tool were moved to separate folders, to make them clearly discernible from the other classes. - The
FT232H
tool and the associatedUSBServer
were improved, to increase both the communication speed and the stability. - The entire structure of the module was re-thought, with the creation of many sub-folders containing sub-categories of files.
- The names of all the files and classes were changed to enforce PEP8. The list of the changes is too long to be displayed here, but all the name changes are clearly mentioned in the documentation.
- A number of unused files in the
util/
folder of the project were removed. - The
impact/
folder of the project was removed. - It is now possible for users to subclass the base
Generator Path
. That was previously not possible. - The entire architecture of the project was changed from flat to src. It is considered a good practice for avoiding test and build errors.
- The
verbose
argument of all the Blocks was renamed todisplay_freq
, which is a more accurate description of what this argument does. - A draft for a test suite for Crappy was added in the
tests/
folder of the project. It will be completed and actively used in future releases. - The calculation of the histogram in the
CameraConfig
window is now parallelized, therfore improving the performance of this window. - The P, I, and D gains of the
PID
Block can now be adjusted at runtime by sending new values over given labels. - The images recorded by the
Camera
Block can now be saved as.npy
files. - The
Modifier
objects now use the__call__
method for altering the received data, instead of theevaluate
method previously. This behavior is more consistent with the possibility to pass bare functions as Modifiers. - A few objects were moved to a
src/crappy/lamcube/
folder, to clearly indicate that they are only meant to be used at the LaMcube laboratory. - Most of the objects in Crappy now accept any type of iterable where they previously requested lists or tuples.
- The
examples/
folder of the project was totally refactored, with more, thoroughly commented, tested examples. Most of the Blocks now have at least one example illustrating their usage, and most of the examples can be run locally without requiring any hardware. - The packaging-related files (
setup.py
,requirements.txt
,pyproject.toml
,MANIFEST.in
) were all refactored to include more complete and up-to-date information, and to comply with the recent standards. - The configuration files for building the documentation (
.readthedocs.yml
,docs/source/conf.py
,docs/Makefile
) were updated to include more information and comply with the recent evolution of the standards. - The files needed to build the C++ extension modules were moved to the
src/ext/
folder of the project. - Crappy now raises a
CrappyFail
exception when stopped with CTRL+C, or when stopped by an unexpected exception. This is to prevent an external code launching Crappy from keeping running in case something goes wrong. - To stop Crappy in a clean way in all scripts, a
StopBlock
and aStopButton
Block were added to the module. - The documentation of the module was greatly improved. All the objects listed in the API section are now fully documented, and the tutorials section was made as complete as possible. Overall, the documentation has a clearer layout, and contains more information.
- The
Overlay
tool was added to allow users to display custom overlays on top of images processed by a child of the Camera Block. - README.md files were added in each folder of the project to make it clearer what the different sections are intended for.
- Deprecation errors were added to the module to signal users the deprecated features in version 2.0.0.
- The
CameraGstreamer
andCameraOpencv
cameras were greatly improved, to better interact withv4l2
on Linux and provide more functionalities on Windows and macOS. - In addition, a number of fixes were brought to the different objects in the module.
Merged pull requests
- Fix bug when switching trigger mode by @PIERROOOTT in #32
- Fixed a few bugs by @PIERROOOTT in #33
- Reset Block after cleanup by @WeisLeDocto in #45
- Feature/Runtime order check in Block by @WeisLeDocto in #46
- Add button to auto apply settings in the configuration window by @PIERROOOTT in #48
- Allow custom overlay on Camera Displayer by @WeisLeDocto in #49
- Make it more user-friendly to instantiate custom Camera Blocks by @WeisLeDocto in #50
- Add a step option for the camera scale setting in the configuration window by @PIERROOOTT in #51
- Documentation update for version 2.0.0 by @WeisLeDocto in #52
- Add example demonstrating the creation of a custom Camera Block by @WeisLeDocto in #53
- Simplify the creation of custom Path objects by @WeisLeDocto in #54
- Update the README files by @WeisLeDocto in #56
- Enhancement of the parameters management for the gstreamer camera by @PIERROOOTT in #55
- Add deprecation errors for objects renamed between v1.5 and v2.0 by @WeisLeDocto in #69
- Release of Crappy version 2.0.0 by @WeisLeDocto in #79
New Contributors
- @PIERROOOTT made their first contribution in #32
Full Changelog: v1.5.11...v2.0.0
The tarball and the wheel are available on PyPI