robotpy / robotpy-ctre

RobotPy wrappers for CTRE Phoenix 5 library
Other
13 stars 21 forks source link

[BUG]: VictorSPX.getOutputPercent and .getOutputVoltage doesn't work #152

Closed BerkeSinanYetkin closed 1 year ago

BerkeSinanYetkin commented 2 years ago

Problem description

VictorSPX.getOutputPercent() and .getOutputVoltage() doesn't return anything. The same problem also exists on VictorSPX.getSimCollection().getMotorOutputLeadVoltage() and VictorSPX.getSimCollection().getAngularPosition().

I don't know whether or not the object is completely broken, I'm using the simulation and don't have access to a roboRIO.

WPI_VictorSPX works though.

Operating System

Windows

Installed Python Packages

atomicwrites              1.4.1
attrs                     21.4.0
bcrypt                    3.2.2
cffi                      1.15.1
click                     8.1.3
colorama                  0.4.5
cryptography              37.0.4
iniconfig                 1.1.1
numpy                     1.23.1
packaging                 21.3
paramiko                  2.11.0
Pint                      0.19.2
pip                       21.2.3
pluggy                    1.0.0
py                        1.11.0
pycparser                 2.21
pyfrc                     2022.1.5
PyNaCl                    1.5.0
pynetconsole              2.0.4
pynetworktables           2021.0.0
pyntcore                  2022.4.1.0
pyparsing                 3.0.9
pytest                    7.1.2
pytest-reraise            2.1.1
robotpy                   2022.4.8
robotpy-ctre              2022.1.1
robotpy-hal               2022.4.1.2
robotpy-halsim-gui        2022.4.1.1
robotpy-installer         2022.1.1
robotpy-navx              2022.0.2
robotpy-pathplannerlib    2022.2.3
robotpy-photonvision      2022.1.1
robotpy-playingwithfusion 2022.0.4
robotpy-rev               2022.0.1
robotpy-wpilib-utilities  2022.0.5
robotpy-wpimath           2022.4.1.3
robotpy-wpiutil           2022.4.1.2
setuptools                57.4.0
six                       1.16.0
tomli                     2.0.1
wpilib                    2022.4.1.6

Reproducible example code

import wpilib
import ctre

class MyRobot(wpilib.TimedRobot):

    def robotInit(self):
        self.testMotor = ctre.VictorSPX(7)

    def teleopPeriodic(self):
        """This function is called periodically during operator control."""
        self.testMotor.set(ctre.ControlMode.PercentOutput, 1)
        print(self.testMotor.getMotorOutputPercent())

if __name__ == "__main__":
    wpilib.run(MyRobot)
virtuald commented 2 years ago

For some reason I believe that the non-WPI versions of the motors do not support simulation. You'd need to ask CTRE support for the rationale.

auscompgeek commented 1 year ago

I'm closing this, since, as I understand, this is working as intended.