Skip to content

Commit

Permalink
Fixes linear joint, moves revolute joint to new package "joints".
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoFara committed Oct 1, 2024
2 parents bf77391 + cba0d78 commit 1db5159
Show file tree
Hide file tree
Showing 23 changed files with 636 additions and 249 deletions.
5 changes: 3 additions & 2 deletions .idea/runConfigurations/All_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ optimization, related to ([#5](https://github.com/HugoFara/pylinkage/issues/5)).
- Some run configuration files added *for users of PyCharm*:
- Run all tests with "All Tests".
- Regenerate documentation with "Sphinx Documentation".
- The ``Linear`` joint is here! His geometric model was of course implemented.
- ``line_from_points`` and ``circle_line_intersection``.
- New exception ``NotCompletelyDefinedError``, when a joint is reloading but its anchor coordinates are set to None.

### Changed

Expand Down Expand Up @@ -52,12 +55,16 @@ iteration.
- From the user perspective, no change (execution *may* be a bit faster)
- ``source/`` renamed to ``sphinx/`` because it was confusing and only for Sphinx configuration.
- Transition from Numpydoc to reST for docstrings ([#12](https://github.com/HugoFara/pylinkage/issues/12)).
- ``__secant_circles_intersections__`` renamed to
``secant_circles_intersections`` in ``geometry.py``.

### Fixed

- ``swarm_tiled_repr`` in ``visualizer.py`` was wrongly assigning dimensions.
- Setting ``locus_highlight`` in ``plot_static_linkage`` would result in an error.
- ``Pivot.reload`` was returning arbitrary point when we had an infinity of solutions.
- ``Pivot.reload`` was returning arbitrary point when we had an infinity of solutions.
- The highlighted locus was sometimes buggy in ``plot_static_linkage`` in
``visualizer.py``.

### Deprecated

Expand All @@ -66,6 +73,9 @@ iteration.
- The ``Pivot`` class is deprecated in favor of the ``Revolute`` class.
The name "Pivot joint" is not standard.
Related to [#13](https://github.com/HugoFara/pylinkage/issues/13).
- The ``hyperstaticity`` method is renamed ``indeterminacy`` in ``Linkage``
(linkage.py)


## [0.5.3] - 2023-06-23

Expand Down Expand Up @@ -103,8 +113,8 @@ It will no longer be tested, use it at your own risks!

### Added in 0.5.2

- You can see the best score and the best dimensions updating in
``trials_and_errors_optimization``.
- You can see the best score and best dimensions updating in
``trials_and_errors_optimization``.

### Changed in 0.5.2

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import pylinkage as pl
# Main motor
crank = pl.Crank(0, 1, joint0=(0, 0), angle=.31, distance=1)
# Close the loop
pin = pl.Pivot(
pin = pl.Revolute(
3, 2, joint0=crank, joint1=(3, 0),
distance0=3, distance1=1
)
Expand Down Expand Up @@ -108,7 +108,7 @@ The pin will be created on the position of the parent, which is the head of the
Now we add a pin joint to close the kinematic loop.

```python
pin = pl.Pivot(3, 2, joint0=crank, joint1=(3, 0), distance0=3, distance1=1)
pin = pl.Revolute(3, 2, joint0=crank, joint1=(3, 0), distance0=3, distance1=1)
```

In human language, here is what is happening:
Expand All @@ -127,7 +127,7 @@ then we keep the intersection closer to the previous position as the solution.
Wait! A linkage with a single motor and only one pin joint? That doesn't make sense!
: Behind the curtain, many joints are created on the fly.
When you define a ``Crank`` joint, it creates a motor **and** a pin joint on the crank's link head.
For a ``Pivot`` joint, it creates **3 pin joints**: one on each of its parents' positions, and one its position,
For a ``Revolute`` joint, it creates **3 pin joints**: one on each of its parents' positions, and one its position,
which forms a deformable triangle.
This is why pylinkage is so short to write.

Expand Down Expand Up @@ -159,7 +159,7 @@ import pylinkage as pl
# Main motor
crank = pl.Crank(0, 1, joint0=(0, 0), angle=.31, distance=1)
# Close the loop
pin = pl.Pivot(
pin = pl.Revolute(
3, 2, joint0=crank, joint1=(3, 0),
distance0=3, distance1=1
)
Expand Down Expand Up @@ -195,7 +195,7 @@ Last recap, rearranging names:
# Main motor
crank = pl.Crank(0, 1, joint0=(0, 0), angle=.31, distance=1, name="B")
# Close the loop
pin = pl.Pivot(
pin = pl.Revolute(
3, 2, joint0=crank, joint1=(3, 0),
distance0=3, distance1=1, name="C"
)
Expand Down
6 changes: 3 additions & 3 deletions examples/fourbar_linkage.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The fourbar_linkage module demonstrates the functionalities of pylinkage.
The fourbar_linkage module demonstrates the features of pylinkage.
It is not intended to be imported in another project, but fell welcome to
copy-paste chunks of code.
It is not intended to be imported in another project,
but feel welcome to copy-paste chunks of code.
Created on Sat Jun 19, 12:32:37 2021.
Expand Down
18 changes: 18 additions & 0 deletions examples/inverted_stroke_engine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
An inverted four-stroke engine, that converts a rotary motion into a linear one.
See: https://en.wikipedia.org/wiki/Four-stroke_engine for details
"""
import pylinkage as pl

crank = pl.Crank(x=0, y=0, joint0=(0, 0), distance=1, angle=0.1, name="Crank")

slider = pl.Linear(x=2, y=0, joint0=crank, joint1=(0, 0), joint2=(1, 0), revolute_radius=1.5, name="Slider")

my_linkage = pl.Linkage(
joints=(crank, slider),
order=(crank, slider),
name="Simple four-stroke engine"
)

pl.show_linkage(my_linkage, duration=5)
Loading

0 comments on commit 1db5159

Please sign in to comment.