Enabling autonomous cuts communication

Yeah. When we enable autonomous, the Robot Code and then the Communication lights cut out. Our autonomous function looks like:

void Autonomous(void) {
d_base->SetSafetyEnabled(true);
Timer timer;
timer.Start();
while (IsAutonomous()) {
[INDENT]Aim();
GetWatchdog().Feed();
Wait(0.01);
}[/INDENT]
}

d_base is our RobotDrive, Aim() uses a modified version of the 2012 Vision example, and there’s a problem that may or may not be related. In messages, whenever the robot starts, we get “ERROR: Attempted to reuse allocated resource: Forward Relay 1 (Module: 1) …in Allocate() in C:/WindRiver/workspace/WPILib/Resource.cpp at line 76.”

When we comment out the vision code, autonomous doesn’t cut communication, but the reuse error still comes up and it prints “ERROR: A timeout has been exceeded: RobotDrive… Output not updated often enough …” etc even though Expiration is set at 0.1s and we are feeding the watchdog every 0.01s. We also kind of need the vision code working to help aim/autoaim. Help would be appreciated.

I would put a smiley here, but they are too smarmy for my tastes, so I’ll put them lower instead.

:wink: :stuck_out_tongue: :wink: :confused: :slight_smile:

Fixing the relay reallocation error should be easy. I’d do that before trying to debug the autonomous code.

The RobotDrive timeout isn’t coming from the watchdog. It’s coming from the motor safety associated with the drive motors. Some call it a “watchpuppy”. If you don’t set a motor output value every 100 milliseconds or faster, the safety cuts off the motor and reports the error. It’s only enabled by default on the drive motors. Since your autonomous loop doesn’t do any drive motor control, you’ll get that error.

It’s apparent from your description that something in Aim() is crashing the code. Do you see any relevant messages on the console?