View unanswered posts | View active topics It is currently Sat Oct 25, 2014 5:05 am






Reply to topic  [ 5 posts ] 
Run error? 
Author Message
Rookie

Joined: Sat Apr 02, 2011 3:15 pm
Posts: 6
Post Run error?
My team has been using RobotC to program this season and it has worked very well. But when i tried to put an encoder in, it started messing with things. Now we can't run programs. As soon as you click "Teleop Ready", the screen reads:
PgmCnt: 0000F2
Type: 2

And it has a loading sign underneath. It is very frustrating. We would be using Labview at this point except our NXT brick is rejecting anything Labview :breakcomputer: I'll put the code beneath, and thanks in advance to everyone.

#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTServo)
#pragma config(Motor, mtr_S1_C4_1, arm2, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C4_2, motorY, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_1, arm1, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_2, Dispenser, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_1, LftDrvWhls, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_2, RgtDrvWhls, tmotorNormal, openLoop, reversed)
#pragma config(Servo, srvo_S1_C1_1, servoA, tServoStandard)
#pragma config(Servo, srvo_S1_C1_2, Dropper, tServoStandard)
#pragma config(Servo, srvo_S1_C1_3, Catch, tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

//***DONT TOUCH ABOVE***///

#include "JoystickDriver.c"

task main()
{
int threshold = 5;

while(true)
{
getJoystickSettings(joystick);

nMotorEncoder[arm1] = 0;

if(abs(joystick.joy1_y1) > threshold)
{
motor[LftDrvWhls] = (joystick.joy1_y1) * 100/127;
}
else
{
motor[LftDrvWhls] = 0;
}

if(abs(joystick.joy1_y2) > threshold)
{
motor[RgtDrvWhls] = (joystick.joy1_y2) * 100/127;
}
else
{
motor[RgtDrvWhls] = 0;
}

while(joy1Btn(7) == 1)
{
motor[arm1] = 30;
}
motor[arm1] = 0;

while(joy1Btn(5) == 1)
{
motor[arm1] = -30;
}
motor[arm1] = 0;

while(joy1Btn(10) == 1)
{
motor[arm2] = 30;
}
motor[arm2] = 0;

while(joy1Btn(9) == 1)
{
motor[arm2] = -30;
}
motor[arm2] = 0;

if(joy1Btn(2) == 1)
{
servo[Catch] = 80;
}

if(joy1Btn(3) == 1)
{
servo[Catch] = 0;
}

while(joy1Btn(1) == 1)
{
motor[Dispenser] = 100;
}

motor[Dispenser] = 0;

if(joy1Btn(8) == 1)
{
servo[Dropper] = 165;
}

if(joy1Btn(6) == 1)
{
servo[Dropper] = 255;
}
}
}


Sat Apr 02, 2011 3:21 pm
Profile
Rookie
User avatar

Joined: Mon Feb 23, 2009 12:40 pm
Posts: 27
Post Re: Run error?
rperera,

From a quick look, we noticed that your pragma does not specify that your motor has an encoder. Here is a sample pragma with an encoder specified.

#pragma config(Motor, mtr_S1_C1_2, TowerMotor, tmotorNormal, openLoop, encoder)

Renee


Sat Apr 02, 2011 4:10 pm
Profile
Rookie

Joined: Sat Apr 02, 2011 3:15 pm
Posts: 6
Post Re: Run error?
Renee,
I put the fix in, so the pragma for that reads:
#pragma config(Motor, mtr_S1_C3_1, arm1, tmotorNormal, openLoop, encoder)
I tried running it and got the same error. One of my more experienced counterparts told me that although he doesn't know what it means, the hexadecimal code it was displaying, 0000F2, is a light shade of blue.


Sat Apr 02, 2011 4:57 pm
Profile
Rookie
User avatar

Joined: Mon Feb 23, 2009 12:40 pm
Posts: 27
Post Re: Run error?
Ok, we looked a little closer. Your pragma lines have conflicts. The first line states that you have a motor, motor, motor, servo (in that order). However, your motor designation for the arm lists it is on sensor port 1 controller 4, but the first line says controller 4 is a servo.

Clean up the pragmas and it should work.

Renee

By the way, what team number are you?
We are team 2843.


Sat Apr 02, 2011 5:21 pm
Profile
Rookie

Joined: Sat Apr 02, 2011 3:15 pm
Posts: 6
Post Re: Run error?
Thanks Renee. I guess the RobotC Beta can miss things; I manually redid the pragmas and that solved the problem. Everything runs perfect now.
We are FTC 4509 (FLAME).

--Ryan


Mon Apr 04, 2011 5:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.