Go to Post I feel like we should get karma points for "Inspiration via Q&A". - JVN [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-02-2016, 20:28
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
CAN Talon not working after disabling robot and re-enabling

We decided to switch from PWM Talon to CAN Talon SRX to try and take advantage of the integrated closed loop capabilities

Out first test was to use the CAN Talon's straight out of robot builder as part of a dual motor controller drive train.

All the code works correctly except that when we disable the robot then re-enable in tele-op, the motors don't move (and the LEDs on the CAN Talon's) don't change colors red/green - they just blink yellow)

Restarting robot code solves the problem. We switch back to PWM talons and all works correctly. We are suspecting something happens to the motor controllers when we disable. The CAN Talon SRX manual makes note of needing to service the controllers during disable_periodic. Curious if anyone else has this issue.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2016, 09:49
snekiam snekiam is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2010
Location: SE Michigan
Posts: 88
snekiam has a spectacular aura aboutsnekiam has a spectacular aura aboutsnekiam has a spectacular aura about
We are having a similar problem, and will be wiring up the talons with pwm tonight
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2016, 10:51
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

I was reading the Talon software manuals last night and I'm planning on checking the status of the Talons on the Roborio web page to see if they are disabled. We did confirm with the debugger that we are correctly calling the robotdrive "drive" functions with a valid magnitude and curve, so it feels like the CAN Talon is disabled...
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2016, 13:51
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: CAN Talon not working after disabling robot and re-enabling

Is the Talon firmware up-to-date?

Any errors in the DS message view?

Post your code?
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2016, 15:10
snekiam snekiam is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2010
Location: SE Michigan
Posts: 88
snekiam has a spectacular aura aboutsnekiam has a spectacular aura aboutsnekiam has a spectacular aura about
Re: CAN Talon not working after disabling robot and re-enabling

teleop periodic:
Code:
void Robot::TeleopPeriodic() {
	Scheduler::GetInstance()->Run();	
Robot::drivetrain->robotDrive->ArcadeDrive(Robot::oi->driveStick
->GetX(),Robot::oi->driveStick->GetRawAxis(4));
}
Robot map:
Code:
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX1;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX2;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX3;
std::shared_ptr<CANTalon> RobotMap::drivetraindriveSRX4;
std::shared_ptr<RobotDrive> RobotMap::drivetrainRobotDrive;

    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=ALLOCATION

void RobotMap::init() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    LiveWindow *lw = LiveWindow::GetInstance();

    drivetraindriveSRX1.reset(new CANTalon(0));
    lw->AddActuator("Drivetrain", "driveSRX1", drivetraindriveSRX1);
    
    drivetraindriveSRX2.reset(new CANTalon(1));
    lw->AddActuator("Drivetrain", "driveSRX2", drivetraindriveSRX2);
    
    drivetraindriveSRX3.reset(new CANTalon(2));
    lw->AddActuator("Drivetrain", "driveSRX3", drivetraindriveSRX3);
    
    drivetraindriveSRX4.reset(new CANTalon(3));
    lw->AddActuator("Drivetrain", "driveSRX4", drivetraindriveSRX4);
    
    drivetrainRobotDrive.reset(new RobotDrive(drivetraindriveSRX1, drivetraindriveSRX2,
              drivetraindriveSRX3, drivetraindriveSRX4));
    
    drivetrainRobotDrive->SetSafetyEnabled(true);
        drivetrainRobotDrive->SetExpiration(0.1);
        drivetrainRobotDrive->SetSensitivity(0.5);
        drivetrainRobotDrive->SetMaxOutput(1.0);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kRearLeftMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kFrontRightMotor, true);
        drivetrainRobotDrive->SetInvertedMotor(RobotDrive::kRearRightMotor, true);


    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
All talons are up to date

Last edited by snekiam : 02-02-2016 at 15:15. Reason: accidental partial submission at first
Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2016, 18:32
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

Looking at the self test results of the CAN Talon SRX in Roborio web page:

When our code works, the Talon's report Enabled/Mode 0

We then disable and re-enable in teleop mode and the Talon's report "Enabled/Mode 15"

It seems like the CAN Talons switch to mode 15 when we disable. We tried setting the modes back to 0 in the teleop init, but it doesn't seem to force them to change mode (Roborio still reports them as Mode 15)

