View unanswered posts | View active topics It is currently Fri Dec 19, 2014 4:28 pm






Reply to topic  [ 6 posts ] 
Servo Communication Problem 
Author Message
Rookie

Joined: Fri Oct 16, 2009 8:56 am
Posts: 2
Post Servo Communication Problem
Can someone help me with an error I can't seem to resolve for my students using robotc 1.93 and preparing for the FTC. We keep getting the following error...

**Error**:Compile time constant array index '65' is outside of array bound '0..23'

on the following line

servo[servo1]=255;


In the context of
if (joy1Btn(6)) {
servo[servo1]=255;
}

We can communicate with servo1 through the Servo debugger window so know that the name is correct and it is hooked up correctly...

Any thoughts?


Fri Oct 16, 2009 9:02 am
Profile
Rookie

Joined: Fri Oct 16, 2009 4:00 pm
Posts: 2
Post Re: Servo Communication Problem
I'm the team leader for this team - here are are #pragmas
Code:
#pragma config(Servo,  srvo_S3_C1_1,    arm1,                 tServoNormal)
#pragma config(Servo,  srvo_S3_C1_2,    arm2,                 tServoNormal)
#pragma config(Servo,  srvo_S3_C1_3,    arm3,                 tServoNormal)


... and the offending code.
Code:
if(joy1Btn(1))          // If Button 5 is pressed:
   {
      //motor[motorD]=50;
      servo[arm1] = 0;      // Raise Servo 1 to position 200.
      wait1Msec(2000);
   }


We've also tried removing the 'arm1' and simply leaving it blank, which I thought would set it to the default of 'servo1', which still gives an error. I've also tried 'ServoTarget[arm1],' but nothing seems to work.


Fri Oct 16, 2009 4:06 pm
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Servo Communication Problem
I had to test your issue out, but it looks like a bug in ROBOTC with how they address servos in the servo array. Specifically, I'm thinking the array was not modified when the servo controller pragmas were updated to allow for multiple servo controllers on other sensor ports in v1.93.

Not sure if this has already been reported, so mods, FYI. I get an array index out of bounds error when setting a target for any servo on a servo controller on sensor ports 2 through 4.

As for a workaround, just move your tetrix servo controller from sensor port 3 on your NXT to sensor port 1 and update the motor/servo/sensor setup appropriately and your code should compile fine.


Fri Oct 16, 2009 6:11 pm
Profile
Rookie

Joined: Fri Oct 16, 2009 4:00 pm
Posts: 2
Post Re: Servo Communication Problem
l0jec wrote:
I had to test your issue out, but it looks like a bug in ROBOTC with how they address servos in the servo array. Specifically, I'm thinking the array was not modified when the servo controller pragmas were updated to allow for multiple servo controllers on other sensor ports in v1.93.

Not sure if this has already been reported, so mods, FYI. I get an array index out of bounds error when setting a target for any servo on a servo controller on sensor ports 2 through 4.

As for a workaround, just move your tetrix servo controller from sensor port 3 on your NXT to sensor port 1 and update the motor/servo/sensor setup appropriately and your code should compile fine.


Thank you! We aren't with the robot right now (Tuesday is next meeting), but we will switch the servos around and see if that works.


Sat Oct 17, 2009 2:03 pm
Profile
Rookie

Joined: Fri Oct 16, 2009 8:56 am
Posts: 2
Post Re: Servo Communication Problem
Tried it and it fixed problem. Switching servo controller to s1 did fix problem as a work around so I guess it is just a bug. Thanks so much for the help!


Mon Oct 19, 2009 8:21 am
Profile
Expert

Joined: Mon Oct 27, 2008 9:59 pm
Posts: 139
Post Re: Servo Communication Problem
Glad to hear it worked.
Hopefully this and other issues will be just a bad memory when the 2.x version is released soon. :poke:


Mon Oct 19, 2009 9:57 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.