I am new-ish to python and I am trying to run autonomous from the DS. When enable auto, the net console says “valid autonomous” and runs it but nothing happens. What should happen is the grabber motor should spin.
The key spots to look are the little grab()
method in robot.py and all of firstAuto.py. The problem very likely has to do with me not knowing how to use python methods, and it could also be that I am using CommandBase and not SequentialCommandGroup for the auto. Any ideas?
Thanks in advance!
robot.py (20.0 KB)
firstAuto.py (557 Bytes)
The problem is that you’re sorta trying to use commands for autonomous, but you’re mostly not using commands at all (as evidenced by the very large teleopPeriodic
function).
Since your code isn’t using commands except for autonomous, I would recommend that you just take all the logic that is in FirstAuto.execute()
and put it in autonomousInit
/autonomousPeriodic
instead and get rid of FirstAuto.
Later you can try restructuring your code to be more command-based (see the examples for more help). If you actually want to use commands, then you have to periodically call CommandScheduler.run(). The RobotPy command examples all inherit from commands2.TimedCommandRobot
which does that for you automatically.
1 Like