![]() |
Re: [C++] Use CAN Talons in RobotDrive
Please post your progress... we have the same exact need, and are hard coding our drive code currently... CAN has so many benefits, but so does using RobotDrive...
Thanks! |
Re: [C++] Use CAN Talons in RobotDrive
Quote:
|
Re: [C++] Use CAN Talons in RobotDrive
This might help, I ran this code on my mec bot, with gyro and CANTalons. I use IterativeRobot (it's just my preference).
http://www.chiefdelphi.com/forums/sh...3&postcount=20 |
Re: [C++] Use CAN Talons in RobotDrive
Quote:
Code:
leftFront->SetControlMode(CANSpeedController::kPercentVbus); |
Re: [C++] Use CAN Talons in RobotDrive
Ok I got it working! It's kind of an unusual workaround, but it works fine for us. Basically, create 4 fake motor controllers on unused PWM ports, and pass those to RobotDrive. From there, set the values of the real motor controllers to the values of the fake ones. Here is part of the code we used:
Code:
CANTalon *leftFront = new CANTalon(1); //Real ones |
Re: [C++] Use CAN Talons in RobotDrive
The problem looks like it's motor safety tripping. I reproduced the symptom with a similar project. Either the robot hits the motor safety trip once it boots up, or it fires during disable-to-enable transitions. When this happens the driver station will throw the MotorSafetyHelper assert (Section 16.14 in Talon SRX software reference manual), and the self-test will report "No-drive ".
I bet if you just called m_robotDrive->SetLeftRightMotorOutputs(0,0) in the disabled loop, that will keep feeding the motor safety object often enough to prevent your problem. Or alternatively just TURN OFF the feature with... m_robotDrive->SetSafetyEnabled(false) Using dummy PWM objects seems like a drastic workaround. Here's what I tested. If you comment out DisabledPeriodic(), you can reproduce the problem. Code:
#include "WPILib.h" |
Re: [C++] Use CAN Talons in RobotDrive
I tried turning the safeties off already and it didn't work, but I'll try the disabled loop tomorrow and get back. I agree that dummy PWMs is a bad solution, but we're going all CAN this year so it shouldn't really affect anything, and we will probably revert to it if your solution doesn't work because we've spent too long trying to get this to work. Thanks for the help though!
|
Re: [C++] Use CAN Talons in RobotDrive
Quote:
Anyway if you are still seeing the EXACT symptom of "...Motor Safety Timeout..." errors in the DS then you need to remedy it. Even with the PWM workaround (eek) you're still generating errors in your DS log. That's going to prevent your drive team from seeing other reported errors (because they will get used to seeing errors in that area of the DS". m_robotDrive->SetSafetyEnabled(false); will absolutely prevent MS errors. If you are still seeing them then something is very wrong, and it will likely be a problem throughout the season. |
Re: [C++] Use CAN Talons in RobotDrive
Definitely turn off the motor safety on the RobotDrive object, not the individual motor controllers and see if that fixes the problem. In the library, RobotDrive is the only place where the motor safety stuff is enabled by default, and as Omar said, it is part of the RobotDrive class as a whole. The thought was that it would stopping the runaway program from driving on it's own was the highest priority.
Use something like: drive.SetSafetyEnabled(false); Please let us know if does it for you. |
| All times are GMT -5. The time now is 21:12. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi