robotpy / examples

Repository of RobotPy example projects
45 stars 53 forks source link

SpeedController Not Overriding 'get' Function #39

Closed benjiboy50fonz closed 3 years ago

benjiboy50fonz commented 3 years ago

Hello devs, I was trying to finish up the physics-camsim example in robotpy/examples, but I encountered another issue. Here is the issue I was working on if interested. Here is the traceback:

$ py -3 robot.py sim
10:44:45:667 INFO    : wpilib              : WPILib version 2021.2.1.0
10:44:45:668 INFO    : wpilib              : HAL version 2021.2.1.0
10:44:45:668 INFO    : wpilib              : Running with simulated HAL.
10:44:45:669 INFO    : wpilib              : robotpy-wpiutil version 2021.2.1.2
10:44:45:669 INFO    : wpilib              : robotpy-wpimath version 2021.2.1.0
10:44:45:677 INFO    : wpilib              : robotpy-rev version 2021.0.1
10:44:45:678 INFO    : wpilib              : robotpy-rev-color version 2021.1.2.0
10:44:45:678 INFO    : wpilib              : robotpy-navx version 2021.0.0
10:44:45:679 INFO    : wpilib              : robotpy-halsim-gui version 2020.3.2.1
10:44:45:684 INFO    : wpilib              : robotpy-ctre version 2021.1.2.0
10:44:45:684 INFO    : wpilib              : robotpy-commands-v1 version 2021.2.1.0
10:44:45:685 INFO    : wpilib              : robotpy-build version 2020.4.3
10:44:45:685 INFO    : wpilib              : pyntcore version 2021.2.1.1
10:44:45:693 INFO    : halsim_gui          : WPILib HAL Simulation 2020.3.2.1
HAL Extensions: Attempting to load: halsim_gui
Simulator GUI Initializing.
Simulator GUI Initialized!
HAL Extensions: Successfully loaded extension
C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\kinematics\__init__.py:3: FutureWarning: wpilib.kinematics has moved to wpimath.kinematics
  warnings.warn("wpilib.kinematics has moved to wpimath.kinematics", FutureWarning)
C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\geometry\__init__.py:3: FutureWarning: wpilib.geometry has moved to wpimath.geometry
  warnings.warn("wpilib.geometry has moved to wpimath.geometry", FutureWarning)
10:44:46:368 INFO    : pyfrc.physics       : Physics support successfully enabled
Not loading CameraServerShared
Default frc::IterativeRobotBase::DisabledInit() method... Override me!
Default frc::IterativeRobotBase::DisabledPeriodic() method... Override me!
Default frc::IterativeRobotBase::RobotPeriodic() method... Override me!
10:44:46:404 ERROR   : wpilib.ds           : Unhandled exception
Traceback (most recent call last):
  File "C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\_impl\start.py", line 106, in start
    self.robot.startCompetition()
RuntimeError: <wpilib.interfaces._interfaces.SpeedController object at 0x000001E65D62B9F0> does not override required function "SpeedController::get"

Locals at innermost frame:

{ 'DriverStation': <class 'wpilib._wpilib.DriverStation'>,
  'NetworkTables': <_pyntcore._ntcore.NetworkTablesInstance object at 0x000001E65B546DF0>,
  'hal': <module 'hal' from 'C:\\Users\\Ben Bistline\\AppData\\Roaming\\Python\\Python38\\site-pa...
  'isSimulation': True,
  'robot_cls': <class '__main__.MyRobot'>,
  'self': <wpilib._impl.start.RobotStarter object at 0x000001E65D5E9460>,
  'wpilib': <module 'wpilib' from 'C:\\Users\\Ben Bistline\\AppData\\Roaming\\Python\\Python38\\s...

Error at C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\_impl\start.py.106:start: Unhandled exception

Traceback (most recent call last):
  File "C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\_impl\start.py", line 106, in start
    self.robot.startCompetition()
  File "C:\Users\Ben Bistline\AppData\Roaming\Python\Python38\site-packages\wpilib\_impl\start.py", line 106, in start
    self.robot.startCompetition()
RuntimeError: <wpilib.interfaces._interfaces.SpeedController object at 0x000001E65D62B9F0> does not override required function "SpeedController::get"

10:44:46:460 WARNING : wpilib.ds           : Robots should not quit, but yours did!
Robots should not quit, but yours did!
10:44:46:471 ERROR   : wpilib.ds           : The startCompetition() method (or methods called by it) should have handled the exception above.
The startCompetition() method (or methods called by it) should have handled the exception above.

To replicate this issue, run the robot.py file in the physics-camsim example with the 'sim' argument. OS: Windows 10 PyFRC Version: 2021.1.1

If I can get some initial direction, I could probably help debug this issue, and more like it. Thanks for all the hard work guys!

virtuald commented 3 years ago

SpeedController is an abstract base class, so it's not usable directly. The example should be using a PWMVictorSPX or some other implementation of a motor controller.

benjiboy50fonz commented 3 years ago

Ah, I see. Thank you! I'll take care of it.