Hey you all,:tiphat:
I am new to the orbiter-forum and programming own parts and started a few days ago. I already checked the forum for solutions. But I didn't get to solve the problem. So now I'm here and hope you can help me.
At the moment I want to create a ReentrySystem which can call values of the vessel in view.
For this I created a class ReentrySystem with its own methods.
First things first: When I compile and build the code, it shows no errors.
Now when I call the function in Orbiter, which activates the ReentrySystem it calls correctly the method defined in the ReentrySystem class, but as soon as it needs to call a value of the vessel like this:
class->GetAltitude();
Orbiter crashes. I dont really understand why. I guess that the reference to the class is NULL.
Sometimes it showed me in the DebugString the initialised parameter value 0.000, but on further execution of my test scenario, without making any changes, it crashed again :facepalm:
The function "ReentrySystem::clbkRESPreStep()" gets called in the vessel .cpp file while executing the
clbkPreStep (double SimT, double SimDT, double mjd) function.
Maybe at this point it is easier to ask how to get the handle of the vessel stored in another class so that I can get the parameteres of the vessel in view. Or if i can call the handle to the vessel in view directly?
Or is this not possible because I will get an access error, because to parts of the programm want to use the handle of the vessel?
Down below is my current try of the ReentrySystem. But i guess with this call I don't get the handle of the vessel in view.
I'm sorry if this is confusing. Please feel free to ask for anything I may have forgotten to add.
Thanks in advance for your answers :tiphat:
EDIT:
So as i found out. If i close the orbiter simulator by force (killing the task). I always get the value 0.00000
If I don't do that and go into debug mode. It is shown to me that I get this message:
Unhandled exception at 0x6C55C6C0 in orbiter.exe: 0xC0000005: Access violation reading location 0x00730081
So it seems like I'm getting the (un)expected NULL pointer
I am new to the orbiter-forum and programming own parts and started a few days ago. I already checked the forum for solutions. But I didn't get to solve the problem. So now I'm here and hope you can help me.
At the moment I want to create a ReentrySystem which can call values of the vessel in view.
For this I created a class ReentrySystem with its own methods.
First things first: When I compile and build the code, it shows no errors.
Now when I call the function in Orbiter, which activates the ReentrySystem it calls correctly the method defined in the ReentrySystem class, but as soon as it needs to call a value of the vessel like this:
class->GetAltitude();
Orbiter crashes. I dont really understand why. I guess that the reference to the class is NULL.
Sometimes it showed me in the DebugString the initialised parameter value 0.000, but on further execution of my test scenario, without making any changes, it crashed again :facepalm:
The function "ReentrySystem::clbkRESPreStep()" gets called in the vessel .cpp file while executing the
clbkPreStep (double SimT, double SimDT, double mjd) function.
Maybe at this point it is easier to ask how to get the handle of the vessel stored in another class so that I can get the parameteres of the vessel in view. Or if i can call the handle to the vessel in view directly?
Or is this not possible because I will get an access error, because to parts of the programm want to use the handle of the vessel?
Down below is my current try of the ReentrySystem. But i guess with this call I don't get the handle of the vessel in view.
Code:
// Header file of Reentry System
#pragma once
#include "Orbitersdk.h"
class ReentrySystem {
public:
ReentrySystem(VESSEL3* pVes);
~ReentrySystem();
virtual void clbkRESPreStep(); // Called after every time step to get actual parameter data
void GetCMAltitude();
//inline const VESSEL3* GetVessel() const { return vessel; }
private:
// Global variables:
// Vessel Parameters
// Reference
VESSEL3* pMe;
double myAlt;
};
Code:
// .cpp file of Reentry System
#include "ReentrySystem.h"
// Constructor of ReentrySystem
ReentrySystem::ReentrySystem(VESSEL3* pVes)
{
// Assign reference objects to local member variables
pMe = pVes;
// Initialise value
myAlt = 0;
}
// Destructor ReentrySystem
ReentrySystem::~ReentrySystem() {
}
void ReentrySystem::clbkRESPreStep()
{
myAlt = pMe->GetAltitude(); // Not working
sprintf(oapiDebugString(), "Momentane Höhe über Grund %f", myAlt);
}
I'm sorry if this is confusing. Please feel free to ask for anything I may have forgotten to add.
Thanks in advance for your answers :tiphat:
EDIT:
So as i found out. If i close the orbiter simulator by force (killing the task). I always get the value 0.00000
If I don't do that and go into debug mode. It is shown to me that I get this message:
Unhandled exception at 0x6C55C6C0 in orbiter.exe: 0xC0000005: Access violation reading location 0x00730081
So it seems like I'm getting the (un)expected NULL pointer
Last edited: