Problem UCGO - Arrow - Attitude MFD

PaulG

New member
Joined
Sep 12, 2008
Messages
159
Reaction score
0
Points
0
Hi.

I noticed that Attitude MFD doesn't control pitch (Velocity mode) of the Arrow spacecraft. It does control Yaw and Bank though.

Any ideas?
 

PaulG

New member
Joined
Sep 12, 2008
Messages
159
Reaction score
0
Points
0
New information:

It doesn't appear that Attitude MFD controls bank in ANY mode with the Arrow.

Has anyone else experienced this?
 

Rawash

New member
Joined
Mar 3, 2010
Messages
15
Reaction score
0
Points
0
Attitude MFD & UCGOArrowFreighter ship class

Hello,

I was modifying some routine in AttitudeMFD (thx to tblaxland for including SDK files in release...).

To correct this problem you can pass the "RotLevel" calculated in "AttCtrl.cpp" and add the API function "SetAttitudeRotLevel" for every axis in the end of "Control()" function in "AttitudeMFD.cpp".
This should work.

Example:

(changes in blue)

AttitudeMFD.cpp

////////////////////////////////////////////////////////////////////////////////////

...

void inline AttitudeMFD::Control()
{
int VesselDockedCount; //The number of vessels docked to us
OBJHANDLE DockedObj;
VESSEL *DockedVessel;

...

...

double iP = 0, iY = 0, iR = 0;

if (AttHoldMode==ENGAGED)
{
// Use different function calls to SetAttitude for the rotating reference vector cases than the static reference vector cases
if ( (fabs(PitchYawRoll.data[YAW]) + fabs(PitchYawRoll.data[PITCH])) > DEADBAND_MAX ) {

iP = SetAttitude(0, PitchYawRoll.data[PITCH], PITCH, DB_COARSE, RATE_NULL_HIGH, LastTimeElapsed);
iY = SetAttitude(0, PitchYawRoll.data[YAW], YAW, DB_COARSE, RATE_NULL_HIGH, LastTimeElapsed);
iR = SetAttitude(0, 0, ROLL, DB_COARSE, RATE_NULL_HIGH, TimeElapsed);

}
else {
...

...
TOR_Rate = 2*PI/TOR_op.T;

iP = SetAttitude(0, 0, Status.vrot.data[PITCH] - TOR_Rate, PITCH, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
iY = SetAttitude(0, 0, YAW, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
iR = SetAttitude(0, 0, ROLL, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
}

if(strncmp(Vessel->GetClassNameA(), "UCGO\\Vessels\\UCGOArrowFreighter", 31) == 0){
Spacecraft->SetAttitudeRotLevel(PITCH, iP); //force pitch rotation for UCGOArrowFreigther
Spacecraft->SetAttitudeRotLevel(YAW, iY); //force yaw rotation for UCGOArrowFreigther
Spacecraft->SetAttitudeRotLevel(ROLL, iR); //force roll rotation for UCGOArrowFreigther
}


if (TrimStatus == T_ENGAGED) {
Trim();
}
}

...

//////////////////////////////////////////////////////////////////////////////////


But if you want to use AttitudeMFD with ArrowFreighter, you should want to decrease "RATE_MAX" constant value to avoid excessive use of fuel :

AttCtrl.cpp

//////////////////////////////////////////////////////////////////////////////////

...

double
SetAttitude(double TargetAttitude, double CurrentAttitude, double RotRate,
AXIS Axis, DEADBAND DeadbandLow, double RateNull, double DT)
{
double Rate; // Depends on magnitude of DeltaAngle
...

...

double DeltaRate; // The difference between the desired and the actual rate
double DeltaAngle = TargetAttitude - CurrentAttitude;

double Rate_Max;

if(strncmp(Vessel->GetClassNameA(), "UCGO\\Vessels\\UCGOArrowFreighter", 31) == 0){
Rate_Max = Radians(1.5);
}else {Rate_Max = Radians(5.0);}


// Get State
Mass = Vessel->GetMass();

...

...

if (fabs(DeltaAngle) > DEADBAND_MAX) {
Rate = Rate_Max;
//sprintf(oapiDebugString(), "HIGH");
} else {
// Rate = RATE_HIGH*(pow(RATE_SLOPE,fabs(DeltaAngle))-1)/(pow(RATE_SLOPE,DEADBAND_MAX-1));
Rate = Rate_Max*fabs(DeltaAngle)/DEADBAND_MAX;
//sprintf(oapiDebugString(), "MAX");
}
// CCK End

...

////////////////////////////////////////////////////////////////////////////////////

Bye.
 

Rawash

New member
Joined
Mar 3, 2010
Messages
15
Reaction score
0
Points
0
Attitude MFD & UCGOArrowFreighter ship class

I made a mistake. In fact the Arrow allows only 2-axis rotation.
So the code should be :

(red replace gray)

...
TOR_Rate = 2*PI/TOR_op.T;

iP = SetAttitude(0, 0, Status.vrot.data[PITCH] - TOR_Rate, PITCH, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
iY = SetAttitude(0, 0, YAW, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
iR = SetAttitude(0, 0, ROLL, DB_MIN, RATE_NULL_LOW, UPDATE_INTERVAL);
}

if(strncmp(Vessel->GetClassNameA(), "UCGO\\Vessels\\UCGOArrowFreighter", 31) == 0){
Spacecraft->SetAttitudeRotLevel(PITCH, iP); //force pitch rotation for UCGOArrowFreigther
Spacecraft->SetAttitudeRotLevel(YAW, iY); //force yaw rotation for UCGOArrowFreigther
Spacecraft->SetAttitudeRotLevel(ROLL, iR); //force roll rotation for UCGOArrowFreigther
}


if(AttHoldMode != DISENGAGED && strncmp(Vessel->GetClassNameA(), "UCGO\\Vessels\\UCGOArrowFreighter", 31) == 0)
{
Spacecraft->SetAttitudeRotLevel(PITCH, iP);
Spacecraft->SetAttitudeRotLevel(YAW, iY);
if(iR > 0) Spacecraft->SetThrusterGroupLevel(THGROUP_ATT_BANKRIGHT, iR);
if(iR < 0) Spacecraft->SetThrusterGroupLevel(THGROUP_ATT_BANKLEFT, -iR);
}


if (TrimStatus == T_ENGAGED) {
Trim();
}
}

...

//////////////////////////////////////////////////////////////////////////////////


The rest of the code is right.


Great MFD fot Great Addon.

Thx to Dan & tblaxland and all others developers.
And of course thx to Dr M.Schweiger.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,320
Reaction score
25
Points
113
Location
Sydney, Australia
Thanks Rawash. I'm curious, when Attitude MFD (unmodified) is "not controlling pitch" do the thruster guages at the bottom of the MFD show any firing?
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,697
Reaction score
1,357
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
The Arrow utilizes attitude damping, that may have something to do with your problem.
 
Top