-
Notifications
You must be signed in to change notification settings - Fork 815
feat: Ported robotic arm #2729
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
base: flutter
Are you sure you want to change the base?
feat: Ported robotic arm #2729
Conversation
Reviewer's GuideThis pull request ports the Robotic Arm feature by adding a new multi-servo command in the communication layer, introducing a dedicated UI screen with servo controls and a timeline, updating string resources and dependencies, and wiring up navigation and routing. Sequence Diagram for Robotic Arm Servo Control (
|
Change | Details | Files |
---|---|---|
Implemented a new four-servo control API in the communication layer |
|
lib/communication/science_lab.dart |
Added string resources and external dependency for the robotic arm |
|
lib/constants.dart pubspec.yaml |
Updated navigation and routing to include the Robotic Arm screen |
|
lib/main.dart lib/view/instruments_screen.dart |
Created RoboticArmScreen with servo controls and timeline playback |
|
lib/view/robotic_arm_screen.dart |
Introduced ServoCard widget for individual servo interaction |
|
lib/view/widgets/servo_card.dart |
Built TimelineScrollView for visualizing and editing servo sequences |
|
lib/view/widgets/robotic_arm_timeline.dart |
Assessment against linked issues
Issue | Objective | Addressed | Explanation |
---|---|---|---|
#2728 | Port the existing Robotic Arm screen to Flutter. | ✅ | |
#2728 | Implement the same UI as the existing Robotic Arm screen. | ✅ | |
#2728 | Implement the same functionality as the existing Robotic Arm screen. | ✅ |
Possibly linked issues
- Implementation of Robotic Arm Screen #2728: The PR implements the Robotic Arm Screen in Flutter, fulfilling the issue's requirement.
- Implementation of Robotic Arm Screen #2728: PR ports robotic arm control and protocol to Flutter, directly addressing the first step of the issue.
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
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @rahul31124 - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
- Undefined constant 'cancel' used; define or import it (link)
General comments:
- The servo4 method repeats the same pulse calculation and send logic for each angle—consider looping over the angles to reduce duplication and improve maintainability.
- In instruments_screen, the switch case uses the literal 12 for launching the robotic arm—extract that into a named constant or enum to make the code clearer and less error-prone.
- Route strings like '/roboticArm' are hard-coded in multiple places—centralize them into a constant to avoid mismatches and ease future updates.
Here's what I looked at during the review
- 🔴 General issues: 1 blocking issue, 4 other issues
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/15765305309/artifacts/3365631465 |
Closed the previous PR due to wrong branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rahul31124 Quite some things to fix here. Let's go part by part.
lib/view/robotic_arm_screen.dart
Outdated
@@ -0,0 +1,343 @@ | |||
import 'dart:async'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow the SOC principle. Widgets and functionality should be handled separately. Observe how the other instruments handle this: a separate layout file which contains the widgets, and a dedicated ChangeNotifierProvider
for handling the functionality which is consumed by the layout widgets.
I tested with an older device with a small screen (at today's standards, https://en.wikipedia.org/wiki/Moto_X_Play) and I was able to control a servo. 👍 Just a little something I noticed: When I start the Robotic Arm screen, I get the warning in the screenshot below. In the log I found this exception: Once I turned the screen of the device off an on again, the warning is gone. |
@marcnause,I guess it will be better to reduce the height of the time line abit and increase the servo controller height. |
@AsCress I've made the requested changes in the PR. |
@rahul31124 Have you addressed the above issue reported by @marcnause ? |
@AsCress No, I will do it by tomorrow. |
@AsCress I’ve resized the height and width and tested it on a Pixel 3 (5.5-inch screen). I didn’t encounter any exceptions for layout |
@rahul31124 Ok. I'll test this and get back to you. Meanwhile, please resolve conflicts. |
0368ea8
to
e4b6927
Compare
@AsCress I’ve resolved the merge conflicts |
@rahul31124 Thank you for the layout changes. Now Flutter does not complain about the width anymore but the height on my phone: This is the exception from the log: exception.txt I know that my device is a little bit quirky... Could you also please react to the sourcery-ai comments. If they don't make any sense, saying that is also a valid reaction. If you already did some changes which void the comments, please use the "resolve conversation" buttons to hide the commnets. This makes life a little bit easier for the reviewers. |
Hello @marcnause, it would be better if you could share a video of the screen. |
@rahul31124 Here is a video of the app in deubg mode on my phone. screen-recording-20250617-110628_lU07Qcfd.mp4I switched off the screen of the phone after the Robotic Arm screen was displayed. When I switched on the screen again, the layout fills the whole screen where it left a margin on the right before the screen was turned off. This may be a quirk of my phone, I saw a similar behavior with the old app too. The warning is visible at the bottom of screen before and after I turned off the screen. I think this is a minor issue which is probably limited to some older devices. If this blocks your progress, we can track this as a know issue in a separate ticket and come back to it later. |
@marcnause, I’ve also made improvements to the UI layout in the upcoming PR related to this issue: #2734, and I’ll include those changes in the next commit. |
Since the device is my test device I will automatically keep an eye on it as the screen progresses and maybe it makes most sense if I try to fix it since I have access to the device and I can see the results of changes faster than you. |
@rahul31124 This would most certainly need layout building in a way that they are responsive, even on small screen sizes. In flutter, you can always create layouts which scale properly on all screen sizes, regardless of how small the screen is. |
Fixes #2728
Changes
Added the Robotic arm screen and communication protocol.
Screenshots / Recordings
Ported_Robotic_Arm.webm
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Port the Robotic Arm feature by adding a dedicated screen with interactive servo controls, a draggable timeline scheduler, and extend the ScienceLab communication protocol for four-servo support.
New Features:
Enhancements:
Build: