Go to Post I am still holding out for the jello-based game - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-02-2010, 08:42
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
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?
  #2   Spotlight this post!  
Unread 06-02-2010, 10:45
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: overriding *Continuous methods

Could we see your code and a copy of the error/console output?
  #3   Spotlight this post!  
Unread 06-02-2010, 12:27
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
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)
  #4   Spotlight this post!  
Unread 07-02-2010, 03:24
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: overriding *Continuous methods

Please post the whole source file as is that causes the crash.
  #5   Spotlight this post!  
Unread 07-02-2010, 21:41
stevethetinker stevethetinker is offline
Registered User
FRC #1288 (RAVEN)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2004
Location: St. Charles, MO
Posts: 35
stevethetinker is an unknown quantity at this point
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:isabledInit(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:isabledPeriodic(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:isabledContinuous(void)
{
}
#endif


START_ROBOT_CLASS(RavenRobot);
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuous vs. Autonomous in Iterative Robot Shira C/C++ 4 06-02-2009 04:20
Methods of Scoring Magnechu Rules/Strategy 5 12-01-2009 17:43
Continuous turret jjdebner Motors 10 05-02-2007 11:19
Methods of communication???? aviv Chairman's Award 3 18-02-2006 20:10
Cable rigging: Cascade vs. Continuous Madison Technical Discussion 2 19-01-2004 23:23


All times are GMT -5. The time now is 21:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi