flightData.getThrottleOutput().addSignalListener(flightDataDisplay.createTextLine("Throttle"));
flightData.getVerticalSpeed().addSignalListener(flightDataDisplay.createTextLine("Vert. speed [m/s]"));
flightData.getYawAngularRate().addSignalListener(flightDataDisplay.createTextLine("Yaw rate [deg/sec]"));
// Setup the sliders for the pitch PID gains
pitchGainP = new Slider(this, "Pitch Gain-P", 40, 170);
pitchGainP.setBandwidthY(0, 4);
pitchGainP.setValue(PITCH_P);
pitchGainI = new Slider(this, "Pitch Gain-I", 80, 170);
pitchGainI.setBandwidthY(0, 2);
pitchGainI.setValue(PITCH_I);
pitchGainD = new Slider(this, "Pitch Gain-D", 120, 170);
pitchGainD.setBandwidthY(0, 2);
pitchGainD.setValue(PITCH_D);
pitchMaxI = new Slider(this, "Pitch Max-I", 160, 170);
pitchMaxI.setBandwidthY(0, 2);
pitchMaxI.setValue(PITCH_M);
pitchMinI = new Slider(this, "Pitch Min-I", 200, 170);
pitchMinI.setBandwidthY(0, -2);
pitchMinI.setValue(-PITCH_M);
// Pitch PID to motion controller dependencies
pitchMaxI.addSignalListener(motionController.getPitchMaxI());
pitchMinI.addSignalListener(motionController.getPitchMinI());
pitchGainP.addSignalListener(motionController.getPitchGainP());
pitchGainI.addSignalListener(motionController.getPitchGainI());
pitchGainD.addSignalListener(motionController.getPitchGainD());
// Setup the sliders for the roll PID gains
rollGainP = new Slider(this, "Roll Gain-P", 40, 300);
rollGainP.setBandwidthY(0, 4);
rollGainP.setValue(ROLL_P);
rollGainI = new Slider(this, "Roll Gain-I", 80, 300);
rollGainI.setBandwidthY(0, 2);
rollGainI.setValue(ROLL_I);
rollGainD = new Slider(this, "Roll Gain-D", 120, 300);
rollGainD.setBandwidthY(0, 2);
rollGainD.setValue(ROLL_D);
rollMaxI = new Slider(this, "Roll Max-I", 160, 300);
rollMaxI.setBandwidthY(0, 2);
rollMaxI.setValue(ROLL_M);
rollMinI = new Slider(this, "Roll Min-I", 200, 300);
rollMinI.setBandwidthY(0, -2);
rollMinI.setValue(-ROLL_M);
// Roll PID to motion controller dependencies
rollMaxI.addSignalListener(motionController.getRollMaxI());
rollMinI.addSignalListener(motionController.getRollMinI());
rollGainP.addSignalListener(motionController.getRollGainP());
rollGainI.addSignalListener(motionController.getRollMinI());
rollGainD.addSignalListener(motionController.getRollGainD());
// Setup a graph to display the pitch angle and the elevator output
String kLabelPitch = "Pitch angle";
String kLabelElevator ="Elevator signal";
graphPitch = new Graph(this, 250, 170, 150, 120);
graphPitch.addGraph(kLabelPitch, Colors.BLACK);
graphPitch.getSignal(kLabelPitch).setBandwidth(45, -45);
graphPitch.addGraph(kLabelElevator, Colors.RED);
// Connect the pitch graph to the flight data
flightData.getPitchAngle().addSignalListener(graphPitch.getSignal(kLabelPitch));
flightData.getElevatorOutput().addSignalListener(graphPitch.getSignal(kLabelElevator));
// Setup a graph to display the roll angle and the aileron output
String kLabelRoll = "Roll angle";
String kLabelAileron ="Aileron signal";
graphRoll = new Graph(this, 250, 300, 150, 120);
graphRoll.addGraph(kLabelRoll, Colors.BLACK);
graphRoll.getSignal(kLabelRoll).setBandwidth(-45, 45);
graphRoll.addGraph(kLabelAileron, Colors.RED);
// Connect the roll graph to the flight data
flightData.getRollAngle().addSignalListener(graphRoll.getSignal(kLabelRoll));
flightData.getAileronOutput().addSignalListener(graphRoll.getSignal(kLabelAileron));
// Setup the sliders for the course PID gains
courseGainP = new Slider(this, "Course Gain-P", 40, 430, 40, 120);
courseGainP.setBandwidthY(0, 20);
courseGainP.setValue(NAVIGATION_P);
courseGainI = new Slider(this, "Course Gain-I", 80, 430, 40, 120);
courseGainI.setBandwidthY(0, 5);
courseGainI.setValue(NAVIGATION_I);
courseGainD = new Slider(this, "Course Gain-D", 120, 430, 40, 120);
courseGainD.setBandwidthY(0, 5);
courseGainD.setValue(NAVIGATION_D);
courseMaxI = new Slider(this, "Course Max-I", 160, 430);
courseMaxI.setBandwidthY(0, 20);
courseMaxI.setValue(NAVIGATION_M);
courseMinI = new Slider(this, "Course Min-I", 200, 430, 40, 120);
courseMinI.setBandwidthY(0, -20);
courseMinI.setValue(-NAVIGATION_M);
// Course PID to mission controller dependencies
courseGainP.addListenerY(missionController.getCourseGainP());
courseGainI.addListenerY(missionController.getCourseGainI());