ROBOTC.net forums
http://robotc.net/forums/

PmgCnt: 0008E2 Type: 2
http://robotc.net/forums/viewtopic.php?f=1&t=10429
Page 1 of 1

Author:  MotorA [ Sat Jan 31, 2015 1:46 pm ]
Post subject:  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;
}
}
}

Author:  mightor [ Sun Feb 01, 2015 2:51 am ]
Post subject:  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

Author:  MotorA [ Mon Feb 02, 2015 2:37 pm ]
Post subject:  Re: PmgCnt: 0008E2 Type: 2

Version 4.0
NXT brick

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

Author:  MotorA [ Mon Feb 02, 2015 4:06 pm ]
Post subject:  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

Author:  FTC_359 [ Mon Feb 02, 2015 4:51 pm ]
Post subject:  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

Author:  JohnWatson [ Tue Feb 03, 2015 1:21 pm ]
Post subject:  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.

Author:  MotorA [ Tue Feb 03, 2015 4:12 pm ]
Post subject:  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

Author:  JohnWatson [ Tue Feb 03, 2015 5:03 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/