✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
---|
tools
– General purpose tools¶
Common tools for timing, data logging, and linear algebra.
Timing tools¶
- wait(time)¶
Pauses the user program for a specified amount of time.
- Parameters
time (Number, ms) – How long to wait.
- class StopWatch¶
A stopwatch to measure time intervals. Similar to the stopwatch feature on your phone.
- time() int: ms ¶
Gets the current time of the stopwatch.
- Returns
Elapsed time.
- pause()¶
Pauses the stopwatch.
- resume()¶
Resumes the stopwatch.
- reset()¶
Resets the stopwatch time to 0.
The run state is unaffected:
If it was paused, it stays paused (but now at 0).
If it was running, it stays running (but starting again from 0).
Input tools¶
Linear algebra tools¶
Changed in version 3.3: These tools were previously located in the pybricks.geometry
module.
❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
---|
- class Matrix(rows)¶
Mathematical representation of a matrix. It supports addition (
A + B
), subtraction (A - B
), and matrix multiplication (A * B
) for matrices of compatible size.It also supports scalar multiplication (
c * A
orA * c
) and scalar division (A / c
).A
Matrix
object is immutable.- Parameters
rows (list) – List of rows. Each row is itself a list of numbers.
- shape¶
Returns a tuple (
m
,n
), wherem
is the number of rows andn
is the number of columns.
❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
---|