Go to Post Perfection is less about effort or skill than it is about having a clear and limited goals. - SoftwareBug2.0 [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
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

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 10-04-2010, 21:59
MattSr's Avatar
MattSr MattSr is offline
Mentor/Programmer/Animator
AKA: Matt Cyril Senior
FRC #0488 (Team Xbot)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Seattle, Washington
Posts: 21
MattSr is an unknown quantity at this point
Send a message via AIM to MattSr Send a message via MSN to MattSr Send a message via Yahoo to MattSr
Angry [FTC]: RobotC Issue

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
Here is my code

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;
    }
  }
}
I have been working on this one issue for about 3 hours now so here's thanks in advance to anyone willing to help

Update: April 10, 2010, 11:30pm GMT-7

The line
Code:
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
doesn't make any difference in the error

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.
__________________


Much love to my favorite FRC teams:
1983 Skunkworks - 360 The Revolution - 2898 Flying Hegehogs - 2557 Sota Bots - 2942 Tech Robotics

Last edited by MattSr : 11-04-2010 at 15:33. Reason: Small edits to code
Reply With Quote
  #2   Spotlight this post!  
Unread 10-04-2010, 22:30
Michael Coleman's Avatar
Michael Coleman Michael Coleman is offline
Registered User
no team
 
Join Date: Nov 2006
Rookie Year: 2001
Location: Orlando, Florida
Posts: 82
Michael Coleman is a glorious beacon of lightMichael Coleman is a glorious beacon of lightMichael Coleman is a glorious beacon of lightMichael Coleman is a glorious beacon of lightMichael Coleman is a glorious beacon of light
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 10-04-2010, 22:38
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,580
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: [FTC]: RobotC Issue

Quote:
Originally Posted by Michael Coleman View Post
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.
That text is just a comment from RobotC saying it did it. It does not effect the code though yes your (short) code should be set up as names in the motor and sensors setup.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #4   Spotlight this post!  
Unread 10-04-2010, 22:46
NalaTI NalaTI is offline
Registered User
AKA: Alan
FTC #2848 (Techno Guards)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2005
Location: California
Posts: 106
NalaTI is just really niceNalaTI is just really niceNalaTI is just really niceNalaTI is just really nice
Re: [FTC]: RobotC Issue

Quote:
Code:
#pragma config(Servo, servo1, blocker, tServoNormal)
#pragma config(Servo, servo2, ramp, tServoNormal)
#pragma config(Servo, servo3, leftarm, tServoNormal)
#pragma config(Servo, servo4, rightarm, tServoNormal)

-- Snip -- 

short blocker=0;
short ramp=0;
short leftarm=0;
short rightarm=0;
The obvious thing that I see is that you are creating shorts with the same name as the servos and you are setting them to zero. Since this is an index into an array, and it is an enum, you are, in essence, telling the controller that all the servos are at location 0... which unfortunately is attached to a Motor Controller...

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.
Reply With Quote
  #5   Spotlight this post!  
Unread 10-04-2010, 22:36
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,580
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: [FTC]: RobotC Issue

1st. Have you tried taking the int code out and doing it??
2nd. Reflash the Firmware?
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
Reply


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
[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


All times are GMT -5. The time now is 13:02.

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