Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DC motor driver hat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
DC motor driver hat
Merge requests
!41
Raw encoder ticks
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Raw encoder ticks
raw-encoder-ticks
into
main
Overview
0
Commits
6
Pipelines
3
Changes
11
Merged
Samuel Tardieu
requested to merge
raw-encoder-ticks
into
main
5 months ago
Overview
0
Commits
6
Pipelines
3
Changes
11
Expand
0
0
Merge request reports
Compare
main
version 3
f5234992
5 months ago
version 2
89f33f74
5 months ago
version 1
62c8b581
5 months ago
main (base)
and
version 2
latest version
f5234992
6 commits,
5 months ago
version 3
f5234992
7 commits,
5 months ago
version 2
89f33f74
6 commits,
5 months ago
version 1
62c8b581
3 commits,
5 months ago
11 files
+
93
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
11
Search (e.g. *.vue) (Ctrl+P)
controller/python/controller.py
+
8
−
1
Options
@@ -3,7 +3,7 @@ from numbers import Real
from
typing
import
Optional
# Major and minor version of required firmware
_REQUIRED_FIRMWARE_VERSION
=
(
1
,
0
)
_REQUIRED_FIRMWARE_VERSION
=
(
1
,
1
)
class
FirmwareVersionMismatch
(
Exception
):
@@ -28,6 +28,7 @@ class Controller:
CMD_RAW_MOTOR_SPEED
=
0x30
CMD_CONTROLLED_MOTOR_SPEED
=
0x31
CMD_ENCODER_TICKS
=
0x32
CMD_RAW_ENCODER_TICKS
=
0x33
CMD_STATUS
=
0x36
CMD_RESET
=
0xE0
CMD_REBOOT_TO_BOOTLOADER
=
0xE1
@@ -137,6 +138,12 @@ class Controller:
sense. Return a pair with left and right data.
"""
return
self
.
_read
(
self
.
CMD_ENCODER_TICKS
,
4
,
"
hh
"
)
def
get_raw_encoder_ticks
(
self
)
->
tuple
[
int
,
int
]:
"""
Retrieve the raw encoder ticks as an unsigned absolute 16 bit
value with wraparound arithmetic for each encoder. Return a pair
with left and right data.
"""
return
self
.
_read
(
self
.
CMD_RAW_ENCODER_TICKS
,
4
,
"
HH
"
)
def
get_status
(
self
)
->
dict
[
str
,
bool
]:
"""
Return a dict with status fields:
-
"
moving
"
: True if at least one motor is moving, False otherwise
Loading