72 lines
1.8 KiB
C++
Raw Normal View History

/************************************************************************
PURPOSE: (Simulate an Aircraft.)
LIBRARY DEPENDENCIES:
((Aircraft/src/Aircraft.o))
**************************************************************************/
#ifndef Aircraft_HH
#define Aircraft_HH
SIM_aircraft Waypoint Update (#1466) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Created a menu bar for the GUI * Minor README fix and file cleanup * Implemented a view menu to hide and show the info on the map * Cleared out commented code. * Last minute code cleanup and update of the documentation. * Updated the View menu with more options and updated documentation. * Testing basic Variable Server Client usage. * Waypoints shared from sim to graphics client. Need to use list and fix some formatting. * Refactored and simplified Waypoint implementation * Documentation and comment updates * Simplified waypoint structure Implemented file support in graphics client * Updated Documentation * Created a default waypoint icon when unspecified * Fixed privacy issues in the WaypointList class * Cleaned up unnecessary file and added comments
2023-04-13 10:50:36 -05:00
#include "Aircraft/include/Waypoint.hh"
SIM_aircraft Waypoint Update (#1453) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Minor README fix and file cleanup
2023-02-13 16:45:15 -06:00
SIM_aircraft Waypoint Update (#1466) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Created a menu bar for the GUI * Minor README fix and file cleanup * Implemented a view menu to hide and show the info on the map * Cleared out commented code. * Last minute code cleanup and update of the documentation. * Updated the View menu with more options and updated documentation. * Testing basic Variable Server Client usage. * Waypoints shared from sim to graphics client. Need to use list and fix some formatting. * Refactored and simplified Waypoint implementation * Documentation and comment updates * Simplified waypoint structure Implemented file support in graphics client * Updated Documentation * Created a default waypoint icon when unspecified * Fixed privacy issues in the WaypointList class * Cleaned up unnecessary file and added comments
2023-04-13 10:50:36 -05:00
#include <vector>
#include <string>
SIM_aircraft Waypoint Update (#1453) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Minor README fix and file cleanup
2023-02-13 16:45:15 -06:00
class Aircraft {
public:
// Calculated by numeric integration of state derivatives.
double pos[2];
double vel[2];
// Updated by control logic;
SIM_aircraft Waypoint Update (#1466) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Created a menu bar for the GUI * Minor README fix and file cleanup * Implemented a view menu to hide and show the info on the map * Cleared out commented code. * Last minute code cleanup and update of the documentation. * Updated the View menu with more options and updated documentation. * Testing basic Variable Server Client usage. * Waypoints shared from sim to graphics client. Need to use list and fix some formatting. * Refactored and simplified Waypoint implementation * Documentation and comment updates * Simplified waypoint structure Implemented file support in graphics client * Updated Documentation * Created a default waypoint icon when unspecified * Fixed privacy issues in the WaypointList class * Cleaned up unnecessary file and added comments
2023-04-13 10:50:36 -05:00
WaypointList flightPath;
int cWP;
// Waypoint List Information Variables
double wpPos[2];
std::string wpImg;
int wpIdx;
// Static Parameters (Don't change during the simulation.)
double mass;
double thrust_mag_max;
double K_drag;
double heading_rate_gain;
// Control Parameters (Recieved from the variable server client.)
double desired_heading;
double desired_speed; // m/s
bool autoPilot;
// Calculated
// Input to numeric integrator.
double acc[2];
//
double heading;
// Methods
int default_data();
int state_init();
int state_deriv();
int state_integ();
int control();
SIM_aircraft Waypoint Update (#1466) * Set up a waypoint system that reads waypoints from an input file. On branch aircraftUpdate Changes to be committed: new file: trick_sims/SIM_aircraft/Modified_data/default.waypoints modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Fixed the Segmentation Fault and completed the waypoint configuration. On branch aircraftUpdate Changes to be committed: modified: trick_sims/SIM_aircraft/RUN_test/input.py modified: trick_sims/SIM_aircraft/models/Aircraft/include/Aircraft.hh modified: trick_sims/SIM_aircraft/models/Aircraft/src/Aircraft.cpp * Created README.md to document recent changes * Adding in ability to set icons for waypoints. On branch aircraftUpdate_WaypointIcons Changes to be committed: modified: trick_sims/SIM_aircraft/Modified_data/default.waypoints new file: trick_sims/SIM_aircraft/images/CompassRose.png new file: trick_sims/SIM_aircraft/images/Figure1.png new file: trick_sims/SIM_aircraft/images/Figure2.png new file: trick_sims/SIM_aircraft/images/cheese_64x64.png new file: trick_sims/SIM_aircraft/images/mouse_128x128.png new file: trick_sims/SIM_aircraft/images/strawberry_64x64.png new file: trick_sims/SIM_aircraft/images/twoWheelRover.png new file: trick_sims/SIM_aircraft/images/wp0.png new file: trick_sims/SIM_aircraft/images/wp1.png new file: trick_sims/SIM_aircraft/images/wp10.png new file: trick_sims/SIM_aircraft/images/wp11.png new file: trick_sims/SIM_aircraft/images/wp2.png new file: trick_sims/SIM_aircraft/images/wp3.png new file: trick_sims/SIM_aircraft/images/wp4.png new file: trick_sims/SIM_aircraft/images/wp5.png new file: trick_sims/SIM_aircraft/images/wp6.png new file: trick_sims/SIM_aircraft/images/wp7.png new file: trick_sims/SIM_aircraft/images/wp8.png new file: trick_sims/SIM_aircraft/images/wp9.png modified: trick_sims/SIM_aircraft/models/graphics/src/trick/AircraftDisplay.java * Reformatted the README file * Updating the build process to use Maven * Updating the README file * Finalized the implementation for adding icons for each waypoint. * Removed commented code that will not be used. * Updated the SIM_aircraft documentation to include the waypoint icon implementation. * Created a menu bar for the GUI * Minor README fix and file cleanup * Implemented a view menu to hide and show the info on the map * Cleared out commented code. * Last minute code cleanup and update of the documentation. * Updated the View menu with more options and updated documentation. * Testing basic Variable Server Client usage. * Waypoints shared from sim to graphics client. Need to use list and fix some formatting. * Refactored and simplified Waypoint implementation * Documentation and comment updates * Simplified waypoint structure Implemented file support in graphics client * Updated Documentation * Created a default waypoint icon when unspecified * Fixed privacy issues in the WaypointList class * Cleaned up unnecessary file and added comments
2023-04-13 10:50:36 -05:00
int cycleWaypoints();
void set_desired_compass_heading( double compass_heading);
void calc_total_force( double (&F_total_body)[2]);
void calc_drag_force( double (&F_drag_body)[2]);
void calc_thrust_force(double (&F_thrust_body)[2]);
void calc_turning_force(double (&F_turning_body)[2]);
void rotateBodyToWorld(double (&F_total_world)[2], double (&F_total_body)[2] );
};
double psiToCompass( double psi );
double compassToPsi( double compass_heading );
double northWestToPsi (double (&p)[2]) ;
double vector_magnitude(double (&vector)[2]);
void vector_difference(double (&result)[2], double (&A)[2], double (&B)[2] );
//
#endif