Continuing to read Talon SRX Software User's Guide for hints..
Reply With Quote
  #7   Spotlight this post!  
Unread 02-02-2016, 18:52
snekiam snekiam is offline
Registered User
FRC #3322 (Eagle Imperium)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2010
Location: SE Michigan
Posts: 88
snekiam has a spectacular aura aboutsnekiam has a spectacular aura aboutsnekiam has a spectacular aura about
Re: CAN Talon not working after disabling robot and re-enabling

Quote:
Originally Posted by nollchr View Post
Looking at the self test results of the CAN Talon SRX in Roborio web page:

When our code works, the Talon's report Enabled/Mode 0

We then disable and re-enable in teleop mode and the Talon's report "Enabled/Mode 15"

It seems like the CAN Talons switch to mode 15 when we disable. We tried setting the modes back to 0 in the teleop init, but it doesn't seem to force them to change mode (Roborio still reports them as Mode 15)

Continuing to read Talon SRX Software User's Guide for hints..
Our talons are exhibiting the exact same behavior, except it happens DURING teleop. We have been experiencing comm issues, loosing comms every few seconds, so I guess we are switching from disabled to enabled, but that's a problem for a different thread.
Reply With Quote
  #8   Spotlight this post!  
Unread 02-02-2016, 19:11
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: CAN Talon not working after disabling robot and re-enabling

So the Self-Test is displaying "Mode: 15 : No Drive".

Can you try section 16.12 in the Talon SRX Software Reference Manual.
Reply With Quote
  #9   Spotlight this post!  
Unread 02-02-2016, 19:27
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: CAN Talon not working after disabling robot and re-enabling

Looking at WPILIB c++, RobotDrive appears to call Disable() when RobotDrive::StopMotor() is called. But it doesn't Enable() anywhere. Are you calling StopMotor()? If so try setting the output to zero using the normal routine instead (arcadeDrive, tankDrive, etc.).
Reply With Quote
  #10   Spotlight this post!  
Unread 03-02-2016, 06:35
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

Quote:
Originally Posted by ozrien View Post
Looking at WPILIB c++, RobotDrive appears to call Disable() when RobotDrive::StopMotor() is called. But it doesn't Enable() anywhere. Are you calling StopMotor()? If so try setting the output to zero using the normal routine instead (arcadeDrive, tankDrive, etc.).
We are calling stopmotor() at then end of our autonomous. I realized this last night and had theorized something like you discovered in the WPIlib source..
Reply With Quote
  #11   Spotlight this post!  
Unread 03-02-2016, 06:39
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

Quote:
Originally Posted by ozrien View Post
So the Self-Test is displaying "Mode: 15 : No Drive".

Can you try section 16.12 in the Talon SRX Software Reference Manual.
Yes, this was the first thing we tried last night once we discovered Mode 15. It appears to give us consistent operation toggling enable/disable in Teleop. We still have an issue going between autonomous and teleop, but I believe this 16.12 workaround is certainly poking at the problem area..
Reply With Quote
  #12   Spotlight this post!  
Unread 04-02-2016, 08:32
nollchr nollchr is offline
Registered User
FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Glastonbury, CT
Posts: 28
nollchr is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

Quote:
Originally Posted by ozrien View Post
So the Self-Test is displaying "Mode: 15 : No Drive".

Can you try section 16.12 in the Talon SRX Software Reference Manual.
This effectively solved our problem. The root cause was motor safety helper timing out occasionally (robot builder was enabling it by default as part of the drive train init) and a call to StopMotors in our autonomous code. Both of these events set mode 15.

We now have reliable open loop control of the CAN talons...now on to closed loop!
Reply With Quote
  #13   Spotlight this post!  
Unread 08-02-2016, 20:42
MaikeruKonare's Avatar
MaikeruKonare MaikeruKonare is offline
Programming Division Captain
AKA: Michael Conard
FRC #4237 (Team Lance-a-Bot)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2012
Location: Michigan
Posts: 15
MaikeruKonare is an unknown quantity at this point
Re: CAN Talon not working after disabling robot and re-enabling

Several of our CANTalon's had firmware 0.28, and after we updated them to 2.0 everything started working as intended.

Not sure if this is your problem, but a nice update can never hurt.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:19.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi