View Single Post
  #5   Spotlight this post!  
Unread 06-02-2015, 21:10
rsaccone rsaccone is offline
Registered User
FRC #3950
 
Join Date: Feb 2013
Location: Glen Head, NY
Posts: 23
rsaccone is an unknown quantity at this point
Re: When Switching between Enable and Disable mode Talon SRX stop working

Hello,

I looked at the material that was suggested and implemented changes in our robot drive subsystem. In our drive subsystem we are using 4 Talon SRXs controllers and we place them into a RobotDrive object and the use the mecanum methods on the RobotDrive to actually make the wheels spin. Our Robot is a command based robot. We wrote a method in drive subsystem to enable the motors in the drive subsystem. This method is called from TeleOpInit and AutonomousInit to ensure that the motors are enabled and the safety mode is either enabled or disabled depending upon how we configure it in our configuration file. We set the configuration options so that the safety mode is disabled by default.

After doing this we still had issues with the motors sometimes not working when coming out of disabled mode on the Driver Station. When this would occur I could switch back to disable and then enable again and it would usually work. We also discovered that even while enabled and the motors were running for a long stretch some or all of them would eventually stop working. Mysteriously we were still getting the message about the drive output not being updated often enough. This wasn't expected because we verified that the safety mode on each motor was being disabled. We also looked at the RobotDrive code in github and it was there that we noticed that RobotDrive by default turns safety mode on. Once I added the disable on RobotDrive everything seems to work and no longer cuts out. Here's our EnableDriveSubsystem for reference.


Code:
void DriveSubsystem::EnableDriveSubsystem() {
         ConfigMgr *configMgr = ConfigInstanceMgr::getInstance();

         float expiration = 0.0;
         bool enable = configMgr->getBoolVal(ConfigKeys::Drive_EnableSafety, DRIVE_SAFETY_ENABLED_DEFAULT);

         if (enable)
         {
                 expiration=configMgr>getDoubleVal(ConfigKeys::Drive_SafetyTimeOut, DRIVE_SAFETY_TIME_OUT_DEFAULT);
         }

        Logger::GetInstance()->Log(DriveSubsystemLogId,Logger::kINFO, "DriveSubsystem:EnableDriveSubsystem() ->SafetyEnable=%s, timeout=%f\n",
                        enable ? "TRUE" : "FALSE",
                        expiration);

        SetSafetyMode(cANTalon1, enable, expiration);
        SetSafetyMode(cANTalon2, enable, expiration);
        SetSafetyMode(cANTalon3, enable, expiration);
        SetSafetyMode(cANTalon4, enable, expiration);
        robotDrive->SetSafetyEnabled(enable);

        if (enable)
        {
                robotDrive->SetSafetyEnabled(expiration);
        }

        cANTalon1->EnableControl();
        cANTalon2->EnableControl();
        cANTalon3->EnableControl();
        cANTalon4->EnableControl();


        cANTalon1->Set(0);
        cANTalon2->Set(0);
        cANTalon3->Set(0);
        cANTalon4->Set(0);
}
Reply With Quote