Skip to content

Commit

Permalink
Merge pull request #105 from LaboratoireMecaniqueLille/docs/refactor_…
Browse files Browse the repository at this point in the history
…changest_information

Refactor change-set information
  • Loading branch information
WeisLeDocto authored Feb 26, 2024
2 parents 6ed3309 + 11bec10 commit 430919c
Show file tree
Hide file tree
Showing 105 changed files with 727 additions and 372 deletions.
6 changes: 3 additions & 3 deletions src/crappy/_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def docs():
It opens the latest version, and of course requires an internet access.
.. versionadded:: 1.5.5
.. versionchanged:: 2.0.0 renamed from doc to docs
.. versionchanged:: 2.0.0 renamed from *doc* to *docs*
"""

webbrowser.open('https://crappy.readthedocs.io/en/latest/')
Expand Down Expand Up @@ -43,8 +43,8 @@ def __init__(self,
lazy_import: If :obj:`True`, the module won't be imported directly even
if it is installed. Instead, it will be imported only when necessary.
Allows reducing the import time, especially on Window.
.. versionadded:: 2.0.0 *lazy_import* argument
.. versionadded:: 2.0.0
"""

self._name = module_name
Expand Down
10 changes: 5 additions & 5 deletions src/crappy/actuator/fake_dc_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FakeDCMotor(Actuator):
It is mainly intended for testing scripts without requiring any hardware.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 Renamed from Fake_motor to FakeDCMotor
.. versionchanged:: 2.0.0 Renamed from *Fake_motor* to *FakeDCMotor*
"""

def __init__(self,
Expand All @@ -34,11 +34,11 @@ def __init__(self,
fv: The internal fluid friction coefficient of the motor, no unit.
simulation_speed: Speed factor of the simulation, to speed it up or slow
it down.
.. versionchanged:: 2.0.0
renamed from *sim_speed* to *simulation_speed*
initial_speed: The initial speed of the motor, in RPM.
initial_pos: The initial position of the motor, in turns.
.. versionchanged:: 2.0.0
renamed *sim_speed* argument to *simulation_speed*
"""

super().__init__()
Expand Down Expand Up @@ -74,7 +74,7 @@ def get_speed(self) -> float:
def get_position(self) -> float:
"""Returns the position of the motor, in rounds.
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

self._update()
Expand Down
8 changes: 4 additions & 4 deletions src/crappy/actuator/jvl_mac_140.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, port: str = '/dev/ttyUSB0') -> None:
Args:
port: Path to the serial port to use for communication.
.. deprecated:: 2.0.0 *baudrate* argument
.. versionremoved:: 2.0.0 *baudrate* argument
"""

self._ser = None
Expand Down Expand Up @@ -87,8 +87,8 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
position: The target position, in `mm`.
speed: The target speed for reaching the desired position, in `mm/min`.
The speed must be given, otherwise an exception is raised.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
"""

if speed is None:
Expand Down Expand Up @@ -117,7 +117,7 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
def get_position(self) -> float:
"""Reads and returns the current position of the servomotor, in `mm`.
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

# We have 20 attempts for reading the position
Expand Down
14 changes: 7 additions & 7 deletions src/crappy/actuator/kollmorgen_servostar_300.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ServoStar300(Actuator):
in speed.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from Servostar to ServoStar300
.. versionchanged:: 2.0.0 renamed from *Servostar* to *ServoStar300*
"""

def __init__(self,
Expand All @@ -32,13 +32,12 @@ def __init__(self,
Args:
port: Path to the serial port used for communication.
.. versionchanged:: renamed from *device* to *port*
baudrate: The serial baud rate to use, as an :obj:`int`.
mode: The driving mode to use when starting the test. Can be `'analog'`
or `'serial'`. It can be changed afterward while the test is running,
by sending the right command.
.. deprecated:: 2.0.0 *device argument*
.. versionchanged:: 2.0.0 use *port* instead of *device*
"""

