Robotpy Wpimath install/upgrade

Is there any documentation on how to install/upgrade wpimath? We are trying to use the PIDController class of wpimath.controller, but whenever running locally in the sim or deploying on to our robot, we get the following error:
module ‘wpimath’ has no attribute ‘controller’
Here are our versions. Thank you for your help.

Neat dependency graph. If you install the robotpy package, it should automatically pull in the robotpy-wpimath package during installation. You can verify that it is installed by looking at the output of py -m pip list

You have to import wpimath.controller, not just wpimath:

$ python
Python 3.10.1 (main, Dec  7 2021, 00:00:00) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wpimath
>>> wpimath.controller
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'wpimath' has no attribute 'controller'
>>> import wpimath.controller
>>> wpimath.controller
<module 'wpimath.controller' from 'wpimath/controller/__init__.py'>

Just tested, and worked. Thank you for your help.

Cool dependency graph! Did you make that yourself or with the aid of some program?

We made it in a google slideshow. There’s definitely an easier way to do it though.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.