Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
ci:
uses: robotpy/build-actions/.github/workflows/package-ci.yml@v2025
uses: robotpy/build-actions/.github/workflows/package-ci.yml@v2026
with:
artifactory_repo_type: vendor
secrets:
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ libs_path = meson.current_source_dir() + '/lib/lib'

navx_deps += [
cpp.find_library('StudicaDriver', dirs: libs_path),
cpp.find_library('StudicaLibDriver', dirs: libs_path),
cpp.find_library('Studica', dirs: libs_path),
cpp.find_library('StudicaLib', dirs: libs_path),
]

subdir('semiwrap/modules')
4 changes: 2 additions & 2 deletions navx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from . import _init__navx

# autogenerated by 'semiwrap create-imports navx navx._navx'
from ._navx import AHRS
from ._navx import AHRS, Navx

__all__ = ["AHRS"]
__all__ = ["AHRS", "Navx"]

from .version import version as __version__
31 changes: 25 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = [
"semiwrap~=0.1",
"hatch-meson~=0.1.0b2",
"hatch-robotpy~=0.2.0",
"wpilib~=2025.3.2.2",
"wpilib~=2026.1.1b1",
]


Expand All @@ -16,7 +16,7 @@ dynamic = ["version"]
description = "Python wrapper for Studica NavX sensor"
license = "BSD-3-Clause"
dependencies = [
"wpilib~=2025.3.2.2",
"wpilib~=2026.1.1b1",
]

[[project.authors]]
Expand All @@ -40,19 +40,35 @@ packages = ["navx"]
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "Studica-cpp"
group_id = "com.studica.frc"
repo_url = "https://dev.studica.com/maven/release/2025"
version = "2025.0.1"
repo_url = "https://dev.studica.com/maven/release/2026"
version = "2026.0.0-beta"
staticlibs = ["Studica"]
extract_to = "lib"

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "Studica-driver"
group_id = "com.studica.frc"
repo_url = "https://dev.studica.com/maven/release/2025"
version = "2025.0.1"
repo_url = "https://dev.studica.com/maven/release/2026"
version = "2026.0.0-beta"
staticlibs = ["StudicaDriver"]
extract_to = "lib"

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "StudicaLib-cpp"
group_id = "com.studica.frc"
repo_url = "https://dev.studica.com/maven/release/2026"
version = "2026.0.1-beta"
staticlibs = ["StudicaLib"]
extract_to = "lib"

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "StudicaLib-driver"
group_id = "com.studica.frc"
repo_url = "https://dev.studica.com/maven/release/2026"
version = "2026.0.1-beta"
staticlibs = ["StudicaLibDriver"]
extract_to = "lib"


[tool.hatch.build.hooks.semiwrap]

Expand All @@ -61,6 +77,8 @@ extract_to = "lib"

[tool.semiwrap]
update_init = ["navx"]
scan_headers_ignore = ["*"]


[tool.semiwrap.extension_modules."navx._navx"]
name = "navx"
Expand All @@ -75,3 +93,4 @@ includes = [

[tool.semiwrap.extension_modules."navx._navx".headers]
AHRS = "studica/AHRS.h"
NavX = "studica/Navx.h"
66 changes: 7 additions & 59 deletions semiwrap/AHRS.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

extra_includes:
- wpi/sendable/SendableHelper.h

Expand All @@ -10,12 +9,12 @@ classes:
BoardAxis:
NavXComType:
NavXUpdateRate:
SerialDataType:
methods:
AHRS:
overloads:
NavXComType:
NavXComType, NavXUpdateRate:
NavXComType, uint8_t:
GetPitch:
doc: |
Returns the current pitch value (in degrees, from -180 to 180)
Expand Down Expand Up @@ -102,24 +101,6 @@ classes:

:returns: Returns true if a valid update has been recently received
from the sensor.
GetByteCount:
doc: |
Returns the count in bytes of data received from the
sensor. This could can be useful for diagnosing
connectivity issues.

If the byte count is increasing, but the update count
(see :meth:`getUpdateCount`) is not, this indicates a software
misconfiguration.

:returns: The number of bytes received from the sensor.
GetUpdateCount:
doc: |
Returns the count of valid updates which have
been received from the sensor. This count should increase
at the same rate indicated by the configured update rate.

:returns: The number of valid updates received from the sensor.
GetLastSensorTimestamp:
doc: |
Returns the sensor timestamp corresponding to the
Expand Down Expand Up @@ -165,22 +146,6 @@ classes:
body (e.g., the robot) on which the sensor is mounted.

:returns: Current world linear acceleration in the Z-axis (in G).
IsMoving:
doc: |
Indicates if the sensor is currently detecting motion,
based upon the X and Y-axis world linear acceleration values.
If the sum of the absolute values of the X and Y axis exceed
a "motion threshold", the motion state is indicated.

:returns: Returns true if the sensor is currently detecting motion.
IsRotating:
doc: |
Indicates if the sensor is currently detecting motion,
based upon the X and Y-axis world linear acceleration values.
If the sum of the absolute values of the X and Y axis exceed
a "motion threshold", the motion state is indicated.

:returns: Returns true if the sensor is currently detecting motion.
GetBarometricPressure:
doc: |
Returns the current barometric pressure, based upon calibrated readings
Expand Down Expand Up @@ -513,22 +478,6 @@ classes:
via the :meth:`getCompassHeading` method.

:returns: Returns the mag field strength (in uTesla).
GetPressure:
doc: |
Returns the current barometric pressure (in millibar) [navX Aero only].

This value is valid only if a barometric pressure sensor is onboard.

:returns: Returns the current barometric pressure (in millibar).
GetTempC:
doc: |
Returns the current temperature (in degrees centigrade) reported by
the sensor's gyro/accelerometer circuit.

This value may be useful in order to perform advanced temperature-
correction of raw gyroscope and accelerometer values.

:returns: The current temperature (in degrees centigrade).
GetBoardYawAxis:
doc: |
Returns information regarding which sensor board axis (X,Y or Z) and
Expand All @@ -551,10 +500,6 @@ classes:
http://navx-mxp.kauailabs.com/navx-mxp/support/updating-firmware/

:returns: The firmware version in the format [MajorVersion].[MinorVersion]
RegisterCallback:
ignore: true
DeregisterCallback:
ignore: true
GetActualUpdateRate:
doc: |
Returns the navX-Model device's currently configured update
Expand Down Expand Up @@ -617,9 +562,12 @@ classes:
of the X, Y and X-axis accelerometers.

:returns: accelerometer full scale range in G.
Calibrate:
doc: |
Does nothing
GetPort:
ConfigureVelocity:
GetRobotCentricVelocityX:
GetRobotCentricVelocityY:
GetRobotCentricVelocityZ:
InitSendable:
::studica::AHRS::BoardYawAxis:
attributes:
board_axis:
Expand Down
22 changes: 22 additions & 0 deletions semiwrap/NavX.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
classes:
::studica::Navx:
methods:
Navx:
overloads:
int:
int, int:
GetYaw:
GetPitch:
GetRoll:
GetAlgoStates:
EnableOptionalMessages:
GetQuat6D:
GetQuat9D:
GetAngularVel:
GetLinearAccel:
GetCompass:
SelfTest:
SetODRHz:
Start:
GetSensorUUID:
GetTemperature:
5 changes: 5 additions & 0 deletions tests/test_navx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ def test_get_board_yaw_axis():
def test_get_velocity_x():
imu = navx.AHRS.create_spi()
imu.getVelocityX()


def test_navx_get_yaw():
imu = navx.Navx(0)
imu.getYaw()