Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice from your friendly CSA #28

Open
auscompgeek opened this issue Mar 20, 2018 · 5 comments
Open

Advice from your friendly CSA #28

auscompgeek opened this issue Mar 20, 2018 · 5 comments

Comments

@auscompgeek
Copy link

Hey all! Congrats again to 5663 for winning at South Pacific.

Just wanted to note down some things I noticed on Sunday somewhere.

So I noticed that 5663 were getting CAN timeouts at some point, potentially pointing at a motor controller failure of some sort. However, this was in teleop, so those messages would also be indicative of waiting for a set acknowledgement in your main control loop, which could potentially make the robot uncontrollable in the event of a CAN bus failure. And indeed…

void Lift::ResetEncoder() {
motor1->SetSelectedSensorPosition(0, 0, 10);
}
// Override MotionMagic and limit switch control in favour of PercentOutput
void Lift::OverrideLift(bool overridden) {
encoderOverride = overridden;
}
// Run periodic tasks
void Lift::RunPeriodic() {
if(lowSwitch->Get() && motor1->GetSelectedSensorVelocity(0) > 0) ResetEncoder();

… which then leads to another thing to note: the Talon SRX is capable of re-zeroing off a limit switch, so it's surprising that you have limit switches that aren't wired to the Talons as limit switches. The SRX mag encoders provide solder pads to wire limit switches to, so getting this working at champs shouldn't be difficult :)

Wiring the switches to the Talons would also provide the benefit of the motors immediately stopping once they hit the limit switch too. Would also be a good improvement for 5333's bot for DDU :)

@JaciBrunning
Copy link
Member

Hi David,

The CAN timeouts are normal, since the motors are (as I believe) overallocated. It hasn't proven an issue so far.

As for the limit switches, it's easier for us to wire them directly to DIO than to solder them onto an SRX breakout (we don't use mag encoders).

@NonayMete @swan58 ya'll are free to take a look here.

@auscompgeek
Copy link
Author

Hm. From the somewhat brief look at the robot I had, I believe I saw a VersaPlanetary Integrated Encoder? Those are indeed SRX mag encoders.

@JaciBrunning
Copy link
Member

The VP integrated encoder is mag, yes, but its quite a ways away from where the 2nd limit switch is mounted

@NonayMete
Copy link
Contributor

NonayMete commented Mar 21, 2018

Hi, David the CAN timeouts are due to TalonSRX's being allocated but not existing and as Jaci said other 'normal' CTRE behavior. It is a lot less effort for the limit switches just to be wired to the RIO, and especially as we are only really using them for software input, not as a hard stop. Plus we are planning to replace them with IR sensors at some point, and limit switches break often so it was easier just to avoid soldering altogether.

TLDR: I'm too lazy, thanks for the advice though I will make sure to follow it next year.

@auscompgeek
Copy link
Author

So the particular CTRE CAN timeout I noticed was a SetSelectedSensorPosition call timing out (during teleop, IIRC).

From a quick search, the only Talons you're zeroing an encoder, with a timeout (as timeouts wouldn't be reported otherwise), are your master drive motors and lift motor. I would presume you aren't allocating those without the corresponding motor controllers existing. These are all happening within the control loop, if I'm reading the code correctly.

CTRE's recommendation is to only have blocking calls (i.e. calls with a timeout) on robot boot, with any calls in the robot loop having no timeout.

Regarding the microswitches though, fair enough.

Good luck at champs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants