Hello,
I am wondering if PIDBase and PIDController classes are implemented yet in robotpy 2020. I tried to use them, but get errors. In addition, I am having the same problem with the ShuffleBoard libraries.
Traceback (most recent call last):
File "robot.py", line 5, in <module>
from wpilib import PIDBase
ImportError: cannot import name 'PIDBase' from 'wpilib' (C:\Users\...\AppData\Local\Programs\Python\Python38\lib\site-packages\wpilib\__init__.py)
Shuffleboard is a bit technically challenging, so we haven’t gotten around to it quite yet.
You’re not the first person to ask about old PIDController either. We initially only wrapped the new PIDController, but we need to wrap old PIDController for the old command framework too. I would personally recommend using the new PIDController though.
Thank you. I totally understand, and this helps significantly. Can anyone point me to the docs for the new PID Controller?
The latest robotpy docs seem to point to the old one which is why I got confused.
Is there any new links that are relevant to having the same problem as the original poster, except in Java, or is the link already referenced earlier still relevant for Java?
The import statement seems to be… from wpilib.controller import PIDController
…but, I am still receiving the same error.
Does anyone have any thoughts? I will try in sim later and post if I figure anything out.
Edit…
While I have to parse the docs to figure out how to use it, I ran the following command in terminal, and got the import to work.
This was illuminating. I will post the full doc below in case anyone wants to see it here, but the import is a bit odd which is why we did not figure it out. from wpilib.controller. import PIDController << I just edited this to work with version 2020.2.2.3 of wpilib.
Works.
Now, I need to read through the docs to implement it, but I did verify that at least in sim, the import statement is working…
I cannot post the full doc because it is too long, but I will link to a Google Doc where I pasted it.
Thank you. I was running… py -m pip install pyfrc
Then looking at older packages and updating them manually. wpilib itself was stuck at 2020.2.2.0 until I just uninstalled wpilib and reinstalled as you suggested.
Edit: After updating, the direct import worked. Thank you.
Recent versions of pip are happy to not upgrade your packages if you already have something installed and don’t explicitly ask it to, so you should do pip install -U whatever if you’re trying to upgrade.