Timed Robot Stateful Autonomous

Hello,
I noticed that @auscompgeek updated the Stateful Autonomous example (Thank you for that). I am trying it out, but am running into some errors.

I cannot call drive code. When I try, I get

  File "C:\Users\l*\Documents\Robotics\RobotPy\examples\stateful-autonomous\autonomous\drive_backwards.py", line 16, in drive_wait
    self.drive.tankDrive(0, 0)
'DriveBackwards' [or DriveForwards] object has no attribute 'drive'

I am using the examples as is. I tried adding the following as suggested in the tutorial… from robotpy_ext.autonomous.selector_tests import *

…but that fails. with

Traceback (most recent call last):
  File "robot.py", line 7, in <module>
    from robotpy_ext.autonomous.selector_tests import *
  File "C:\Users\*\AppData\Local\Programs\Python\Python38\lib\site-packages\robotpy_ext\autonomous\selector_tests.py", line 6, in <module>
    _gsms = pyfrc.config.config_obj["pyfrc"]["game_specific_messages"]
KeyError: 'pyfrc'

I am wondering what I am missing (I am using the simulator).

Thank you.
~Mr. R^2

The tests shouldn’t be added. Where’s the tutorial you found? Needs to be updated…

Also, make sure you have the latest version of robotpy-wpilib-utilities installed (2020.1.5).

Thank you for your help. I figured out my error. Before I had the correct version of robotpy-wpilib-utilities installed, I had tried changing it to match the tutorial.

In doing so, I had changed the following line…
self.automodes = AutonomousModeSelector("autonomous", self.components)
to be…
self.automodes = AutonomousModeSelector("autonomous")
So, after updating the library and getting it to build, no components were passed during auto.
Doh.
Thank you for your help.

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