|
Page 1 of 1
|
[ 7 posts ] |
|
RobotC crashing on compilation
| Author |
Message |
|
enauman
Rookie
Joined: Mon Nov 09, 2009 10:51 am Posts: 21
|
 RobotC crashing on compilation
Does anyone notice anything in this program that would cause RobotC 2.01 to crash when it compiles? The laptop it crashes on is Win XP SP2 or SP3. The program compiles fine on my Win 7 laptop. It's for a joystick controlled robotic arm. I tried replacing the JoystickDriver.c file thinking maybe it was corrupt. My students are competing tomorrow and a bit desperate. Thanks, Erik  |  |  |  | Code: #pragma config(Hubs, S1, HTMotor, HTServo, none, none) #pragma config(Motor, mtr_S1_C1_1, motorD, tmotorNormal, openLoop) #pragma config(Servo, srvo_S1_C2_1, servo1, tServoNormal) #pragma config(Servo, srvo_S1_C2_2, servo2, tServoNormal) #pragma config(Servo, srvo_S1_C2_3, servo3, tServoNormal)
#include "JoystickDriver.c" void swivelArm(); void joint1up(); void joint1down(); void joint2up(); void joint2down(); void joint3open(); void joint3close(); int servo1Pos = ServoValue(servo1); int servo2Pos = ServoValue(servo2); int servo3Pos = ServoValue(servo3);
task main() { while(true) { getJoystickSettings(joystick);
swivelArm();
if(joy1Btn(5)) { joint1up(); wait1Msec(10); } if(joy1Btn(6)) { joint1down(); wait1Msec(10); } if(joy1Btn(7)) { joint2up(); wait1Msec(10); } if(joy1Btn(8)) { joint2down(); wait1Msec(10); } if(joy1Btn(9)) { joint3open(); wait1Msec(10); } if(joy1Btn(10)) { joint3close(); wait1Msec(10); } } }
void swivelArm() { motor[motorD] = joystick.joy1_x1/20; }
void joint1up() { if(servo1Pos < 100) { servo[servo1] = servo1Pos++; } }
void joint1down() { if(servo1Pos > 0) { servo[servo1] = servo1Pos--; } } void joint2up() { if(servo2Pos > 1) { servo[servo2] = servo2Pos--; } }
void joint2down() { if(servo2Pos < 187) { servo[servo2] = servo2Pos++; } }
void joint3open() { if(servo3Pos > 1) { servo[servo3] = servo3Pos--; } }
void joint3close() { if(servo3Pos < 100) { servo[servo3] = servo3Pos++; } }
|  |  |  |  |
|
| Fri Feb 03, 2012 11:16 pm |
|
 |
|
sumasmreq
Rookie
Joined: Fri Jan 27, 2012 6:57 pm Posts: 40
|
 Re: RobotC crashing on compilation
Try downloading a demo of ROBOTC 3.05; it should last you at least 30 days, and can run side by side with ROBOTC 2.0 I believe. Just don't forget to change the mastercode on your joysticks and cortex.
|
| Sat Feb 04, 2012 12:00 am |
|
 |
|
mightor
Moderator
Joined: Wed Mar 05, 2008 8:14 am Posts: 2865 Location: Rotterdam, The Netherlands
|
 Re: RobotC crashing on compilation
If you're not keen on buying ROBOTC 3.x (you'll need a license after 30 days), I would recommend switching to 2.26. You can download it here: http://www.robotc.net/files/ROBOTCforMi ... 1_BETA.exeDon't let the BETA part scare you. - Xander
_________________| Some people, when confronted with a problem, think, "I know, I'll use threads," | and then two they hav erpoblesms. (@nedbat)| My Blog: I'd Rather Be Building Robots| ROBOTC 3rd Party Driver Suite: [ Project Page]
|
| Sat Feb 04, 2012 2:12 am |
|
 |
|
enauman
Rookie
Joined: Mon Nov 09, 2009 10:51 am Posts: 21
|
 Re: RobotC crashing on compilation
I had the students try v2.26 and it still crashes on compilation of the above code. I noticed something. The JoystickDriver.c file appears to have a typo on line 20. Should #elif be #elseif? Just after this section on line 24 is #pragma systemFile // this eliminates warning for "unreferenced" functions Maybe that is preventing the program from throwing an error when it should be? Of course I will have them edit that when I see them next and see if that helps. Thanks, Erik
|
| Mon Mar 05, 2012 12:25 am |
|
 |
|
enauman
Rookie
Joined: Mon Nov 09, 2009 10:51 am Posts: 21
|
 Re: RobotC crashing on compilation
Well editing that line to #elseif made things worse, #elseif was caught as an undefined exception. My own laptop, Win 7, was starting to crash on the program compiling but what fixed that was uninstalling 2.26 and reinstalling 2.02, compiling the joystick sample program, then compiling the robot arm program made by the students. I still don't know what caused the problem...
|
| Tue Mar 06, 2012 7:14 am |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: RobotC crashing on compilation
"#elif" is a legitimate pre-processor keyword. There is no typo.
|
| Tue Mar 06, 2012 3:56 pm |
|
 |
|
enauman
Rookie
Joined: Mon Nov 09, 2009 10:51 am Posts: 21
|
 Re: RobotC crashing on compilation
Thanks I can see that now. What seems to be helping is when the crashing starts happening on a students computer we compile the joystick sample program and then it's usually able to compile their own program after that, in both v2.02 and 2.26.
|
| Tue Mar 06, 2012 4:04 pm |
|
|
|
Page 1 of 1
|
[ 7 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 4 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
|
|