![]() |
overriding *Continuous methods
I am using IterativeRobot and it spits out messages saying 'override me' for each of the DisabledContinuous, TeleopContinuous, and AutonomousContinuous methods. But when I try to do that and give it an empty method implementation, the program crashes. I don't have the console output of the crash now but I can post it later. Not sure what good it will do, it's just a bunch of hex numbers. Has anyone run into this? what is the solution?
|
Re: overriding *Continuous methods
Could we see your code and a copy of the error/console output?
|
Re: overriding *Continuous methods
The code is very simple:
void DisabledContinuous(void) { } TeleopContinuous is similar. Here is what I get from trying to run code with these methods in it. task 0x1347df0 (FRC_DriverStation) deleted: errno=0 (0) status=0 (0) If TeleopContinuous is the only one enabled, the code runs. If both TeleopContinuous and DisabledContinuous are enabled, here is what I get. Note that the task stopped is not the robot task; our robot task still runs. instruction access Exception next instruction address: 0x6f744260 Machine Status Register: 0x4000b032 Condition Register: 0x20000844 Task: 0xe40e58 "FRC_RobotTask" 0xe40e58 (FRC_RobotTask): task 0xe40e58 has had a failure and has been stopped. 0xe40e58 (FRC_RobotTask): fatal kernel task-level exception! task 0xe40e58 (FRC_RobotTask) deleted: errno=0 (0) status=0 (0) task 0x1d5fe28 (t7) deleted: errno=0 (0) status=0 (0) task 0x1314a50 (t8) deleted: errno=0 (0) status=0 (0) WPILib was compiled from SVN revision 2069 task 0x1e13f20 (tFRC_UserProgram_StartupLibraryInit) deleted: errno=196709 (0x30065) status=0 (0) Here is what I get when DisabledContinuous is the only one enabled: task 0x1314870 (FRC_DriverStation) deleted: errno=0 (0) status=0 (0) task 0xe40e58 (FRC_RobotTask) deleted: errno=0 (0) status=0 (0) task 0x1d60e60 (t9) deleted: errno=0 (0) status=45106 (0xb032) task 0x1314a50 (t10) deleted: errno=0 (0) status=0 (0) WPILib was compiled from SVN revision 2069 task 0x1e13f00 (tFRC_UserProgram_StartupLibraryInit) deleted: errno=196709 (0x30065) status=0 (0) |
Re: overriding *Continuous methods
Please post the whole source file as is that causes the crash.
|
Re: overriding *Continuous methods
I have cleaned some things up. Can't leave tasks unterminated. The posted errors are from the cleaned up code and are different from those I originally posted. I have also posted the file.
I have put some comments towards the top of the file with some #define directives that activate the questionable code. With both teleopcontinuous and disabledcontinuous enabled: task 0x1d5ae90 (FRC_DriverStation) deleted: errno=0 (0) status=0 (0) task 0x1d54c20 (FRC_RobotTask) deleted: errno=0 (0) status=0 (0) task 0x899560 (t5) deleted: errno=0 (0) status=45106 (0xb032) task 0x1d5b070 (t6) deleted: errno=0 (0) status=0 (0) WPILib was compiled from SVN revision 2069 task 0x1e119a8 (tFRC_UserProgram_StartupLibraryInit) deleted: errno=196709 (0x30065) status=0 (0) With disabledcontinuous enabled only: Please press Ctrl+Break to close the console. task 0x1d611e8 (wtxC1112tmp) deleted: errno=196709 (0x30065) status=45106 (0xb032) -> Here is the source: /* RavenRobot.cpp Provides the declaraion and implementation of the RavenRobot class. */ #include "IterativeRobot.h" #include "RavenRobot.h" #include "RavenGyro.h" #include "AcquireAimKickMgr.h" #include "AimKickMgr.h" #include "KickMgr.h" #include "DriveMgr.h" #include "AnalogChannel.h" #include "Joystick.h" #include "WPILib.h" #include "WatchDog.h" /* #include "Vision2009/AxisCamera.h" #include "Vision2009/BaeUtilities.h" #include "Vision2009/FrcError.h" #include "VisionAPI.h" */ // continuous method anomaly: //#define TC // only this fails as noted in the errors posted //#define DC // only this works // both turned on, fails as noted in the errors posted static const UINT32 s_spinPort = 2; static const UINT32 s_drivePort = 1; ASSIGN_ANALOG(s_gyroPort, 3); class RavenRobot : public IterativeRobot { public: RavenRobot(); ~RavenRobot(); private: void RobotInit(void); // for power on void DisabledInit(void); // each time disabled is entered void AutonomousInit(void); // each time auto is entered void TeleopInit(void); // each time tele is entered void DisabledPeriodic(void); void AutonomousPeriodic(void); void TeleopPeriodic(void); #ifdef TC void TeleopContinuous(void); #endif #ifdef DC void DisabledContinuous(void); // #endif // these can be created any time //Watchdog m_watchdog; //DriverStation *m_ds; #if 0 AcquireAimKickMgr* m_acquireAimKickMgr; AimKickMgr* m_aimKickMgr; KickMgr* m_kickMgr; #endif AnalogChannel* m_rangeFinder[2]; DigitalOutput* m_rangeCommand[2]; Joystick* m_sticks[2]; // these must be created in a particular order and not in the constructor RavenGyro* m_gyro; // initialized in disabled periodic - do first RavenDrive* m_drive; // created in TeleopInit - do second DriveMgr* m_driveMgr; // created in TeleopInit - do third int m_printTimer; //AutoTask* m_autoTask; }; RavenRobot::RavenRobot() { #if 0 m_acquireAimKickMgr = new AcquireAimKickMgr(m_drive); m_aimKickMgr = new AimKickMgr(m_drive); m_kickMgr = new KickMgr(); #endif #if 0 m_rangeFinder[0] = new AnalogChannel(2,3); m_rangeFinder[0]->SetAverageBits(0); m_rangeFinder[0]->SetOversampleBits(0); m_rangeCommand[0] = new DigitalOutput(8); m_rangeFinder[1] = new AnalogChannel(2,4); m_rangeFinder[1]->SetAverageBits(0); m_rangeFinder[1]->SetOversampleBits(0); m_rangeCommand[1] = new DigitalOutput(9); #endif m_gyro = 0; m_drive = 0; m_driveMgr = 0; m_sticks[SPIN] = 0; m_sticks[DRIVE] = 0; m_printTimer = 0; //m_autoTask = 0; GetWatchdog().SetEnabled(false); } RavenRobot::~RavenRobot() { #if 0 delete m_rangeFinder[0]; delete m_rangeCommand[0]; delete m_rangeFinder[1]; delete m_rangeCommand[1]; #endif #if 0 delete m_acquireAimKickMgr; delete m_aimKickMgr; delete m_kickMgr; //delete m_gyro; #endif if (m_driveMgr) delete m_driveMgr; if (m_sticks[DRIVE]) delete m_sticks[DRIVE]; if (m_sticks[SPIN]) delete m_sticks[SPIN]; if (m_drive) delete m_drive; //if (m_autoTask != 0) //{ // m_autoTask->Stop(); // delete m_autoTask; //} //m_watchdog.Kill(); } void RavenRobot::RobotInit(void) { // Runs exactly once at powerup. } void RavenRobot::DisabledInit(void) { #if 0 // figure out how to init the gyro if (m_gyro != 0) { delete m_gyro; } m_gyro = new RavenGyro(s_gyroPort); #endif } void RavenRobot::AutonomousInit(void) { //m_autoTask = new AutoTask; not ready for this yet } void RavenRobot::TeleopInit(void) { //if (m_autoTask != 0) //{ // m_autoTask->Stop(); // delete m_autoTask; // m_autoTask = 0; //} //m_ds = DriverStation::GetInstance(); m_drive = new RavenDrive(); m_sticks[SPIN] = new Joystick(s_spinPort); m_sticks[DRIVE] = new Joystick(s_drivePort); m_driveMgr = new DriveMgr(m_gyro, m_drive, m_sticks); //GetWatchdog().SetEnabled(false); } void RavenRobot::DisabledPeriodic(void) { #if 0 // gyro init may need to go here if (m_gyro == 0) { m_gyro = new RavenGyro(s_gyroPort); return; } if ((m_printTimer % 5) == 0) { if (m_spinStick->GetRawButton(3)) { float heading = m_gyro->GetAngleRadians(); printf("disabled gyro heading radians %f\n", heading); } } m_printTimer++; //m_watchdog.Feed(); #endif } void RavenRobot::AutonomousPeriodic(void) { //if (m_autoTask != 0) // m_autoTask->Resume(); m_printTimer++; //m_watchdog.Feed(); } ASSIGN_BUTTON(s_sampleLeftSensor, SPIN, 1); ASSIGN_BUTTON(s_sampleRightSensor, SPIN, 2); ASSIGN_BUTTON(s_sampleGyro, SPIN, 3); void RavenRobot::TeleopPeriodic(void) { bool gotSomething = false; #if 0 for (UINT32 i = 0; i <= 12; i++) { bool value = m_sticks[DRIVE]->GetRawButton(i); if (value) printf("button %u\n", i); } #endif #if 0 gotSomething = m_acquireAimKickMgr->TeleopPeriodic(); // Check for various switches and combinations. Order is important. if (! gotSomething) gotSomething = m_aimKickMgr->TeleopPeriodic(); if (! gotSomething) gotSomething = m_kickMgr->TeleopPeriodic(); #endif if (! gotSomething) m_driveMgr->TeleopPeriodic(); #if 0 if ((m_printTimer % 5) == 0) { if (READ_BUTTON(s_sampleLeftSensor)) { float volts = m_rangeFinder[0]->GetVoltage(); printf("rangefinder 0 %f volts\n", volts); m_rangeCommand[0]->Pulse(22); } if (READ_BUTTON(s_sampleRightSensor)) { float volts = m_rangeFinder[1]->GetVoltage(); printf("rangefinder 1 %f volts\n", volts); m_rangeCommand[1]->Pulse(22); } #if 0 if (READ_BUTTON(s_sampleGyro)) { float heading = m_gyro->GetAngleRadians(); printf("teleop gyro heading radians %f\n", heading); } #endif } #endif m_printTimer++; //m_watchdog.Feed(); } #ifdef TC void RavenRobot::TeleopContinuous(void) { } #endif #ifdef DC void RavenRobot::DisabledContinuous(void) { } #endif START_ROBOT_CLASS(RavenRobot); |
| All times are GMT -5. The time now is 01:55. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi