Skip to content

Commit f640851

Browse files
committed
pybricks: Drop geometry module.
Since this will only have a few items, this fits better in pybricks.tools. pybricks.geometry.Axis fits best in parameters. This will also let us use it on Move Hub as an enum literal, not float vector. The geometry QSTR now just points to the tools module, preserving backwards compatibility with Pybricks V3.2.
1 parent 20b499b commit f640851

28 files changed

+173
-187
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
driving at high speed ([support#1032]).
1616

1717
### Added
18-
- Added `pybricks.geometry.cross(a, b)` to get a vector cross product.
18+
- Added `pybricks.tools.cross(a, b)` to get a vector cross product.
1919
- Added experimental implementation of `hub.imu.heading()` ([support#912]).
2020
- Added support for reading single-axis rotation, which is useful in
2121
applications like balancing robots, where full 3D orientation is not
@@ -32,6 +32,10 @@
3232
- Removed `positive_direction` from `DriveBase` initializer. This was
3333
temporarily added in the previous beta release to facilitate gyro support,
3434
but made it more complicated than needed ([support#992]).
35+
- Removed `pybricks.geometry` in an effort to reduce the number of modules with
36+
just a few elements. `Matrix` and `vector` have moved to `tools`. The `Axis`
37+
enum was moved to `parameters`. Each item can still be imported from its
38+
original location for backwards compatibility.
3539

3640
### Fixed
3741

bricks/_common/qstrdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Q(pybricks.ev3devices)
1515
Q(pybricks.experimental)
1616
#endif
1717

18-
#if PYBRICKS_PY_GEOMETRY
18+
#if MICROPY_PY_BUILTINS_FLOAT // backwards compatibility with Pybricks V3.2, maps to pybricks.tools
1919
Q(pybricks.geometry)
2020
#endif
2121

bricks/_common/sources.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ PYBRICKS_PYBRICKS_SRC_C = $(addprefix pybricks/,\
4545
ev3devices/pb_type_ev3devices_touchsensor.c \
4646
ev3devices/pb_type_ev3devices_ultrasonicsensor.c \
4747
experimental/pb_module_experimental.c \
48-
geometry/pb_module_geometry.c \
49-
geometry/pb_type_matrix.c \
5048
hubs/pb_module_hubs.c \
5149
hubs/pb_type_cityhub.c \
5250
hubs/pb_type_essentialhub.c \
@@ -74,6 +72,7 @@ PYBRICKS_PYBRICKS_SRC_C = $(addprefix pybricks/,\
7472
nxtdevices/pb_type_nxtdevices_touchsensor.c \
7573
nxtdevices/pb_type_nxtdevices_ultrasonicsensor.c \
7674
parameters/pb_module_parameters.c \
75+
parameters/pb_type_axis.c \
7776
parameters/pb_type_button.c \
7877
parameters/pb_type_color.c \
7978
parameters/pb_type_direction.c \
@@ -97,6 +96,7 @@ PYBRICKS_PYBRICKS_SRC_C = $(addprefix pybricks/,\
9796
robotics/pb_type_drivebase.c \
9897
robotics/pb_type_spikebase.c \
9998
tools/pb_module_tools.c \
99+
tools/pb_type_matrix.c \
100100
tools/pb_type_stopwatch.c \
101101
util_mp/pb_obj_helper.c \
102102
util_mp/pb_type_enum.c \

bricks/cityhub/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#define PYBRICKS_PY_COMMON_SYSTEM (1)
2626
#define PYBRICKS_PY_EV3DEVICES (0)
2727
#define PYBRICKS_PY_EXPERIMENTAL (1)
28-
#define PYBRICKS_PY_GEOMETRY (1)
2928
#define PYBRICKS_PY_HUBS (1)
3029
#define PYBRICKS_PY_IODEVICES (1)
3130
#define PYBRICKS_PY_MEDIA (0)

bricks/debug/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define PYBRICKS_PY_COMMON_SYSTEM (0)
2323
#define PYBRICKS_PY_EV3DEVICES (0)
2424
#define PYBRICKS_PY_EXPERIMENTAL (0)
25-
#define PYBRICKS_PY_GEOMETRY (0)
2625
#define PYBRICKS_PY_HUBS (0)
2726
#define PYBRICKS_PY_IODEVICES (0)
2827
#define PYBRICKS_PY_MEDIA (0)

bricks/essentialhub/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#define PYBRICKS_PY_COMMON_SYSTEM (1)
2727
#define PYBRICKS_PY_EV3DEVICES (0)
2828
#define PYBRICKS_PY_EXPERIMENTAL (1)
29-
#define PYBRICKS_PY_GEOMETRY (1)
3029
#define PYBRICKS_PY_HUBS (1)
3130
#define PYBRICKS_PY_IODEVICES (1)
3231
#define PYBRICKS_PY_MEDIA (0)

bricks/ev3dev/brickconfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#define PYBRICKS_PY_COMMON_SYSTEM (1)
3131
#define PYBRICKS_PY_EV3DEVICES (1)
3232
#define PYBRICKS_PY_EXPERIMENTAL (1)
33-
#define PYBRICKS_PY_GEOMETRY (1)
3433
#define PYBRICKS_PY_HUBS (1)
3534
#define PYBRICKS_PY_IODEVICES (1)
3635
#define PYBRICKS_PY_MEDIA (0)

bricks/ev3rt/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#define PYBRICKS_PY_COMMON_SYSTEM (0)
3030
#define PYBRICKS_PY_EV3DEVICES (0)
3131
#define PYBRICKS_PY_EXPERIMENTAL (0)
32-
#define PYBRICKS_PY_GEOMETRY (1)
3332
#define PYBRICKS_PY_HUBS (0)
3433
#define PYBRICKS_PY_IODEVICES (0)
3534
#define PYBRICKS_PY_MEDIA (0)

bricks/movehub/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#define PYBRICKS_PY_COMMON_MOTORS (1)
2424
#define PYBRICKS_PY_COMMON_SYSTEM (1)
2525
#define PYBRICKS_PY_EXPERIMENTAL (0)
26-
#define PYBRICKS_PY_GEOMETRY (0)
2726
#define PYBRICKS_PY_HUBS (1)
2827
#define PYBRICKS_PY_IODEVICES (0)
2928
#define PYBRICKS_PY_MEDIA (0)

bricks/nxt/mpconfigport.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#define PYBRICKS_PY_COMMON_SYSTEM (1)
2828
#define PYBRICKS_PY_EV3DEVICES (0)
2929
#define PYBRICKS_PY_EXPERIMENTAL (0)
30-
#define PYBRICKS_PY_GEOMETRY (0)
3130
#define PYBRICKS_PY_HUBS (1)
3231
#define PYBRICKS_PY_IODEVICES (0)
3332
#define PYBRICKS_PY_MEDIA (0)

0 commit comments

Comments
 (0)