View unanswered posts | View active topics It is currently Sun Nov 23, 2014 9:17 pm






Reply to topic  [ 10 posts ] 
Strange Robot C error messages 
Author Message
Rookie

Joined: Fri Feb 16, 2007 4:11 pm
Posts: 41
Location: Padanaram, MA
Post Strange Robot C error messages
My Robot C program compiles OK except that I get the following error messages:

**Error**:Removing an active primary temporary. Pass/Seq: Assign Addresses:21
**Error**:Removing an active primary temporary. Pass/Seq: Emit Code:21

Does anyone know what the nature of the problem is?

Thank you.
:shock:


Thu Nov 13, 2008 3:42 pm
Profile WWW
Rookie

Joined: Wed Jun 25, 2008 6:07 pm
Posts: 46
Post Re: Strange Robot C error messages
Hmm... I'm not familiar with that one off the top of my head. Could you post the code that's causing the problem so we can take a look and see what's wrong?


Thu Nov 13, 2008 4:18 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:44 am
Posts: 440
Location: Pittsburgh, PA
Post Re: Strange Robot C error messages
What version of ROBOTC are you using and can you copy and paste your code? use the [ code ] tags also.

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Email ROBOTC Support at support@robotc.net to put in a support ticket

Robotc.net| Robomatter Store | Robotics Academy | CS2N


Thu Nov 13, 2008 4:19 pm
Profile
Rookie

Joined: Fri Feb 16, 2007 4:11 pm
Posts: 41
Location: Padanaram, MA
Post Re: Strange Robot C error messages
I am using Ver. 1.40


Thu Nov 13, 2008 5:31 pm
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post Re: Strange Robot C error messages
Can you post your code so we can take a look at it? That would be the best way to solve the problem.

Scott B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Thu Nov 13, 2008 7:35 pm
Profile WWW
Rookie

Joined: Fri Feb 16, 2007 4:11 pm
Posts: 41
Location: Padanaram, MA
Post Re: Strange Robot C error messages
Here is the code. It compiles with no errors or comments except for the ones I gave above. This code has never been run, so it is probably full of bugs in the logic, etc.

#pragma config(Sensor, S1, TouchSensor, sensorTouch)
#pragma config(Sensor, S2, LightSensor, sensorLightActive)
#pragma config(Motor, motorA, A_Motor, tmotorNormal, PIDControl, )
#pragma config(Motor, motorC, C_Motor, tmotorNormal, PIDControl, )
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

// Prototypes
void logData();

#pragma platform(NXT)

// Variables and parameters in Main
bool run;
bool wait;
bool saveData = true;

int dataVar1; // Used for Datalog
int dataVar2; // Used for Datalog
int dataVar3; // Used for Datalog
int elapsedTime;
int cntr;
int lightValueReference;
int encoderReference;
int motorSetting = 75; // Set for 750 encoder counts (degrees) per second
int kDatalogSize = 1000;
int deltaT = 100; // Time interval between light measurements, ms
int netDeltaT; // Net interval to wait between light measurements, ms
int wheelRotation; // Amount to rotate wheels to correct for pendulum angle

float floatT; // Ditto above but float version
float alfa = 1.2; // Base movement factor
float beta = 0.1; // Base damping factor
float theta; // Present pendulum tilt angle, radians
float thetaA = 0.20; // Extreme pendulum angle, leaning backwards
float thetaB = 0.20; // Extreme pendulum angle, leaning forwards
float lightValueA; // Light value at angle thetaA;
float lightValueB; // Light value at angle thetaB;
float lightValue; // Light value against forestop, raw
float theta_light_ratio; // (thetaB - thetaA)/(lightValueB - lightValueA)
float baseX1; // Previous location of base
float baseX2; // Present location of base
float massX1; // Previous location of pendulum mass
float massX2; // Prsent location of pendulum mass
float L = 0.4375; // Pendulum length, feet
float D = 0.265625; // Wheel diameter, feet
float wheelPerimeter = PI * D; // Wheel perimeter, feet
float wheelRotationRate = 750; // Wheel rotation rate is approximately 750 deg/sec