self._ser = None
Expand Down Expand Up @@ -90,9 +89,10 @@ def set_position(self,
sets the driving mode to analog.
speed: The speed at which the actuator should reach its target position.
If no speed is specified, the default is `20000`.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. deprecated:: 2.0.0 remove *acc* and *dec* arguments
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. versionremoved:: 2.0.0 *acc* and *dec* arguments
"""

if speed is None:
Expand Down Expand Up @@ -129,7 +129,7 @@ def set_position(self,
def get_position(self) -> Optional[float]:
"""Reads and returns the current position of the motor.
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

# Requesting a position reading
Expand Down
5 changes: 3 additions & 2 deletions src/crappy/actuator/meta_actuator/actuator.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
speed: The speed at which to move to the desired position, as a
:obj:`float`, or :obj:`None` if no speed is specified.
.. versionchanged:: 2.0.0
*speed* is now a mandatory argument even if it is :obj:`None`
.. versionadded:: 1.5.10
.. versionchanged:: 2.0.0
*speed* is now a mandatory argument even if it is :obj:`None`
"""

self.log(logging.WARNING, f"The set_position method was called but is not "
Expand Down
2 changes: 1 addition & 1 deletion src/crappy/actuator/newport_tra6ppd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NewportTRA6PPD(Actuator):
This Actuator ignores new position commands while it is moving.
.. versionadded:: 1.5.10
.. versionchanged:: 2.0.0 renamed from TRA6PPD to NewportTRA6PPD
.. versionchanged:: 2.0.0 renamed from *TRA6PPD* to *NewportTRA6PPD*
"""

def __init__(self,
Expand Down
8 changes: 4 additions & 4 deletions src/crappy/actuator/oriental_ard_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class OrientalARDK(Actuator):
of its instances at a time, corresponding to different axes to drive.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from Oriental to OrientalARDK
.. versionchanged:: 2.0.0 renamed from *Oriental* to *OrientalARDK*
"""

def __init__(self,
Expand Down Expand Up @@ -137,8 +137,8 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
position: The target position to reach, in arbitrary units.
speed: The speed to use for reaching the target position, in arbitrary
units. A speed must be given, otherwise an exception is raised.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
"""

if speed is None:
Expand All @@ -153,7 +153,7 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
def get_position(self) -> float:
"""Reads and returns the current position of the motor.
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

# Sending the read command
Expand Down
12 changes: 12 additions & 0 deletions src/crappy/actuator/phidgets_stepper4a.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Phidget4AStepper(Actuator):
The distance unit is the `mm` and the time unit is the `s`, so speeds are in
`mm/s` and accelerations in `mm/s²`.
.. versionadded:: 2.0.3
"""

def __init__(self,
Expand Down Expand Up @@ -60,15 +62,25 @@ def __init__(self,
absolute_mode: If :obj:`True`, the target position of the motor will be
calculated from a reference position. If :obj:`False`, the target
position of the motor will be calculated from its current position.
.. versionadded:: 2.0.4
reference_pos: The position considered as the reference position at the
beginning of the test. Only takes effect if ``absolute_mode`` is
:obj:`True`.
.. versionadded:: 2.0.4
switch_ports: The indexes of the VINT Hub ports where the switches are
connected.
.. versionadded:: 2.0.4
save_last_pos: If :obj:`True`, the last position of the actuator will be
saved in a .npy file.
.. versionadded:: 2.0.4
save_pos_folder: The path to the folder where to save the last position
of the motor. Only takes effect if ``save_last_pos`` is :obj:`True`.
.. versionadded:: 2.0.4
"""

self._motor: Optional[Stepper] = None
Expand Down
8 changes: 4 additions & 4 deletions src/crappy/actuator/pololu_tic.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class PololuTic(Actuator):
in a shell opened in ``/etc/udev/rules.d``.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from Pololu_tic to PololuTic
.. versionchanged:: 2.0.0 renamed from *Pololu_tic* to *PololuTic*
"""

def __init__(self,
Expand Down Expand Up @@ -728,7 +728,7 @@ def get_position(self) -> float:
Returns:
The position in `mm`
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

if self._backend == 'ticcmd':
Expand All @@ -753,14 +753,14 @@ def set_position(self, position: float, speed: Optional[float]) -> None:
in `mm/s` Giving a speed other than :obj:`None` will set the maximum
speed of the motor to that speed.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
Note:
- ``speed``:
The only way to reach a position at a given speed is to change the
maximum speed. The Tic will try to accelerate to the maximum speed but
may remain slower if it doesn't have time to do so before reaching the
given position.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
"""

if speed is not None:
Expand Down
11 changes: 6 additions & 5 deletions src/crappy/actuator/schneider_mdrive_23.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SchneiderMDrive23(Actuator):
It communicates with the motor over a serial connection.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from CM_drive to SchneiderMDrive23
.. versionchanged:: 2.0.0 renamed from *CM_drive* to *SchneiderMDrive23*
"""

def __init__(self,
Expand Down Expand Up @@ -78,9 +78,10 @@ def set_position(self, position: float, _: Optional[float]) -> None:
Args:
position: The target position to reach, in `mm`.
_: The speed argument is ignored.
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. deprecated:: 2.0.0 *motion_type* argument
.. versionchanged:: 2.0.0 *speed* is now a mandatory argument
.. versionremoved:: 2.0.0 *motion_type* argument
"""

# Closing and reopening to get rid of errors
Expand All @@ -96,7 +97,7 @@ def set_position(self, position: float, _: Optional[float]) -> None:
def get_position(self) -> float:
"""Reads, displays and returns the current position in `mm`.
.. versionchanged:: 1.5.2 renamed from get_pos to get_position
.. versionchanged:: 1.5.2 renamed from *get_pos* to *get_position*
"""

# Closing and reopening to get rid of errors
Expand Down
14 changes: 9 additions & 5 deletions src/crappy/blocks/auto_drive_video_extenso.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AutoDriveVideoExtenso(Block):
labels. It can then be used by downstream Blocks.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from AutoDrive to AutoDriveVideoExtenso
.. versionchanged:: 2.0.0 renamed from *AutoDrive* to *AutoDriveVideoExtenso*
"""

def __init__(self,
Expand All @@ -48,26 +48,30 @@ def __init__(self,
gain: The gain for driving the Actuator in speed. The speed command is
simply the difference in pixels between the center of the image and the
center of the spots, multiplied by this gain.
.. versionchanged:: 1.5.10 renamed from *P* to *gain*
direction: Indicates which axis to consider for driving the Actuator, and
whether the action should be inverted. The first character is the axis
(`X` or `Y`) and second character is the inversion (`+` or `-`). The
inversion depends on whether a positive speed will bring the spots
closer or farther.
pixel_range: The size of the image (in pixels) along the chosen axis.
.. versionchanged:: 1.5.10 renamed from *range* to *pixel_range*
max_speed: The absolute maximum speed value that can be sent to the
Actuator.
freq: The target looping frequency for the Block. If :obj:`None`, loops
as fast as possible.
display_freq: If :obj:`True`, displays the looping frequency of the
Block.
.. versionadded:: 2.0.0
debug: If :obj:`True`, displays all the log messages including the
:obj:`~logging.DEBUG` ones. If :obj:`False`, only displays the log
messages with :obj:`~logging.INFO` level or higher. If :obj:`None`,
disables logging for this Block.
.. versionchanged:: 1.5.10 renamed *P* argument to *gain*
.. versionchanged:: 1.5.10 renamed *range* argument to *pixel_range*
.. versionadded:: 2.0.0 *display_freq* and *debug* arguments
.. versionadded:: 2.0.0
"""

self._device: Optional[Actuator] = None
Expand Down
13 changes: 9 additions & 4 deletions src/crappy/blocks/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Button(Block):
the experimenter has completed a task, for example.
.. versionadded:: 1.4.0
.. versionchanged:: 2.0.0 renamed from GUI to Button
.. versionchanged:: 2.0.0 renamed from *GUI* to *Button*
"""

def __init__(self,
Expand All @@ -44,23 +44,28 @@ def __init__(self,
send_0: If :obj:`True`, the value `0` will be sent automatically when
starting the Block. Otherwise, `1` will be sent at the first click.
Only relevant when ``spam`` is :obj:`False`.
.. versionadded:: 1.5.10
label: The label carrying the information on the number of clicks,
default is ``'step'``.
time_label: The label carrying the time information, default is
``'t(s)'``.
.. versionadded:: 1.5.10
freq: The target looping frequency for the Block. If :obj:`None`, loops
as fast as possible.
spam: If :obj:`True`, sends the current step value at each loop,
otherwise only sends it at each click.
display_freq: If :obj:`True`, displays the looping frequency of the
Block.
.. versionadded:: 2.0.0
debug: If :obj:`True`, displays all the log messages including the
:obj:`~logging.DEBUG` ones. If :obj:`False`, only displays the log
messages with :obj:`~logging.INFO` level or higher. If :obj:`None`,
disables logging for this Block.
.. versionadded:: 1.5.10 *send_0* and *time_label* arguments
.. versionadded:: 2.0.0 *display_freq* and *debug* arguments
.. versionadded:: 2.0.0
"""

self._root: Optional[tk.Tk] = None
Expand Down
Loading

0 comments on commit 430919c

Please sign in to comment.