View unanswered posts | View active topics It is currently Tue Sep 23, 2014 4:20 am






Reply to topic  [ 3 posts ] 
Mindstorm brick error: Pgmcnt: 00009c Type: 2 
Author Message
Rookie

Joined: Fri Oct 11, 2013 4:05 pm
Posts: 7
Post Mindstorm brick error: Pgmcnt: 00009c Type: 2
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S2, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S3, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S4, HTMotor, HTServo, none, none)
#pragma config(Motor, mtr_S1_C1_1, motorA, tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor, mtr_S1_C1_2, motorB, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motorE, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S1_C2_2, motorO, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_1, motorC, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S2_C1_2, motorD, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S2_C2_1, motorJ, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C2_2, drillMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C1_1, motorL, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C1_2, motorM, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C2_1, linearMotor1, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C2_2, linearMotor2, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S4_C1_1, motorP, tmotorTetrix, openLoop)//pulley motor
#pragma config(Motor, mtr_S4_C1_2, motorQ, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S4_C2_1, servo1, tServoContinuousRotation)
#pragma config(Servo, srvo_S4_C2_2, servo2, tServoContinuousRotation)
#pragma config(Servo, srvo_S4_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S4_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S4_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S4_C2_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tele-Operation Mode Code Template
//
// This file contains a template for simplified creation of an tele-op program for an FTC
// competition.
//
// You need to customize two functions with code unique to your specific robot.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.


/////////////////////////////////////////////////////////////////////////////////////////////////////
//
// initializeRobot
//
// Prior to the start of tele-op mode, you may want to perform some initialization on your robot
// and the variables within your program.
//
// In most cases, you may not have to add any code to this function and it will remain "empty".
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

