|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: roboRIO Command Based Problems
You are getting the MotorSafetyHelper error because you are not updating the motor outputs fast enough so the watchdog timer is expiring. If any execute method blocks for a long time, it will prevent all commands from running, therefore causing a watchdog timeout.
|
|
#2
|
||||
|
||||
|
Re: roboRIO Command Based Problems
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: roboRIO Command Based Problems
That depends on what is making it take too long. We can guess at possible causes, but unless you show us your code we can't give confident help.
Post your code, as Kyle suggested in his first response. |
|
#4
|
||||
|
||||
|
Re: roboRIO Command Based Problems
I added the DriveBase subsystem, and the drive command to the post. Tell me what you think.
Last edited by King Nerd III : 02-03-2015 at 02:36 PM. Reason: added OI for oi->GetStickAxis |
|
#5
|
||||
|
||||
|
Re: roboRIO Command Based Problems
Code:
48void DriveBase::AutoDriveTurn(float speed, float angle){
49 while(drive_gyro->GetAngle() >= angle){
50 fl_motor->Set(speed);
51 fr_motor->Set(speed);
52 bl_motor->Set(speed);
53 br_motor->Set(speed);
54 }
55 }
The better way to do this that won't cause you problems is to use a command. Code:
32 class AutoDriveTurnCommand() {
33 private:
34 double mSpeed;
35 double mAngle;
36 public:
37 AutoDriveTurnCommand(double speed, double angle) {
38 mSpeed = speed;
39 mAngle = angle;
40 }
41 void Initialize() {
42 Robot::drivebase->DriveTank(speed, speed);
43 }
44 void Execute() {}
45 bool IsFinished() {
46 return Robot::drivebase->GetGyroAngle() < mAngle;
47 }
48 void End() {
49 Robot::drivebase->DriveTank(0, 0);
50 }
51 void Interrupted() {
52 End();
53 }
54 };
|
|
#6
|
||||
|
||||
|
Re: roboRIO Command Based Problems
Quote:
|
|
#7
|
||||
|
||||
|
Re: roboRIO Command Based Problems
I know this is an old thread, and I'm replying to myself, but yesterday we figured out the problem. In the Robot.cpp we were calling auto_command->End(); in the TeleOpInit Phase, but we had not given a specific command to auto_command, so when TeleOp was enabled it couldn't end the command and just died... At least that's how I believe we fixed it. Commenting out the auto_command->End() got rid of this problem, so we believe that's what it was.
Hope this helps! Isaac |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|