//########################################################################
task main()
{
nDatalogSize = kDatalogSize;
bFloatDuringInactiveMotorPWM = false;
nMotorEncoder[motorA] = 0; // Reference point
nSyncedMotors = synchAC; // Synchronize A & C
nSyncedTurnRatio = 100; // Turn equally
nMotorPIDSpeedCtrl[motorA] = mtrSpeedReg; // Enable motor-speed regulation
nMotorPIDSpeedCtrl[motorC] = mtrSpeedReg; // Enable motor-speed regulation
motor[motorA] = 0; // Motors off

//########################################################################
// Wait till button is pressed and get reference reading
wait = true; // Don't run until button is pressed
cntr = 1;
deltaT = 100;
floatT = deltaT; // Get float value of time interval (Do it just once)
baseX2 = 0;
nMotorEncoder[motorA] = 0; // Initialize motor encoder value
lightValueReference = SensorRaw(LightSensor); // Get light value to show
while(wait == true) //loop here until button is pressed
{
eraseDisplay();
nxtDisplayTextLine(3, "Counter is %d", cntr);
nxtDisplayTextLine(3, "Light value is %d", lightValueReference);
PlaySound(soundBlip); // Signal that button press is needed
wait1Msec(1000);

if (SensorValue(TouchSensor) == 1) // If button is pressed
{
wait1Msec(2000); // Wait for button-push vibrations to stop
if (cntr == 1)
{
lightValueA = SensorRaw(LightSensor); // Get pendulum lying back rearing
cntr = 2;
}
if (cntr == 2)
{
lightValueB = SensorRaw(LightSensor); // Get pendulum lying forward reading
cntr = 3;
}
if (cntr == 3)
{
lightValueReference = SensorRaw(LightSensor); // Get reference light reading
cntr = 4;
wait = false; // We have completed the calibration
}
}
} // Exit this loop after calibration is completed


// Wait for button press to begine balancing act
run = false;
while(run == false) //loop here until button is pressed
{
PlaySound(soundLowBuzz);
wait1Msec(500);
if (SensorValue(TouchSensor) == 1)
{
PlaySound(soundBeepBeep);
wait1Msec(2000);
run = true; // Exit this while loop & start balancing act
dataVar1 = time10[T1];
lightValue = SensorRaw(LightSensor); // Get initial light reading
nMotorEncoder[motorA] = 0; // Set initial value of motor position
elapsedTime = 0;
}
} // Exit above loop and start balancing pendulum
theta_light_ratio = (thetaB - thetaA)/(lightValueB - lightValueA);
netDeltaT = deltaT;
baseX2 = 0;
lightValue = SensorRaw(LightSensor); // Make current light reading
theta = thetaB + theta_light_ratio*(lightValue - lightValueA); // Current pendulum angle;
massX2 = baseX2 + L * theta; // Current mass position
///////////////////////////////////////////////////////////////////////////
// Now that reference value has been obtained, start balancing act
while (run) // Run until NXT is turned off
{
wait1Msec(netDeltaT); // Move base every intT ms
elapsedTime = elapsedTime + 1;
// Determine how far and which way to move
massX1 = massX2; // Save previous mass position
baseX1 = baseX2; // Save previous base position
lightValue = SensorRaw(LightSensor); // Make current light reading
theta = thetaB + theta_light_ratio*(lightValue - lightValueA); // Current pendulum angle;
massX2 = baseX1 + L * theta; // Current mass position
encoderReference = nMotorEncoder[motorA]; // Current value of motor encoder
nMotorEncoderTarget[motorA] = encoderReference + (baseX2 - baseX1)/wheelPerimeter;
massX2 = baseX1 + L * (lightValue - lightValueReference) * theta_light_ratio;
baseX2 = alfa * massX2 + beta * (massX2 - massX1)/floatT; // alfa*x + beta*xDot
wheelRotation = (baseX2 - baseX1) * 360 / wheelPerimeter;
nMotorEncoderTarget[motorA] = nMotorEncoder[motorA] + wheelRotation;
motor[motorA] = motorSetting * sgn(wheelRotation);

// while(nMotorEncoder[motorA] != nMotorEncoderTarget[motorA]) // Wait for motor to finish
while(nMotorRunState[motorA] != runStateIdle) // Wait for motor to finish
{
}

netDeltaT = deltaT - 1000 *abs(wheelRotation)/wheelRotationRate;

if (saveData)
{
logData();
}

if (SensorValue(TouchSensor) == 1)
{
run = false; // Stop program & save data if buttom pressed
SaveNxtDatalog();
}
} // End of the while(run)
} // End of the main()

//
//******************************************************************************
//

void logData()
{
dataVar1 = elapsedTime;
dataVar2 = theta;
dataVar3 = nMotorEncoder[motorA];
AddToDatalog(dataVar1);
AddToDatalog(dataVar2);
AddToDatalog(dataVar3);
}


// Some interesting code from RobotC Forum:
//task main()
//{
//
// nMotorEncoder[motorC] = 0;
// nMotorEncoder[motorB] = 0;
//
// while(abs(nMotorEncoder[leftMotor]) < 1000)
// {
// motor[motorB] = -100;
// motor[motorC] = -100;
// }
//
// motor[motorC] = 0;
// motor[motorB] = 0;
//
//}

That's the code. Thank you again for your interest.


Fri Nov 14, 2008 9:55 am
Profile WWW
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post Re: Strange Robot C error messages
Hmm, I got no errors when I compiled and ran your program in v1.45. You may want to try installing the newest version of RoboC. You may be running into a fixed bug :-)

RobotC 1.45

Hope this helps B-)
Scott

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Fri Nov 14, 2008 2:00 pm
Profile WWW
Rookie

Joined: Fri Feb 16, 2007 4:11 pm
Posts: 41
Location: Padanaram, MA
Post Re: Strange Robot C error messages
Hi Scott,

I downloaded Ver 1.46 and my program compiled OK! I had very recently downloaded Ver 1.40 from robotc.net, but Ver 1.46 seems to work OK? I was not asked for my license ID and my password. I hope what I have is not just trial version.

I am very grateful for your help. Thank you.

Best regards,

Ted


Fri Nov 14, 2008 3:39 pm
Profile WWW
Rookie

Joined: Fri Feb 16, 2007 4:11 pm
Posts: 41
Location: Padanaram, MA
Post Re: Strange Robot C error messages
I see that Ver. 1.46 has a 365-day trial period.

Ted


Fri Nov 14, 2008 5:50 pm
Profile WWW
Professor

Joined: Fri Sep 19, 2008 1:22 am
Posts: 200
Post Re: Strange Robot C error messages
tedkurtz wrote:
I was not asked for my license ID and my password. I hope what I have is not just trial version.


No. You have the real deal. The only difference is the activation code which you had already entered for the previous build. It remembers that you are registered.

_________________
Jeff McBride
Benson Robotics Club


Fri Nov 14, 2008 7:28 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 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.