Adding color, distance, rotation sensors#459
Conversation
theol0403
left a comment
There was a problem hiding this comment.
Thanks, and thanks again for making the PR! Though you could have just changed the target of the last PR, and then force-pushed your branch, which would have fixed the PR.
You need to change all the method names to camelCase to conform to okapi convention, I know it's a bit of a pain. I have it set up in vim to switch the case on command, so if you want I could do this for you.
I know a lot of my comment suggestions are not your fault, you just copied the PROS comments, but I think they should be fixed for okapi.
Thanks!
|
Bump - waiting on anything from me? |
Codecov Report
@@ Coverage Diff @@
## develop #459 +/- ##
===========================================
- Coverage 89.04% 88.69% -0.36%
===========================================
Files 140 140
Lines 5878 5878
===========================================
- Hits 5234 5213 -21
- Misses 644 665 +21 |
Allows chassis builder to reference new RotationSensor
Updated documentation. Attempted to re-format comments, but clang-format broke locally for me
theol0403
left a comment
There was a problem hiding this comment.
Everything looks good! However, I would still recommend implementing a user-side flag for the direction of the rotation sensor, like with okapi::Motor.
OkapiLib/src/impl/device/motor/motor.cpp
Line 136 in e1c8aec
This prevents multiple instances of a RotationSensor with conflicting directions from messing each other up. One could even argue having two instances of a RotationSensor on the same port with opposite direction is a use-case, on a complex robot with different subsystems controlled by a single axle.
I'm not clear on how this situation could happen, but perhaps I'm not understanding what PROS did under the hood. If I have: Won't this currently behave as expected, assuming the sensors are oriented on the right as going forward and the left going reveresed? As the robot drove straight forward, wouldn't |
|
Yes, that example works fine. What I am referring to is auto one = RotationSensor(1,false);
auto two = RotationSensor(1,true);Expected: one increases while the other decreases |
|
Makes sense. I was thinking about 2 physical devices which couldn't be plugged into the same port.... |
|
@theol0403 That is implemented now. |
|
@dcieslak19973 Do you have a rotation sensor to test this with? I saw you tested the optical and distance sensors. |
|
I do have 2 physical rotation sensors. I'll test them physically tonight |
|
Only had 1 rotation sensor; confirmed that Behaves as expected - one.get() and two.get() return the same value with opposite signs. |
And the values are in degrees? |
|
Correct, the return values are in degrees for the RotationSensor |
* Update kernel to 3.3.1 * Update build scripts (#457) * Update build scripts * Poke CI * Use recursive submodule checkout * Poke CI * Use previous checkout behavior * Run test on PR * Adding color, distance, rotation sensors (#459) * Adding color, distance, rotation sensors Allows chassis builder to reference new RotationSensor * Updated to camel-case per coding conventions Updated documentation. Attempted to re-format comments, but clang-format broke locally for me * Cleaned up comments * Remove contributing changes * Fix various things * Fix rotation sensor file name * Fix messy range docs * Fix getSelectedOutput return value * Address review comments about docs and const qualifiers * Optionally disable gestures when constructing the optical sensor * Remove unnecessary virtual qualifiers * Reverse RotationSensor without reversing the port * Fix non-std uint8_t Co-authored-by: Octogonapus <firey45@gmail.com> * Add building instructions to CONTRIBUTING.md. Thanks to @dcieslak19973 * Version bump Co-authored-by: dcieslak19973 <dcieslak@hotmail.com>

Allows chassis builder to reference new RotationSensor
Description of the Change
Add wrappers for newly supported PROS API for the Color, Distance, and Rotation sensors
Motivation
Allow Chassis to reference the new Rotation Sensor for odometry
Possible Drawbacks
N/A
Verification Process
Tested Color and Distance sensors physically
Applicable Issues
N/A