Using RobotPy, testing code that will retract an arm system back to zero position at the enablement of the Teleop() in the driver station. We are aware of the watchdog thread 100ms vs the Periodic 20ms. We are not using CommandBase and wondering if it’s possible on generic RobotPy program. Pseudo Code/Use Case:
RobotInit()
- Set retract_arm_flag = True
TeleopInit()
- If retract_arm_flag = True
- Get Arm Retract Limit Switch Position from limit switch value
- If = Off/False (Limit Switch is not triggered) Then start motor at 50% to retract arm
- Keep checking Arm Retract Limit Switch Position value
- When Arm Retract Limit Switch Position = True set the motor to 0% arm is fully retracted, set retract_arm_flag = False
When we implement this, the motor jolts, stop and starts at random period cycles until it triggers the switch and turns off.
We’re not able to go to CommandBase right now, just exploring if there re any options to keep the motor running smoothly?