I am writing a method that lives outside of main and interacts with a public static member. I initialized the member inside main() and proceed to try and use it inside my method, and the pointer is null:
public class Program
{
…
public static EulerPID PitchAxis;
public static EulerPID RollAxis;
…
public static void FixedUpdateRoutine(object state)
{
…
if (…)
{
if (…)
{
…
///Apparently PitchAxis and RollAxis are NULL?
double[] output = new double[] { PitchAxis.UpdatePID(FloatQs[1]), RollAxis.UpdatePID(FloatQs[2]) };
…
}
}
}
public static void Main()
{
…
// initialize PID controllers
EulerPID PitchAxis = new EulerPID(0.0001, 0.001, 0.001);
EulerPID RollAxis = new EulerPID(0.0001, 0.001, 0.001);
…
}
help? Thanks in advance!