Closed Lagor845 closed 1 month ago
Both getRotation2d()
and reset()
are WPILib specific methods, which we haven't yet brought over to Python.
Our Python API does however have the necessary functions to replicate this functionality, with get_yaw()
and set_yaw()
Equivalent methods would be the following:
def get_rotation2d(pigeon: Pigeon2):
return Rotation2d.fromDegrees(pigeon.get_yaw().value)
def reset(pigeon: Pigeon2):
pigeon.set_yaw(0)
grab rotation values for the x axis
Are you sure you mean the X axis? That corresponds to the Roll Axis in Pigeon 2, which is not what getRotation2d()
does in other languages. That method gets the Z axis, corresponding to Yaw about Pigeon 2.
Thank you! That one had me confused for a bit! I will inform the team and our progress shall commence! Thank you for all you do!
On Wed, Jan 24, 2024 at 10:32 AM Cory @.***> wrote:
Both getRotation2d() and reset() are WPILib specific methods, which we haven't yet brought over to Python. Our Python API does however have the necessary functions to replicate this functionality, with get_yaw() https://api.ctr-electronics.com/phoenix6/release/python/autoapi/phoenix6/hardware/core/core_pigeon2/index.html#phoenix6.hardware.core.core_pigeon2.CorePigeon2.get_yaw and set_yaw() https://api.ctr-electronics.com/phoenix6/release/python/autoapi/phoenix6/hardware/core/core_pigeon2/index.html#phoenix6.hardware.core.core_pigeon2.CorePigeon2.set_yaw
Equivalent methods would be the following:
def get_rotation2d(pigeon: Pigeon2): return Rotation2d.fromDegrees(pigeon.get_yaw().value) def reset(pigeon: Pigeon2): pigeon.set_yaw(0)
grab rotation values for the x axis
Are you sure you mean the X axis? That corresponds to the Roll Axis in Pigeon 2, which is not what getRotation2d() does in other languages. That method gets the Z axis, corresponding to Yaw about Pigeon 2.
— Reply to this email directly, view it on GitHub https://github.com/CrossTheRoadElec/Phoenix-Releases/issues/69#issuecomment-1908608095, or unsubscribe https://github.com/notifications/unsubscribe-auth/BB2PGYA7UFGAYKE5A3YWVVLYQFAUBAVCNFSM6AAAAABCI5MJLSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBYGYYDQMBZGU . You are receiving this because you authored the thread.Message ID: @.***>
Fixed in beta 1 (which the python portion is pending on robotpy)
We were hoping to try python this year for our swerve implementation but I can't seem to find any documentation for how to grab rotation values for the x axis of the pigeon2. For java you bring in the pigeon class from hardware and then run the .getRotation2d to grab its rotation. It seems that the python implementation has no such function.
I cannot find the .reset or the .getRotation2d Are the classes just developed differently? Or does the python just not have that functionality yet?
This is the Java docs https://api.ctr-electronics.com/phoenix6/release/java/com/ctre/phoenix6/hardware/Pigeon2.html
This is the Python docs https://api.ctr-electronics.com/phoenix6/release/python/autoapi/phoenix6/hardware/core/core_pigeon2/index.html#phoenix6.hardware.core.core_pigeon2.CorePigeon2
Thank you for all of your help!