Skip to content

feat: implementation of the Compass page #2710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: flutter
Choose a base branch
from

Conversation

Yugesh-Kumar-S
Copy link
Collaborator

@Yugesh-Kumar-S Yugesh-Kumar-S commented May 31, 2025

Fixes #2707

Changes

  • Added the Compass instrument.
  • Implemented compass when ground parallel to X,Y,Z direction.

Screenshots / Recordings

image

Checklist:

  • No hard coding: I have used resources from strings.xml, dimens.xml and colors.xml without hard coding any value.
  • No end of file edits: No modifications done at end of resource files strings.xml, dimens.xml or colors.xml.
  • Code reformatting: I have reformatted code and fixed indentation in every file included in this pull request.
  • No extra space: My code does not contain any extra lines or extra spaces than the ones that are necessary.

Summary by Sourcery

Introduce a new Compass instrument page that uses device magnetometer and accelerometer data to display a real-time heading with selectable ground-parallel axes, and integrate it into the app’s navigation.

New Features:

  • Add Compass screen with rotating compass UI and heading readout based on magnetometer and accelerometer streams
  • Enable axis selection (X, Y, Z) to align the compass parallel to the selected ground axis
  • Register and navigate to the Compass page from the instruments menu

Build:

  • Add sensors_plus dependency for accessing device sensor data

Copy link

sourcery-ai bot commented May 31, 2025

Reviewer's Guide

Implements a new Compass instrument by adding the sensors_plus dependency, wiring up navigation and routes for the compass page, and introducing a CompassScreen widget that subscribes to magnetometer and accelerometer streams to compute and render a smoothed heading with selectable ground-parallel axes.

File-Level Changes

Change Details Files
Navigation and routing updated for Compass page
  • Add case 9 in InstrumentsScreen switch to push or pop until '/compass'
  • Import CompassScreen and register '/compass' route in main.dart
lib/view/instruments_screen.dart
lib/main.dart
Dependency added for sensor access
  • Add sensors_plus: ^6.1.1 to project dependencies
pubspec.yaml
CompassScreen widget implemented
  • Create StatefulWidget subscribing to magnetometer and accelerometer streams
  • Compute device orientation with axis-based heading, smoothing and conversion methods
  • Build UI: rotating compass image, degree display, magnetometer readings, and axis selectors
lib/view/compass_screen.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#2707 Maintain consistency with the existing PSLab Android app’s Compass behavior.
#2707 Ensure smooth transition and rotation of the compass needle based on device orientation.
#2707 Integrate real-time directional updates using magnetometer and accelerometer sensors.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Yugesh-Kumar-S Yugesh-Kumar-S force-pushed the Compass branch 2 times, most recently from 8eb04be to 896fb86 Compare June 2, 2025 16:23
Copy link

github-actions bot commented Jun 2, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants