View Single Post
  #3   Spotlight this post!  
Unread 12-02-2015, 17:32
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Python: Robot Drive is not updating often enough in Auto mode?

The code that prints this error is in motorsafety.py and looks like this
Code:
 def check(self):
        """Check if this motor has exceeded its timeout.
        This method is called periodically to determine if this motor has
        exceeded its timeout value. If it has, the stop method is called,
        and the motor is shut down until its value is updated again.
        """
        if not self.safetyEnabled or RobotState.isDisabled() or RobotState.isTest():
            return
        if self.safetyStopTime < Timer.getFPGATimestamp():
            logger.warn("%s... Output not updated often enough." %
                        self.getDescription())

            self.stopMotor()
It looks like SafePWM (the base class for Victor and Talon) inherits this class. So, basically, if you don't call .set() on your motor controller object periodically it will assume your code has run away from you and stop that particular motor. The default timeout is 0.1 seconds.

Your auto code is only calling robot_drive.drive in some parts of the if structure. Therefore, the set method on those speed controllers isn't being called, hence this message printing.

You can fix this by:
1) Disabling motor safety by calling setSafetyEnabled on the motor object
2) Calling set on each motor in each iteration. I suggest something like the following:

Code:
       non_e_motor_out = 0      
       drive_out = (0,0) 
       if self.auto_loop_counter<=25:
            non_e_motor_out  = -.5 #
            self.sol.set(True)
            self.auto_loop_counter+=1
        elif self.auto_loop_counter <= 100 and self.auto_loop_counter>25:
            drive_out = (-0.5, 0)  # Drive forwards at half speed
            self.auto_loop_counter += 1
            self.sol.set(False)
            self.non_existant_motor.set(0)
        self.robot_drive.drive(drive_out[0], drive_out[1])
        self.non_existant_motor.set(non_e_motor_out)