View Single Post
  #1   Spotlight this post!  
Unread 06-02-2010, 21:24
tbinns tbinns is offline
Registered User
FRC #0131 (CHAOS)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2008
Location: Manchester, NH
Posts: 4
tbinns is an unknown quantity at this point
Error creating tasks that use encoders

The students are looking to create a couple classes that run as tasks during the life of the robot. They have used the compressor as the model of the classes. The compressor uses digital I/O directly but not the encoder class. The code compiles and we can download the image. The robot starts and the class in created without errors. When we start the class we get this error:

DisabledContinuou
DisableDribbler -> Access Dribbler State Machine1

data access
Exception current instruction address: 0x0232125c
Machine Status Register: 0x0000b032
Data Access Register: 0xfeffebff
Condition Register: 0x20000044
Data storage interrupt Register: 0x40000000
Task: 0x1d85ff8 "FRC_Dribbler"
0x1d85ff8 (FRC_Dribbler): task 0x1d85ff8 has had a failure and has been stopped.
0x1d85ff8 (FRC_Dribbler): fatal kernel task-level exception!

The victors and the encoders are not referenced in any other part of the code. From the error you see that it gets to the first print statement and errors when it tries to access the encoder.

Here are some parts of the source:

//A File Scope Function out side of the class
static void AccessDribblerStateMachine(Dribbler *d)
{
printf("Dribbler -> Access Dribbler State Machine1\n");
//d->DribblerStateMachine();
double LeftDriveRate = d->LeftEncoder->GetRate();
printf("Dribbler -> Access Dribbler State Machine2<%f>\n", LeftDriveRate);
}

Here is the construct of the class with the task and the creation of a couple victors and encoders.
Dribbler:ribbler(DashSharing *DashDataPass)
: DribblerTask("Dribbler", (FUNCPTR) AccessDribblerStateMachine)
{
LeftDribbler = new Victor(DIO_MODULE1, LEFT_DRIBBLING_MOTOR_CHANNEL);
RightDribbler = new Victor(DIO_MODULE1, RIGHT_DRIBBLING_MOTOR_CHANNEL);

DashData = DashDataPass;

LeftEncoder = new Encoder(DIO_MODULE1, LEFT_MOTOR_ENCODER_CHANNEL_A, DIO_MODULE1, LEFT_MOTOR_ENCODER_CHANNEL_B, ENCODER_DISTANCEPERPULSE);
RightEncoder = new Encoder(DIO_MODULE1, RIGHT_MOTOR_ENCODER_CHANNEL_A, DIO_MODULE1, RIGHT_MOTOR_ENCODER_CHANNEL_B, ENCODER_DISTANCEPERPULSE);

Thanks in advance,
Todd Binns
Software Mentor
Reply With Quote