|
|
|
![]() |
|
|||||||
|
||||||||
| View Poll Results: What programming software does your FTC team use? | |||
| RobotC |
|
10 | 83.33% |
| LabVIEW |
|
2 | 16.67% |
| Voters: 12. You may not vote on this poll | |||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
So i learned RobotC pretty much in about 2 hours, at first everything was going decently but after a while, this message started popping up on my NXT followed by two beeps as well as not letting my code run:
Code:
PgmCnt: 000129 Type: 2 Code:
//Motor and Servo Hubs
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, none)
#pragma config(Hubs, S2, HTServo, none, none, none)
//Tetrix Motors
#pragma config(Motor, mtr_S1_C1_1, rightdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C1_2, leftdrive, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_1, shooter1, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C2_2, helix, tmotorNormal, openLoop, reversed)
#pragma config(Motor, mtr_S1_C3_1, shooter2, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S1_C3_2, roller, tmotorNormal, openLoop)
//Servos
#pragma config(Servo, srvo_S2_C1_1, blocker, tServoNormal)
#pragma config(Servo, srvo_S2_C1_2, ramp, tServoNormal)
#pragma config(Servo, srvo_S2_C1_3, leftarm, tServoNormal)
#pragma config(Servo, srvo_S2_C1_4, rightarm, tServoNormal)
//Lego Motors
#pragma config(Motor, motorA, , tmotorNormal, PIDControl)
#pragma config(Motor, motorB, , tmotorNormal, PIDControl)
#pragma config(Motor, motorC, , tmotorNormal, PIDControl)
#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.
void initializeRobot() //Initialize Servo Positions
{
servo[blocker]=120;
servo[ramp]=0;
servo[leftarm]=255;
servo[rightarm]=255;
return;
}
task main()
{
initializeRobot();
waitForStart(); //Wait for start of tele-op phase
//Set Global Variables
int shooterpower=0;
int rhlpower=0;
bool ldzero=false;
bool rdzero=false;
bool rhlzero=false;
while (true)
{
getJoystickSettings(joystick); //Update variables with current joystick values
//Controller 1
//Leftjoy = left motors
//Rightjoy = right motors
//Btn 8 = Roller 100, Helix 100, Lego 100
//Controller 2
//Btn2 = Shooter 80
//Btn3 = Shooter 90
//Btn4 = Shooter 100
//Btn5 = Servo left arm to 0 (left arm starts at 255)
//Btn6 = Servo right arm to 0 (right arm starts at 255)
//Btn7 = Servo Ramp to 180 (Ramp starts at 0)
//Btn8 = Servo Blocker to 160 (Blocker starts at 120)
if((joystick.joy1_y1)>5) //Left Drive
{
motor[leftdrive]=joystick.joy1_y1;
ldzero=false;
}
else if((joystick.joy1_y1<=5&&ldzero==false))
{
motor[leftdrive]=0;
ldzero=true;
}
if ((joystick.joy1_y2)>5) //Right Drive
{
motor[rightdrive]=joystick.joy1_y2;
rdzero=false;
}
else if((joystick.joy1_y2<=5&&rdzero==false))
{
motor[leftdrive]=0;
rdzero=true;
}
if(joy1Btn(8)) //Roller, Helix, and Lego
{
rhlpower=100;
motor[roller]=rhlpower;
motor[helix]=rhlpower;
motor[motorA]=rhlpower;
motor[motorB]=rhlpower;
motor[motorC]=rhlpower;
rhlzero=false;
}
else if((joy1Btn(8))==false&&rhlzero==false)
{
rhlpower=0;
motor[roller]=rhlpower;
motor[helix]=rhlpower;
motor[motorA]=rhlpower;
motor[motorB]=rhlpower;
motor[motorC]=rhlpower;
rhlzero=true;
}
if(joy1Btn(4)) //Shooter
{
shooterpower=100;
motor[shooter1]=shooterpower;
motor[shooter2]=shooterpower;
}
else if(joy2Btn(3))
{
shooterpower=90;
motor[shooter1]=shooterpower;
motor[shooter2]=shooterpower;
}
else if(joy2Btn(2))
{
shooterpower=80;
motor[shooter1]=shooterpower;
motor[shooter2]=shooterpower;
}
if(joy2Btn(5)) //LeftArm
{
servo[leftarm]=0;
}
else
{
servo[leftarm]=255;
}
if(joy2Btn(6)) //RightArm
{
servo[rightarm]=0;
}
else
{
servo[rightarm]=255;
}
if(joy2Btn(7)) //Ramp
{
servo[ramp]=180;
}
else
{
servo[ramp]=0;
}
if(joy2Btn(8)) //Blocker
{
servo[blocker]=180;
}
else
{
servo[blocker]=120;
}
}
}
Update: April 10, 2010, 11:30pm GMT-7 The line Code:
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// i have updated my code and from changing the servo config lines as suggested, i got a new message which i have updated above also. Last edited by MattSr : 11-04-2010 at 15:33. Reason: Small edits to code |
|
#2
|
||||
|
||||
|
Re: [FTC]: RobotC Issue
1. Verify that the settings in the ROBOTC "Motors and Sensors Setup" match the robot. A mismatch causes a similar response on the NXT display.
2. The "#pragma config (Servo, servo1, blocker,. . .)" statements should look like: "#pragma config(Servo, srvo_S2_C1_1, blocker, . . ." Using the ROBOTC "Motors and Sensors Setup" referenced in item #1 above should correct this problem. 3. The following text is missing [remove the " marks at the beginning and the end]: "//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//" The statement should directly follow the last "#pragma config(. . ." statement. This text was required with the version of ROBOTC used last season. I assume it is also true for the current version of ROBOTC. 4. There could be more issues, however, these items jumped out during a quick review of the code. Last edited by Michael Coleman : 10-04-2010 at 22:34. |
|
#3
|
|||||
|
|||||
|
Re: [FTC]: RobotC Issue
Quote:
|
|
#4
|
|||
|
|||
|
Re: [FTC]: RobotC Issue
Quote:
Definitely use the setup tool (as Michale suggested) to rebuild the setup #PRAGMA information block. Then, since they're already set up, delete the code declaring the shorts later. Hope that helps Last edited by NalaTI : 10-04-2010 at 22:51. |
|
#5
|
|||||
|
|||||
|
Re: [FTC]: RobotC Issue
1st. Have you tried taking the int code out and doing it??
2nd. Reflash the Firmware? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [FTC]: RobotC Question | Connor | FIRST Tech Challenge | 2 | 21-02-2010 10:52 |
| [FTC]: Buttons RobotC | JohnFogarty | FIRST Tech Challenge | 2 | 25-11-2009 19:13 |
| [FTC]: [FTC]: RobotC Template Problem (causing an FMS issue) and Potential Servo Prob | PackersFan | FIRST Tech Challenge | 11 | 26-01-2009 21:25 |
| [FTC]: RobotC Template | gdo | FIRST Tech Challenge | 14 | 10-11-2008 06:26 |