void initializeRobot()
{
// Place code here to sinitialize servos to starting positions.
// Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.

return;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////
//s
// Main Task
//
// The following is the main code for the tele-op robot operation. Customize as appropriate for
// your specific robot.
//
// Game controller / joystick information is sent periodically (about every 50 milliseconds) from
// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following
// logic:
// 1. Loop forever repeating the following actions:
// 2. Get the latest game controller / joystick settings that have been received from the PC.
// 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a
// simple action:
// * Joystick values are usually directly translated into power levels for a motor or
// position of a servo.
// * Buttons are usually used to start/stop a motor or cause a servo to move to a specific
// position.
// 4. Repeat the loop.
//
// Your program needs to continuously loop because you need to continuously respond to changes in
// the game controller settings.
//
// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

task main()
{
initializeRobot();

// wait for start of tele-op phase

while (true)
{
getJoystickSettings(joystick);
motor[motorA]=joystick.joy1_y2 * 100 / 127;//motor a moves with the second y toggle stick (leftside)
motor[motorB]=joystick.joy1_y2 * 100 / 127;//motor b moves with the second y toggle stick as well(robot will go left or right)(lefttside)




getJoystickSettings(joystick);
motor[motorC]=joystick.joy1_y1 * 100/ 127; //motor c moves with the first y toggle stick(robot will go left or right)(rightside)
motor[motorD]=joystick.joy1_y1 * 100 / 127;// motor D moves with the first y toggle stick if both sticks are moved at the same time they'll go in a uniform direction (rightside)
}//this is the function for driving


while (true)
{ getJoystickSettings(joystick);
if(joy1Btn(4)==1)//button four controls the drill
{
motor[drillMotor]=100;//THIS IS THE CODE FOR THE DriLl
}
else
{motor[drillMotor]=0;//drill remains off

}
//this is the code for the dual fingers (servos will go 67 counts)
{
getJoystickSettings(joystick);//button 1 to close
if(joy2Btn(1)==1)
{

servo[servo1]=127;


}

if(joy2Btn(2)==1)
{
servo[servo1]=-127;
}


{
getJoystickSettings(joystick);
motor[linearMotor1]=joystick.joy2_y1 * 100/127; //These 2 motors are for the linear slides to go up and down.
motor[linearMotor2]=joystick.joy2_y1 * 100/127;
}
Here is our code D: (it worked fine just yesterday and now this error comes up and we can't even access the brick




{
getJoystickSettings(joystick); //this motor is will be driving the pulley system.
motor[motorJ]=joystick.joy2_y2 * 80/127;
}
}
}
}

// Insert code to have servos and motors respond to joystick and button values.

// Look in the ROBOTC samples folder for programs that may be similar to what you want to perform.
// You may be able to find "snippets" of code that are similar to the functions that you want to

// perform


Thu Oct 24, 2013 4:52 pm
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: Mindstorm brick error: Pgmcnt: 00009c Type: 2
You need to use the code tags when posting code so it maintains the indentation. Without proper indentation, it is very difficult to spot problems. I have rearranged your code below. There are many problems in your code. First, you have multiple infinite loops. By definition, you never come out of an infinite loop, so any other infinite loops following the first one won't get executed at all. Secondly, you only need to call getJoystickSettings once in your infinite loop. You don't gain anything new calling it so often. Thirdly, for the dual finger servo, in your original code, what happen if you pressed button 1 and button 2 at the same time? The code below will fix that. Finally, I added a wait1Msec at the end of the infinite loop. Again, there is no reason to run a loop so tight. With 50 msec wait, your loop will run approx. 20 times a second. That's plenty for teleop.
Code:
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S2, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S3, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S4, HTMotor, HTServo, none, none)
#pragma config(Motor, mtr_S1_C1_1, motorA, tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor, mtr_S1_C1_2, motorB, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C2_1, motorE, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S1_C2_2, motorO, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C1_1, motorC, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S2_C1_2, motorD, tmotorTetrix, openLoop, encoder)
#pragma config(Motor, mtr_S2_C2_1, motorJ, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S2_C2_2, drillMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C1_1, motorL, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C1_2, motorM, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C2_1, linearMotor1, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S3_C2_2, linearMotor2, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S4_C1_1, motorP, tmotorTetrix, openLoop)//pulley motor
#pragma config(Motor, mtr_S4_C1_2, motorQ, tmotorTetrix, openLoop)
#pragma config(Servo, srvo_S4_C2_1, servo1, tServoContinuousRotation)
#pragma config(Servo, srvo_S4_C2_2, servo2, tServoContinuousRotation)
#pragma config(Servo, srvo_S4_C2_3, servo3, tServoNone)
#pragma config(Servo, srvo_S4_C2_4, servo4, tServoNone)
#pragma config(Servo, srvo_S4_C2_5, servo5, tServoNone)
#pragma config(Servo, srvo_S4_C2_6, servo6, tServoNone)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

/////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Tele-Operation Mode Code Template
//
// This file contains a template for simplified creation of an tele-op program for an FTC
// competition.
//
// You need to customize two functions with code unique to your specific robot.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

#include "JoystickDriver.c" //Include file to "handle" the Bluetooth messages.


/////////////////////////////////////////////////////////////////////////////////////////////////////
//
// initializeRobot
//
// Prior to the start of tele-op mode, you may want to perform some initialization on your robot
// and the variables within your program.
//
// In most cases, you may not have to add any code to this function and it will remain "empty".
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

void initializeRobot()
{
    // Place code here to sinitialize servos to starting positions.
    // Sensors are automatically configured and setup by ROBOTC. They may need a brief time to stabilize.

    return;
}


/////////////////////////////////////////////////////////////////////////////////////////////////////
//s
// Main Task
//
// The following is the main code for the tele-op robot operation. Customize as appropriate for
// your specific robot.
//
// Game controller / joystick information is sent periodically (about every 50 milliseconds) from
// the FMS (Field Management System) to the robot. Most tele-op programs will follow the following
// logic:
// 1. Loop forever repeating the following actions:
// 2. Get the latest game controller / joystick settings that have been received from the PC.
// 3. Perform appropriate actions based on the joystick + buttons settings. This is usually a
// simple action:
// * Joystick values are usually directly translated into power levels for a motor or
// position of a servo.
// * Buttons are usually used to start/stop a motor or cause a servo to move to a specific
// position.
// 4. Repeat the loop.
//
// Your program needs to continuously loop because you need to continuously respond to changes in
// the game controller settings.
//
// At the end of the tele-op period, the FMS will autonmatically abort (stop) execution of the program.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////

task main()
{
    initializeRobot();

    // wait for start of tele-op phase
    while (true)
    {
        getJoystickSettings(joystick);
        //
        //this is the function for driving
        //
        motor[motorA]=joystick.joy1_y2 * 100 / 127;//motor a moves with the second y toggle stick (leftside)
        motor[motorB]=joystick.joy1_y2 * 100 / 127;//motor b moves with the second y toggle stick as well(robot will go left or right)(lefttside)
        motor[motorC]=joystick.joy1_y1 * 100/ 127; //motor c moves with the first y toggle stick(robot will go left or right)(rightside)
        motor[motorD]=joystick.joy1_y1 * 100 / 127;// motor D moves with the first y toggle stick if both sticks are moved at the same time they'll go in a uniform direction (rightside)
        //
        //this is the function for the linear slides
        //
        motor[linearMotor1]=joystick.joy2_y1 * 100/127; //These 2 motors are for the linear slides to go up and down.
        motor[linearMotor2]=joystick.joy2_y1 * 100/127;
        //
        //this motor is will be driving the pulley system.
        //
        motor[motorJ]=joystick.joy2_y2 * 80/127;
        //
        //THIS IS THE CODE FOR THE DriLl
        //button four controls the drill
        //
        if(joy1Btn(4)==1)//
        {
            motor[drillMotor]=100;
        }
        else
        {
            motor[drillMotor]=0;//drill remains off
        }
        //
        //this is the code for the dual fingers (servos will go 67 counts)
        //
        if(joy2Btn(1)==1)
        {
            servo[servo1]=127;
        }
        else if(joy2Btn(2)==1)
        {
            servo[servo1]=-127;
        }

        wait1Msec(50);
    }
}


Thu Oct 24, 2013 6:08 pm
Profile
Rookie

Joined: Fri Oct 11, 2013 4:05 pm
Posts: 7
Post Re: Mindstorm brick error: Pgmcnt: 00009c Type: 2
thanks alot! (sorry for my noobiness D:)


Thu Oct 24, 2013 6:22 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.