View unanswered posts | View active topics It is currently Tue Jan 15, 2019 9:31 pm






Reply to topic  [ 8 posts ] 
PmgCnt: 0008E2 Type: 2 
Author Message
Rookie

Joined: Wed Jan 28, 2015 2:06 pm
Posts: 6
Post PmgCnt: 0008E2 Type: 2
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, motorA, motorB, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, motorB, motorC, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C2_1, servo1, tServoStandard)
#pragma config(Servo, srvo_S1_C2_2, servo2, tServoStandard)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)

//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#pragma DebuggerWindows("joystickSimple")

task main()
{

while(1 == 1)
{

getJoystickSettings(joystick);
motor[motorB] = joystick.joy1_y1;
motor[motorC] = joystick.joy1_y2;




if (joystick.joy1_Buttons == 0)//Bucket Twist
{
servoTarget[servo1] = 12;
}
else
{
servoTarget[servo1] = 117;
}
if(joystick.joy1_Buttons == 1)//Bucket Level, Angle 1
{
servoTarget[servo2] = 28;
servoTarget[servo2] = 209;
}
else
{
servoTarget[servo1] = 105;
servoTarget[servo2] = 137;
}
if(joystick.joy1_Buttons == 2)//Bucket Level, Angle 2
{
servoTarget[servo1] = 61;
servoTarget[servo2] = 176;
}
if(joystick.joy1_Buttons == 3)//Bucket Level, Angle 3
{
servoTarget[servo1] = 143;
servoTarget[servo2] = 176;
}
}
}


Sat Jan 31, 2015 1:46 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: PmgCnt: 0008E2 Type: 2
Hi there,

Please tell us what the problem is, rather than leaving it up to us to guess. We fired all of our psychic staff last year, although none of them saw it coming.

Be descriptive:
  • What version of ROBOTC are you using?
  • What platform? EV3 or NXT?
  • What were you doing when the problem occurs?
  • Can you reproduce it reliably?

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Feb 01, 2015 2:51 am
Profile WWW
Rookie

Joined: Wed Jan 28, 2015 2:06 pm
Posts: 6
Post Re: PmgCnt: 0008E2 Type: 2
Version 4.0
NXT brick

We tried a different brain/brick and we got the same message


Mon Feb 02, 2015 2:37 pm
Profile
Rookie

Joined: Wed Jan 28, 2015 2:06 pm
Posts: 6
Post Re: PmgCnt: 0008E2 Type: 2
We no longer get the error message but when we run the program all the robot does is beep and does not run the program


Mon Feb 02, 2015 4:06 pm
Profile
Rookie

Joined: Tue Jan 13, 2015 10:48 pm
Posts: 23
Post Re: PmgCnt: 0008E2 Type: 2
Just taking a quick look at your code, I see a few errors:

At the beginning of your code, you forgot
Code:
#include "JoystickDriver.c"


When you are trying to access which buttons are pressed, you are doing so incorrectly.
Code:
joystick.joy1_Buttons

returns a bitmap of which buttons are being pressed.

An easier method that does the bit mapping for you are the functions
Code:
joy1Btn(BUTTON) == (1 if pressed, 0 if not)

and
Code:
joy2Btn(BUTTON) == (1 if pressed, 0 if not)


P.S. Love your joke Xander xD


Mon Feb 02, 2015 4:51 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: PmgCnt: 0008E2 Type: 2
The reason you are getting the runtime error of PmgCnt: 008E2 Type: 2 is because you do not have the HiTechnic Controller configured correctly in the Motors and Sensors Setup window: this is most likely caused by the #pragmas being copied from another program incorrectly. The correct #pragmas should look like this:

Code:
#pragma config(Hubs,  S1, HTMotor,  HTServo,  none,     none)
#pragma config(Sensor, S1, , sensorI2CMuxController)
#pragma config(Motor, motorA, motorB, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, motorB, motorC, tmotorNXT, PIDControl, encoder)
#pragma config(Motor, mtr_S1_C1_1, motorD, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C1_2, motorE, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S1_C2_1, servo1, tServoStandard)
#pragma config(Servo, srvo_S1_C2_2, servo2, tServoStandard)
#pragma config(Servo, srvo_S1_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S1_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S1_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S1_C2_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//


Note the '#pragma config(Hubs, S1, HTMotor, HTServo, none, none)' line at the very top (this is missing from your code currently, and is what is causing the run-time error.

While debugging your code, I also cleaned it up and changed its behavior a bit. I'm assuming you want the servos to go to a specific position when a button is pressed, and return to a position once that button is released? To do this (control the same two servos with multiple buttons), you will need to put all of the different states of the servos into one if/else if/else block of code:

Code:
task main()
{
   while(1 == 1)
   {
      getJoystickSettings(joystick);
      motor[motorB] = joystick.joy1_y1;
      motor[motorC] = joystick.joy1_y2;

      if (joy1Btn(0) == 1)//Bucket Twist
      {
         servoTarget[servo1] = 12;
      }

      else if(joy1Btn(1) == 1)//Bucket Level, Angle 1
      {
         servoTarget[servo2] = 28;
         servoTarget[servo2] = 209;
      }

      else if(joy1Btn(2) == 1)//Bucket Level, Angle 2
      {
         servoTarget[servo1] = 61;
         servoTarget[servo2] = 176;
      }

      else if(joy1Btn(3) == 1)//Bucket Level, Angle 3
      {
         servoTarget[servo1] = 143;
         servoTarget[servo2] = 176;
      }
      else //If no button is pressed, return to this position
      {
         servoTarget[servo1] = 105;
         servoTarget[servo2] = 137;
      }
   }
}


Edit: I always recommend using the Motors and Sensors Setup window to configure your robot manually, as this will ensure that all of the #pragma statements are included and set up properly.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.


Tue Feb 03, 2015 1:21 pm
Profile
Rookie

Joined: Wed Jan 28, 2015 2:06 pm
Posts: 6
Post Re: PmgCnt: 0008E2 Type: 2
Thank You All This was very helpful No joke it was the program runs fine except the robot wont move when the Program is running


Tue Feb 03, 2015 4:12 pm
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: PmgCnt: 0008E2 Type: 2
You are controlling motor ports B and C with your joysticks; this refers to motor ports B and C on the NXT, not the motors ports on the HiTechnic controller. Those motors start at 'motorD' and 'motorE' and continue on from there (motorF, motorG, motorH, etc) as more Motor Controllers are added.

Try changing the motor ports from B and C to D and E, respectively, to see if this resolves the issue.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.


Tue Feb 03, 2015 5:03 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 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.