LaboratoireMecaniqueLille / crappy

Command and Real-time Acquisition Parallelized in Python
https://crappy.readthedocs.io/en/stable/
GNU General Public License v2.0
78 stars 16 forks source link

Simplify the creation of custom Path objects #54

Closed WeisLeDocto closed 10 months ago

WeisLeDocto commented 10 months ago

Until now in Crappy, the base Path object was requiring the last sent command and its timestamp as arguments. Any other Path subclassing it also needed to take these two values as arguments, and to pass them to the parent class (for example with super().__init__(last_time, last_cmd)).

Starting with version 2.0.0, users can now define their own custom Path objects. With the old architecture, however, they had to define a _last_cmd and a _last_time argument to their new class, only to provide it as argument to the parent class. This is at the same time not elegant, a potential source of bugs, and definitely not intuitive.

Instead, this PR slightly modifies the base Path object and the Generator Block so that the last command and its timestamp are not needed as arguments anymore. To do so, they are now set as class attributes of Path, and set by the Generator Block before instantiating a new Path (88bd0ba3). The distributed Generator Paths, the examples, and the documentation were updated accordingly (respectively e9e6891a, ae501101, ed14e7a0).