├── .SimulinkProject ├── Configuration.type.Config.xml ├── Extensions.type.Root │ └── Information.type.Extension.xml ├── Project.xml ├── ProjectData.type.Info.xml ├── Root.type.Categories │ ├── FileClassCategory.type.Category.xml │ └── FileClassCategory.type.Category │ │ ├── artifact.type.Label.xml │ │ ├── convenience.type.Label.xml │ │ ├── derived.type.Label.xml │ │ ├── design.type.Label.xml │ │ ├── none.type.Label.xml │ │ ├── other.type.Label.xml │ │ └── test.type.Label.xml ├── Root.type.EntryPointGroups │ ├── 63e2d8d9-7222-4fa0-9207-f9410cbb286e.type.EntryPointGroup.xml │ ├── 65aa4680-9912-4457-8ff3-862764b0a935.type.EntryPointGroup.xml │ ├── 758569ce-5045-42df-90cd-009b569ef891.type.EntryPointGroup.xml │ ├── 9a754a1d-4dfe-4bd0-a460-311825d44e89.type.EntryPointGroup.xml │ ├── afed8e1a-cc3d-4e15-a111-1a31439f6b98.type.EntryPointGroup.xml │ └── f3439af4-6521-413b-aa24-4b86b609353b.type.EntryPointGroup.xml ├── Root.type.EntryPoints │ ├── 01797d03-88fa-4cf8-86e4-2b4033ae7578.type.EntryPoint.xml │ ├── 190bb48f-a9c5-4bdc-bef0-2a7757dea3df.type.EntryPoint.xml │ ├── 238be3ca-86c8-4a3b-9219-871c0d593cc9.type.EntryPoint.xml │ ├── 28074dcf-edf7-4bbb-ba6c-df835bc98161.type.EntryPoint.xml │ ├── 341892f0-d76b-44ee-86be-3cd21c1c75fe.type.EntryPoint.xml │ ├── 4aa94266-6764-47c0-bac0-1215eb0621c5.type.EntryPoint.xml │ ├── 6ae373a5-d667-4759-bba8-0351a66b2aa6.type.EntryPoint.xml │ ├── 791527cf-fbf5-4b20-9dbe-2fdd6933bebf.type.EntryPoint.xml │ ├── 8ba38656-346f-4f70-a4fa-02cbb0b47c78.type.EntryPoint.xml │ ├── 8d1bd981-0c8c-47d1-a438-27ae285aa769.type.EntryPoint.xml │ ├── 9477520e-74fc-4312-adab-f30c87cc985b.type.EntryPoint.xml │ ├── c40e859c-7ac3-4fb8-8630-3e8e3b5dd037.type.EntryPoint.xml │ ├── c804b14b-24dd-482c-9f79-8a537f7810cc.type.EntryPoint.xml │ ├── d2ae845d-7192-44e6-8b18-0a2b5f3ac121.type.EntryPoint.xml │ └── e86f90ef-5d54-4262-bfd7-4cdad3816e41.type.EntryPoint.xml ├── Root.type.Export │ ├── cf04248b-13f0-41e3-b467-fa38c5dad51c.type.ExportProfile.xml │ ├── cf04248b-13f0-41e3-b467-fa38c5dad51c.type.ExportProfile │ │ └── FileLabel.type.Filter │ │ │ └── test.type.Filter.xml │ ├── e7920f31-2733-40f8-a0f7-27f8a82e2abd.type.ExportProfile.xml │ └── e7920f31-2733-40f8-a0f7-27f8a82e2abd.type.ExportProfile │ │ └── FileLabel.type.Filter │ │ └── design.type.Filter.xml ├── Root.type.Files │ ├── .gitattributes.type.File.xml │ ├── .gitignore.type.File.xml │ ├── .gitmodules.type.File.xml │ ├── README.md.type.File.xml │ ├── SECURITY.md.type.File.xml │ ├── architecture.type.File.xml │ ├── architecture.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── SmallUAS.slx.type.File.xml │ │ ├── electricUAV.slmx.type.File.xml │ │ ├── electricUAV.slx.type.File.xml │ │ ├── electricUAVGCS.slx.type.File.xml │ │ └── massRollUp.m.type.File.xml │ ├── data.type.File.xml │ ├── data.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── carModelInputProfiles.mat.type.File.xml │ │ ├── dd.m.type.File.xml │ │ ├── raspi_ctrl_configset.m.type.File.xml │ │ ├── sim_plant_configset.m.type.File.xml │ │ └── slrt_plant_configset.m.type.File.xml │ ├── lib.type.File.xml │ ├── lib.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── FlightGearLib.slx.type.File.xml │ │ ├── mbdriLib.slx.type.File.xml │ │ └── renameLibLinks.m.type.File.xml │ ├── license.txt.type.File.xml │ ├── models.type.File.xml │ ├── models.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── Autopilot.type.File.xml │ │ ├── Autopilot.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── models.type.File.xml │ │ │ ├── models.type.File │ │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ │ ├── AutopilotControlSystem.slmx.type.File.xml │ │ │ │ ├── AutopilotControlSystem.slx.type.File.xml │ │ │ │ ├── Guidance.type.File.xml │ │ │ │ ├── Guidance.type.File │ │ │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ │ │ ├── DirectCommands.slx.type.File.xml │ │ │ │ │ ├── Orbit.slx.type.File.xml │ │ │ │ │ ├── RTB_FollowMobile.slx.type.File.xml │ │ │ │ │ └── WP_Guidance.slx.type.File.xml │ │ │ │ ├── QGroundControlInterface.slxp.type.File.xml │ │ │ │ ├── QGroundControlInterface_unix.slxp.type.File.xml │ │ │ │ ├── raspiAutopilotControlSystem.slx.type.File.xml │ │ │ │ └── raspiHostFlightGearVisualization.slx.type.File.xml │ │ │ ├── src.type.File.xml │ │ │ └── src.type.File │ │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ │ └── rtwmakecfg.m.type.File.xml │ │ ├── PlantModel.type.File.xml │ │ ├── PlantModel.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── PlantModel.slx.type.File.xml │ │ │ └── slrtPlantModel.slx.type.File.xml │ │ ├── Simulation.type.File.xml │ │ └── Simulation.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── parsimUtilities.type.File.xml │ │ │ ├── parsimUtilities.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── PlotFlightResultsFcn.m.type.File.xml │ │ │ ├── configParSim.m.type.File.xml │ │ │ ├── random_waypoint_generator.m.type.File.xml │ │ │ ├── runRandomParFlight.m.type.File.xml │ │ │ └── runparsim.m.type.File.xml │ │ │ ├── simModel.slx.type.File.xml │ │ │ ├── simUtilities.type.File.xml │ │ │ └── simUtilities.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── PlotFlightResults.m.type.File.xml │ │ │ ├── configCoSim.m.type.File.xml │ │ │ ├── configHILSim.m.type.File.xml │ │ │ ├── configSim.m.type.File.xml │ │ │ └── runShortFlight.m.type.File.xml │ ├── requirements.type.File.xml │ ├── requirements.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── SystemLevelRequirements.slreqx.type.File.xml │ │ └── electricUAVReqs.slreqx.type.File.xml │ ├── tests.type.File.xml │ ├── tests.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── B2B_tests.type.File.xml │ │ ├── B2B_tests.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── AutopilotControlSystem_test1.mldatx.type.File.xml │ │ │ ├── AutopilotControlSystem_test1.slmx.type.File.xml │ │ │ ├── baselineAutopilotControlSystem.mat.type.File.xml │ │ │ └── inputs_on_2021_08_17_at_08_10_16.mat.type.File.xml │ │ ├── regression_tests.type.File.xml │ │ ├── regression_tests.type.File │ │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ │ ├── baselineShortFlight.mat.type.File.xml │ │ │ ├── baselineShortFlight_Accel.mat.type.File.xml │ │ │ ├── baselineShortFlight_SF_Accel.mat.type.File.xml │ │ │ ├── baselineShortFlight_SIL.mat.type.File.xml │ │ │ └── regression_tests.mldatx.type.File.xml │ │ └── runTestsuite.m.type.File.xml │ ├── utilities.type.File.xml │ └── utilities.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── base_workspace_set_up.m.type.File.xml │ │ ├── clean_up_project.m.type.File.xml │ │ ├── models_set_up.m.type.File.xml │ │ ├── set_up_project.m.type.File.xml │ │ ├── ui.type.File.xml │ │ └── ui.type.File │ │ ├── 1.type.DIR_SIGNIFIER.xml │ │ ├── convertListBoxTextToEnum.m.type.File.xml │ │ ├── eTask.m.type.File.xml │ │ ├── launchTaskSelectorApp.m.type.File.xml │ │ ├── taskDescriptionCallback.m.type.File.xml │ │ ├── taskSelectApplication.mlapp.type.File.xml │ │ ├── taskShutdownCallback.m.type.File.xml │ │ └── taskToolboxStatus.m.type.File.xml ├── Root.type.ProjectPath │ ├── 29946334-314c-4a0f-8d5d-74fc275c053f.type.Reference.xml │ ├── 346e1c2c-2d51-46d6-a1d2-8800928f4242.type.Reference.xml │ ├── 3aa68212-7c8d-4e2f-991b-0db586db401d.type.Reference.xml │ ├── 3b23a793-816f-4b74-a09a-b83dcd46832c.type.Reference.xml │ ├── 3b966770-650a-4ade-b0a5-1275d6e57ea8.type.Reference.xml │ ├── 46a66f2d-908e-40f9-b3d4-18a991213fe2.type.Reference.xml │ ├── 4c25f0ea-4874-423e-a80e-8847c66f5ce2.type.Reference.xml │ ├── 5d39490c-3923-4224-97e6-7b935a57e29e.type.Reference.xml │ ├── 5eaa3b86-4f1c-4214-b6d5-016f29fa116b.type.Reference.xml │ ├── 6cda45c5-0d41-4a32-a9b6-173ae77e2142.type.Reference.xml │ ├── b5b4ce9e-f345-4386-916b-d1967dcf680f.type.Reference.xml │ ├── b7fc4fad-18d9-4ac5-9035-7e43d36c0dcf.type.Reference.xml │ ├── ba4e734f-4c43-49d9-9e95-c33c0601b872.type.Reference.xml │ ├── c8ea95a2-394f-4262-b0f4-dd109466cbed.type.Reference.xml │ ├── d981aecd-6120-4594-a4fc-1429b490910b.type.Reference.xml │ ├── db7d5a25-6147-498f-8965-1f993a6a10bb.type.Reference.xml │ ├── e49ba37c-8f1c-41bb-9fa8-99ab62f65bbe.type.Reference.xml │ ├── f063f8fa-509a-4833-ac01-14ee32ea5a38.type.Reference.xml │ └── f6d0ceff-c8ba-4e48-aaed-c8e81db757ec.type.Reference.xml ├── Root.type.WorkingFolders │ ├── ProjectStartupFolder.type.Reference.xml │ ├── SimulinkCacheFolder.type.Reference.xml │ └── SimulinkCodeGenFolder.type.Reference.xml └── uuid-bb0d38fe-8d38-4c1e-a465-d4ac2df0eb1b ├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── MBDRI.prj ├── README.md ├── SECURITY.md ├── architecture ├── SmallUAS.slx ├── electricUAV.slmx ├── electricUAV.slx ├── electricUAVGCS.slx └── massRollUp.m ├── data ├── carModelInputProfiles.mat ├── dd.m ├── raspi_ctrl_configset.m ├── sim_plant_configset.m └── slrt_plant_configset.m ├── documentation └── images │ ├── cosim_overview.png │ ├── qgc.png │ ├── rpi-3.jpg │ ├── runShortFlight_xyPlot.png │ └── slDroneReferenceApp.mov ├── lib ├── FlightGearLib.slx ├── mbdriLib.slx └── renameLibLinks.m ├── license.txt ├── models ├── Autopilot │ ├── models │ │ ├── AutopilotControlSystem.slmx │ │ ├── AutopilotControlSystem.slx │ │ ├── Guidance │ │ │ ├── DirectCommands.slx │ │ │ ├── Orbit.slx │ │ │ ├── RTB_FollowMobile.slx │ │ │ └── WP_Guidance.slx │ │ ├── QGroundControlInterface.slxp │ │ ├── QGroundControlInterface_unix.slxp │ │ ├── raspiAutopilotControlSystem.slx │ │ └── raspiHostFlightGearVisualization.slx │ ├── qgc │ │ ├── qgcGains.params │ │ ├── qgcNatickMission.mission │ │ ├── qgcShortNatickMission.mission │ │ ├── qgcSimulinkWidget.qml │ │ └── qgcUCSCWaypoints.mission │ └── src │ │ ├── interfaceDefinition.h │ │ ├── messages │ │ ├── checksum.h │ │ ├── common │ │ │ ├── common.h │ │ │ ├── mavlink.h │ │ │ ├── mavlink_msg_actuator_control_target.h │ │ │ ├── mavlink_msg_adsb_vehicle.h │ │ │ ├── mavlink_msg_altitude.h │ │ │ ├── mavlink_msg_att_pos_mocap.h │ │ │ ├── mavlink_msg_attitude.h │ │ │ ├── mavlink_msg_attitude_quaternion.h │ │ │ ├── mavlink_msg_attitude_quaternion_cov.h │ │ │ ├── mavlink_msg_attitude_target.h │ │ │ ├── mavlink_msg_auth_key.h │ │ │ ├── mavlink_msg_autopilot_version.h │ │ │ ├── mavlink_msg_battery_status.h │ │ │ ├── mavlink_msg_button_change.h │ │ │ ├── mavlink_msg_camera_capture_status.h │ │ │ ├── mavlink_msg_camera_image_captured.h │ │ │ ├── mavlink_msg_camera_information.h │ │ │ ├── mavlink_msg_camera_settings.h │ │ │ ├── mavlink_msg_camera_trigger.h │ │ │ ├── mavlink_msg_change_operator_control.h │ │ │ ├── mavlink_msg_change_operator_control_ack.h │ │ │ ├── mavlink_msg_collision.h │ │ │ ├── mavlink_msg_command_ack.h │ │ │ ├── mavlink_msg_command_int.h │ │ │ ├── mavlink_msg_command_long.h │ │ │ ├── mavlink_msg_control_system_state.h │ │ │ ├── mavlink_msg_data_stream.h │ │ │ ├── mavlink_msg_data_transmission_handshake.h │ │ │ ├── mavlink_msg_debug.h │ │ │ ├── mavlink_msg_debug_vect.h │ │ │ ├── mavlink_msg_distance_sensor.h │ │ │ ├── mavlink_msg_encapsulated_data.h │ │ │ ├── mavlink_msg_estimator_status.h │ │ │ ├── mavlink_msg_extended_sys_state.h │ │ │ ├── mavlink_msg_file_transfer_protocol.h │ │ │ ├── mavlink_msg_flight_information.h │ │ │ ├── mavlink_msg_follow_target.h │ │ │ ├── mavlink_msg_global_position_int.h │ │ │ ├── mavlink_msg_global_position_int_cov.h │ │ │ ├── mavlink_msg_global_vision_position_estimate.h │ │ │ ├── mavlink_msg_gps2_raw.h │ │ │ ├── mavlink_msg_gps2_rtk.h │ │ │ ├── mavlink_msg_gps_global_origin.h │ │ │ ├── mavlink_msg_gps_inject_data.h │ │ │ ├── mavlink_msg_gps_input.h │ │ │ ├── mavlink_msg_gps_raw_int.h │ │ │ ├── mavlink_msg_gps_rtcm_data.h │ │ │ ├── mavlink_msg_gps_rtk.h │ │ │ ├── mavlink_msg_gps_status.h │ │ │ ├── mavlink_msg_heartbeat.h │ │ │ ├── mavlink_msg_high_latency.h │ │ │ ├── mavlink_msg_highres_imu.h │ │ │ ├── mavlink_msg_hil_actuator_controls.h │ │ │ ├── mavlink_msg_hil_controls.h │ │ │ ├── mavlink_msg_hil_gps.h │ │ │ ├── mavlink_msg_hil_optical_flow.h │ │ │ ├── mavlink_msg_hil_rc_inputs_raw.h │ │ │ ├── mavlink_msg_hil_sensor.h │ │ │ ├── mavlink_msg_hil_state.h │ │ │ ├── mavlink_msg_hil_state_quaternion.h │ │ │ ├── mavlink_msg_home_position.h │ │ │ ├── mavlink_msg_landing_target.h │ │ │ ├── mavlink_msg_local_position_ned.h │ │ │ ├── mavlink_msg_local_position_ned_cov.h │ │ │ ├── mavlink_msg_local_position_ned_system_global_offset.h │ │ │ ├── mavlink_msg_log_data.h │ │ │ ├── mavlink_msg_log_entry.h │ │ │ ├── mavlink_msg_log_erase.h │ │ │ ├── mavlink_msg_log_request_data.h │ │ │ ├── mavlink_msg_log_request_end.h │ │ │ ├── mavlink_msg_log_request_list.h │ │ │ ├── mavlink_msg_logging_ack.h │ │ │ ├── mavlink_msg_logging_data.h │ │ │ ├── mavlink_msg_logging_data_acked.h │ │ │ ├── mavlink_msg_manual_control.h │ │ │ ├── mavlink_msg_manual_setpoint.h │ │ │ ├── mavlink_msg_memory_vect.h │ │ │ ├── mavlink_msg_message_interval.h │ │ │ ├── mavlink_msg_mission_ack.h │ │ │ ├── mavlink_msg_mission_clear_all.h │ │ │ ├── mavlink_msg_mission_count.h │ │ │ ├── mavlink_msg_mission_current.h │ │ │ ├── mavlink_msg_mission_item.h │ │ │ ├── mavlink_msg_mission_item_int.h │ │ │ ├── mavlink_msg_mission_item_reached.h │ │ │ ├── mavlink_msg_mission_request.h │ │ │ ├── mavlink_msg_mission_request_int.h │ │ │ ├── mavlink_msg_mission_request_list.h │ │ │ ├── mavlink_msg_mission_request_partial_list.h │ │ │ ├── mavlink_msg_mission_set_current.h │ │ │ ├── mavlink_msg_mission_write_partial_list.h │ │ │ ├── mavlink_msg_mount_orientation.h │ │ │ ├── mavlink_msg_named_value_float.h │ │ │ ├── mavlink_msg_named_value_int.h │ │ │ ├── mavlink_msg_nav_controller_output.h │ │ │ ├── mavlink_msg_optical_flow.h │ │ │ ├── mavlink_msg_optical_flow_rad.h │ │ │ ├── mavlink_msg_param_map_rc.h │ │ │ ├── mavlink_msg_param_request_list.h │ │ │ ├── mavlink_msg_param_request_read.h │ │ │ ├── mavlink_msg_param_set.h │ │ │ ├── mavlink_msg_param_value.h │ │ │ ├── mavlink_msg_ping.h │ │ │ ├── mavlink_msg_play_tune.h │ │ │ ├── mavlink_msg_position_target_global_int.h │ │ │ ├── mavlink_msg_position_target_local_ned.h │ │ │ ├── mavlink_msg_power_status.h │ │ │ ├── mavlink_msg_radio_status.h │ │ │ ├── mavlink_msg_raw_imu.h │ │ │ ├── mavlink_msg_raw_pressure.h │ │ │ ├── mavlink_msg_rc_channels.h │ │ │ ├── mavlink_msg_rc_channels_override.h │ │ │ ├── mavlink_msg_rc_channels_raw.h │ │ │ ├── mavlink_msg_rc_channels_scaled.h │ │ │ ├── mavlink_msg_request_data_stream.h │ │ │ ├── mavlink_msg_resource_request.h │ │ │ ├── mavlink_msg_safety_allowed_area.h │ │ │ ├── mavlink_msg_safety_set_allowed_area.h │ │ │ ├── mavlink_msg_scaled_imu.h │ │ │ ├── mavlink_msg_scaled_imu2.h │ │ │ ├── mavlink_msg_scaled_imu3.h │ │ │ ├── mavlink_msg_scaled_pressure.h │ │ │ ├── mavlink_msg_scaled_pressure2.h │ │ │ ├── mavlink_msg_scaled_pressure3.h │ │ │ ├── mavlink_msg_serial_control.h │ │ │ ├── mavlink_msg_servo_output_raw.h │ │ │ ├── mavlink_msg_set_actuator_control_target.h │ │ │ ├── mavlink_msg_set_attitude_target.h │ │ │ ├── mavlink_msg_set_gps_global_origin.h │ │ │ ├── mavlink_msg_set_home_position.h │ │ │ ├── mavlink_msg_set_mode.h │ │ │ ├── mavlink_msg_set_position_target_global_int.h │ │ │ ├── mavlink_msg_set_position_target_local_ned.h │ │ │ ├── mavlink_msg_setup_signing.h │ │ │ ├── mavlink_msg_sim_state.h │ │ │ ├── mavlink_msg_statustext.h │ │ │ ├── mavlink_msg_storage_information.h │ │ │ ├── mavlink_msg_sys_status.h │ │ │ ├── mavlink_msg_system_time.h │ │ │ ├── mavlink_msg_terrain_check.h │ │ │ ├── mavlink_msg_terrain_data.h │ │ │ ├── mavlink_msg_terrain_report.h │ │ │ ├── mavlink_msg_terrain_request.h │ │ │ ├── mavlink_msg_timesync.h │ │ │ ├── mavlink_msg_v2_extension.h │ │ │ ├── mavlink_msg_vfr_hud.h │ │ │ ├── mavlink_msg_vibration.h │ │ │ ├── mavlink_msg_vicon_position_estimate.h │ │ │ ├── mavlink_msg_vision_position_estimate.h │ │ │ ├── mavlink_msg_vision_speed_estimate.h │ │ │ ├── mavlink_msg_wind_cov.h │ │ │ ├── testsuite.h │ │ │ └── version.h │ │ ├── mavlink_conversions.h │ │ ├── mavlink_get_info.h │ │ ├── mavlink_helpers.h │ │ ├── mavlink_sha256.h │ │ ├── mavlink_types.h │ │ ├── mbdri.xml │ │ └── protocol.h │ │ ├── sfun_manageMAVLinkConnection.mexa64 │ │ ├── sfun_manageMAVLinkConnection.mexmaci64 │ │ └── sfun_manageMAVLinkConnection.mexw64 ├── PlantModel │ ├── PlantModel.slx │ └── slrtPlantModel.slx └── Simulation │ ├── parsimUtilities │ ├── PlotFlightResultsFcn.m │ ├── configParSim.m │ ├── random_waypoint_generator.m │ ├── runRandomParFlight.m │ └── runparsim.m │ ├── simModel.slx │ └── simUtilities │ ├── PlotFlightResults.m │ ├── configCoSim.m │ ├── configHILSim.m │ ├── configSim.m │ └── runShortFlight.m ├── requirements ├── SystemLevelRequirements.slreqx └── electricUAVReqs.slreqx ├── tests ├── B2B_tests │ ├── AutopilotControlSystem_test1.mldatx │ ├── AutopilotControlSystem_test1.slmx │ ├── baselineAutopilotControlSystem.mat │ └── inputs_on_2021_08_17_at_08_10_16.mat ├── regression_tests │ ├── baselineShortFlight.mat │ ├── baselineShortFlight_Accel.mat │ ├── baselineShortFlight_SF_Accel.mat │ ├── baselineShortFlight_SIL.mat │ └── regression_tests.mldatx └── runTestsuite.m └── utilities ├── base_workspace_set_up.m ├── clean_up_project.m ├── models_set_up.m ├── runfg_mac ├── set_up_project.m └── ui ├── convertListBoxTextToEnum.m ├── eTask.m ├── launchTaskSelectorApp.m ├── taskDescriptionCallback.m ├── taskSelectApplication.mlapp ├── taskShutdownCallback.m └── taskToolboxStatus.m /.SimulinkProject/Configuration.type.Config.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Extensions.type.Root/Information.type.Extension.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/ProjectData.type.Info.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/artifact.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/convenience.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/derived.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/design.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/none.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/other.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Categories/FileClassCategory.type.Category/test.type.Label.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/63e2d8d9-7222-4fa0-9207-f9410cbb286e.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/65aa4680-9912-4457-8ff3-862764b0a935.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/758569ce-5045-42df-90cd-009b569ef891.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/9a754a1d-4dfe-4bd0-a460-311825d44e89.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/afed8e1a-cc3d-4e15-a111-1a31439f6b98.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPointGroups/f3439af4-6521-413b-aa24-4b86b609353b.type.EntryPointGroup.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/01797d03-88fa-4cf8-86e4-2b4033ae7578.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/190bb48f-a9c5-4bdc-bef0-2a7757dea3df.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/238be3ca-86c8-4a3b-9219-871c0d593cc9.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/28074dcf-edf7-4bbb-ba6c-df835bc98161.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/341892f0-d76b-44ee-86be-3cd21c1c75fe.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/4aa94266-6764-47c0-bac0-1215eb0621c5.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/6ae373a5-d667-4759-bba8-0351a66b2aa6.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/791527cf-fbf5-4b20-9dbe-2fdd6933bebf.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/8ba38656-346f-4f70-a4fa-02cbb0b47c78.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/8d1bd981-0c8c-47d1-a438-27ae285aa769.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/9477520e-74fc-4312-adab-f30c87cc985b.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/c40e859c-7ac3-4fb8-8630-3e8e3b5dd037.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/c804b14b-24dd-482c-9f79-8a537f7810cc.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/d2ae845d-7192-44e6-8b18-0a2b5f3ac121.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.EntryPoints/e86f90ef-5d54-4262-bfd7-4cdad3816e41.type.EntryPoint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Export/cf04248b-13f0-41e3-b467-fa38c5dad51c.type.ExportProfile.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Export/cf04248b-13f0-41e3-b467-fa38c5dad51c.type.ExportProfile/FileLabel.type.Filter/test.type.Filter.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Export/e7920f31-2733-40f8-a0f7-27f8a82e2abd.type.ExportProfile.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Export/e7920f31-2733-40f8-a0f7-27f8a82e2abd.type.ExportProfile/FileLabel.type.Filter/design.type.Filter.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/.gitattributes.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/.gitignore.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/.gitmodules.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/README.md.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/SECURITY.md.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/SmallUAS.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/electricUAV.slmx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/electricUAV.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/electricUAVGCS.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/architecture.type.File/massRollUp.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/carModelInputProfiles.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/dd.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/raspi_ctrl_configset.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/sim_plant_configset.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/data.type.File/slrt_plant_configset.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/lib.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/lib.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/lib.type.File/FlightGearLib.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/lib.type.File/mbdriLib.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/lib.type.File/renameLibLinks.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/license.txt.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/AutopilotControlSystem.slmx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/AutopilotControlSystem.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File/DirectCommands.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File/Orbit.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File/RTB_FollowMobile.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/Guidance.type.File/WP_Guidance.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/QGroundControlInterface.slxp.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/QGroundControlInterface_unix.slxp.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/raspiAutopilotControlSystem.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/models.type.File/raspiHostFlightGearVisualization.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/src.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/src.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Autopilot.type.File/src.type.File/rtwmakecfg.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/PlantModel.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/PlantModel.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/PlantModel.type.File/PlantModel.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/PlantModel.type.File/slrtPlantModel.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/PlotFlightResultsFcn.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/configParSim.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/random_waypoint_generator.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/runRandomParFlight.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/parsimUtilities.type.File/runparsim.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simModel.slx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/PlotFlightResults.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/configCoSim.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/configHILSim.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/configSim.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/models.type.File/Simulation.type.File/simUtilities.type.File/runShortFlight.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/requirements.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/requirements.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/requirements.type.File/SystemLevelRequirements.slreqx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/requirements.type.File/electricUAVReqs.slreqx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File/AutopilotControlSystem_test1.mldatx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File/AutopilotControlSystem_test1.slmx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File/baselineAutopilotControlSystem.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/B2B_tests.type.File/inputs_on_2021_08_17_at_08_10_16.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/baselineShortFlight.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/baselineShortFlight_Accel.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/baselineShortFlight_SF_Accel.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/baselineShortFlight_SIL.mat.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/regression_tests.type.File/regression_tests.mldatx.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/tests.type.File/runTestsuite.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/base_workspace_set_up.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/clean_up_project.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/models_set_up.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/set_up_project.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/1.type.DIR_SIGNIFIER.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/convertListBoxTextToEnum.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/eTask.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/launchTaskSelectorApp.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/taskDescriptionCallback.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/taskSelectApplication.mlapp.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/taskShutdownCallback.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.Files/utilities.type.File/ui.type.File/taskToolboxStatus.m.type.File.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/29946334-314c-4a0f-8d5d-74fc275c053f.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/346e1c2c-2d51-46d6-a1d2-8800928f4242.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/3aa68212-7c8d-4e2f-991b-0db586db401d.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/3b23a793-816f-4b74-a09a-b83dcd46832c.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/3b966770-650a-4ade-b0a5-1275d6e57ea8.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/46a66f2d-908e-40f9-b3d4-18a991213fe2.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/4c25f0ea-4874-423e-a80e-8847c66f5ce2.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/5d39490c-3923-4224-97e6-7b935a57e29e.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/5eaa3b86-4f1c-4214-b6d5-016f29fa116b.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/6cda45c5-0d41-4a32-a9b6-173ae77e2142.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/b5b4ce9e-f345-4386-916b-d1967dcf680f.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/b7fc4fad-18d9-4ac5-9035-7e43d36c0dcf.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/ba4e734f-4c43-49d9-9e95-c33c0601b872.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/c8ea95a2-394f-4262-b0f4-dd109466cbed.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/d981aecd-6120-4594-a4fc-1429b490910b.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/db7d5a25-6147-498f-8965-1f993a6a10bb.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/e49ba37c-8f1c-41bb-9fa8-99ab62f65bbe.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/f063f8fa-509a-4833-ac01-14ee32ea5a38.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.ProjectPath/f6d0ceff-c8ba-4e48-aaed-c8e81db757ec.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.WorkingFolders/ProjectStartupFolder.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.WorkingFolders/SimulinkCacheFolder.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/Root.type.WorkingFolders/SimulinkCodeGenFolder.type.Reference.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.SimulinkProject/uuid-bb0d38fe-8d38-4c1e-a465-d4ac2df0eb1b: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.fig binary 2 | *.mat binary 3 | *.mdl binary 4 | *.mdlp binary 5 | *.mexa64 binary 6 | *.mexw64 binary 7 | *.mexmaci64 binary 8 | *.mlapp binary 9 | *.mldatx binary 10 | *.mlproj binary 11 | *.mlx binary 12 | *.p binary 13 | *.sfx binary 14 | *.sldd binary 15 | *.slreqx binary 16 | *.slmx binary 17 | *.sltx binary 18 | *.slxc binary 19 | *.slx binary merge=mlAutoMerge 20 | *.slxp binary 21 | 22 | ## Other common binary file types 23 | *.docx binary 24 | *.exe binary 25 | *.jpg binary 26 | *.pdf binary 27 | *.png binary 28 | *.xlsx binary 29 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the main branch 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "test" 19 | test: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | 28 | - name: Setup MATLAB 29 | # You may pin to the exact commit or the version. 30 | # uses: matlab-actions/setup-matlab@bfca1c30aa37e57792ad04e5c68bf4ff33218b6d 31 | uses: matlab-actions/setup-matlab@v1.0.1 32 | 33 | - name: Run MATLAB Command 34 | # You may pin to the exact commit or the version. 35 | # uses: matlab-actions/run-command@3a7e877e5c019883a1f5fe4635c84d74394bb70e 36 | uses: matlab-actions/run-command@v1.0.1 37 | with: 38 | # Script, function, or statement to execute 39 | command: openProject(pwd); runTestsuite('github'); 40 | 41 | - name: Test Reporter 42 | uses: dorny/test-reporter@v1.5.0 43 | with: 44 | name: Check MATLAB test results from JUnit report 45 | path: work/results.xml 46 | reporter: java-junit 47 | fail-on-error: false 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | work -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "models/Autopilot/src/mavlink"] 2 | path = models/Autopilot/src/mavlink 3 | url = https://github.com/malife/mavlink.git 4 | branch = fixMissionLib 5 | -------------------------------------------------------------------------------- /MBDRI.prj: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simulink Drone Reference Application [![View Simulink Drone Reference Application on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://www.mathworks.com/matlabcentral/fileexchange/67625-simulink-drone-reference-application) 2 | 3 | This Simulink® Project shows the implementation of a Remotely Piloted Radio-Control fixed-wing aircraft (i.e. Drone, UAV), an autopilot for flight stabilization, and an operator interface to control its trajectory. 4 | 5 | ## Components 6 | 7 | The model consists of three main components: 8 | 9 | ### Plant model 10 | 11 | A Six-Degree-Of-Freedom (6-DOF) dynamics model for a foam-built, 65-inch wingspan, Multiplex Mentor hobby radio controlled aircraft. It consists of models for the aircraft dynamics, the weather, the motor, the actuators and the sensors. The plant receives commands for the four actuator channels: (1) Throttle, (2) Ailerons, (3) Rudder, and (4) Elevator. In turn, it produces a set of readings as those that a sensor suite would produce on board this type of aircraft. 12 | 13 | The plant model uses a flat-earth approximation and therefore it will only work for flights which have a range of approximately 20 Km.. 14 | 15 | ### Autopilot model. 16 | 17 | The autopilot controller is a classical lateral/longitudinal channel flight controller which includes Guidance, Navigation and Control (except attitude estimation as this is assumed to be obtained directly from the sensor suite). The autopilot, based on the ground control station commands and the sensor readings, produces control commands for the control surfaces and also reports telemetry back to the ground station. This block stabilizes the aircraft to keep it in-flight. 18 | 19 | It allows the operator to command it to fly in four different modes: 20 | 21 | - Waypoint guidance. 22 | - Circular Guidance. 23 | - Return to Base. 24 | - Mid-level contro commands (Uc, phi_c, H_c) 25 | 26 | ### Aircraft operator interface. 27 | 28 | This represents the console operating the RC Aircraft in flight. It issues commands sent from the ground to the aircraft (waypoints, airspeed, height, etc...). 29 | 30 | The block receives telemetry reported by the aircraft such as attitude, sensor readings, and overall aircraft status. This will allow to set the desired behavior of the aircraft while in-flight. 31 | 32 | This model has the option to interact with the well-know, publicly available Open Source Micro Air Vehicle ground station software [QGroundControl](http://qgroundcontrol.com/). To communicate with QGroundControl, the model uses the [MAVLink](https://mavlink.io/) communications protocol. 33 | 34 | ## Functionality 35 | 36 | This Simulink Project exercises several common workflows in flight control development. Its purpose is to show a recommended approach to a Model-Based Design (MBD) process to develop a proof of concept Drone flight controller (autopilot). Particularly we show the following workflows: 37 | 38 | 1. **Flight Controller Design** Develop a fixed-wing drone autopilot and test its behavior in a reasonably realistic 6DOF aircraft simulation. 39 | 40 | 2. **Simulate the Flight Controller Under Different Conditions**: Rapidly asses the performance of an autopilot under many simulated flight conditions, using local parallel simulations. 41 | 42 | 3. **Flight Envelope Characterization** Rapidly characterize the Aircraft’s performance by doing a wide range of environmental and initial conditions sweep using MATLAB Distributed Computing Server. 43 | 44 | 4. **UAV SME Capabilities Assessment** Demonstrate to a Subject Matter Expert (SME), early in the design process, the Drone’s capabilities and gather feedback on usability and its functionality, via co-simulation between Simulink and QGroundControl Ground Station Software. 45 | 46 | 5. **Test Correctness of the Fight Controller’s Generated Code** Test the code behavior using Simulink's Software-In-the-Loop on the development computer for same results (within bounds) of the designed autopilot. 47 | 48 | 6. **Deploy and Test Correctness of the Flight Controller’s Generated Code** Test the code’s behavior on a development board (a Raspberry Pi) for same results (within bounds) using Simulink's Processor-In-the-Loop. 49 | 50 | 7. **System Integration Test (Hardware-In-the-Loop)** Test the flight controller deployed in the development board (Raspberry Pi) with a 6DOF aircraft simulation running in a [Speedgoat®](https://www.speedgoat.com/) Real-Time computer with [Simulink Real-Time™](https://www.mathworks.com/products/simulink-real-time.html). 51 | 52 | 8. **Run Regression Tests** Run Regression tests locally. 53 | 54 | ## Co-Simulation and Control Interface 55 | This model can interact with the Open Source QGroundControl ground station software to control the aircraft while "in flight": 56 | 57 | ![QGC Co-Simulation](./documentation/images/cosim_overview.png) 58 | 59 | ## Getting Started 60 | 61 | To run the model clone the repository into your own working directory and, from the MATLAB command line: 62 | 63 | ```matlab 64 | >> openProject('pathToYourProject/MBDRI.prj'); 65 | >> configSim; 66 | >> runShortFlight; 67 | ``` 68 | This should produce five plots, the first being an XY plot of a complete mission around 6 waypoints, as shown below: 69 | 70 | ![XY Mission Plot](./documentation/images/runShortFlight_xyPlot.png) 71 | 72 | ## Setup 73 | 74 | To get the full functionality, you will need a computer running MATLAB®, Simulink® and a supported compiler plus the following products depending on the workflow: 75 | 76 | ### For Flight Control Design 77 | 78 | - [Control Systems Toolbox™](https://www.mathworks.com/products/control.html) 79 | 80 | ### Simulate the Flight Controller Under Different Conditions 81 | 82 | - [Parallel Computing Toolbox™](https://www.mathworks.com/products/parallel-computing.html) 83 | 84 | ### Flight Envelope Characterization 85 | 86 | - [Parallel Computing Toolbox™](https://www.mathworks.com/products/parallel-computing.html) 87 | - [MATLAB Parallel Server™](https://www.mathworks.com/products/matlab-parallel-server.html) 88 | 89 | ### SME Assesment and Connectivity to QGroundControl 90 | 91 | - [QGroundControl](http://qgroundcontrol.com/) 3.1.3 or higher. 92 | 93 | ### For Testing and Deploying the Behavior of the Fight Controller’s Generated Code 94 | 95 | - A Raspberry Pi 2 or 3 board. 96 | - MATLAB Coder™ 97 | - Simulink Coder™ 98 | - [Embedded Coder™](https://www.mathworks.com/products/embedded-coder.html) 99 | - [Simulink Support Package for Raspberry Pi](https://www.mathworks.com/hardware-support/raspberry-pi-simulink.html) 100 | 101 | ### For System Integration Test (Hardware-In-the-Loop) 102 | 103 | - A host computer running Windows 104 | - [Simulink Real-Time™](http://www.mathworks.com/products/simulink-real-time.html) 105 | - A supported Speedgoat target computer with two ethernet ports 106 | - A Raspberry Pi 2 or 3 board 107 | - MATLAB Coder™ 108 | - Simulink Coder™ 109 | - [Simulink Support Package for Raspberry Pi](https://www.mathworks.com/hardware-support/raspberry-pi-simulink.html) 110 | 111 | ### For Automated Tests (Back-to-Back and Regression Tests) 112 | 113 | - [Simulink Test™](https://www.mathworks.com/products/simulink-test.html) 114 | 115 | ## License 116 | The license is available in the [License file](license.txt) within this repository. 117 | 118 | # Contributing 119 | 120 | If you are interested in contributing we are definitely interested in hearing from you. There are many open tickets and we are sure this list will only grow, so feel free to contribute by owning one of those tickets and send us a pull request. 121 | 122 | If you would like to suggest an enhancement please create a new issue and apply the _enhancement_ label. This is no guarantee that we will get to it, but we will definitely take it into consideration. 123 | 124 | If you have encountered a bug, please create a new issue and apply the _bug_ label. 125 | 126 | # Community Support 127 | [MATLAB Central](https://www.mathworks.com/matlabcentral) 128 | 129 | Copyright 2021 The MathWorks, Inc. 130 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Vulnerabilities 2 | 3 | If you believe you have discovered a security vulnerability, please report it to 4 | [security@mathworks.com](mailto:security@mathworks.com). Please see 5 | [MathWorks Vulnerability Disclosure Policy for Security Researchers](https://www.mathworks.com/company/aboutus/policies_statements/vulnerability-disclosure-policy.html) 6 | for additional information. -------------------------------------------------------------------------------- /architecture/SmallUAS.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/architecture/SmallUAS.slx -------------------------------------------------------------------------------- /architecture/electricUAV.slmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/architecture/electricUAV.slmx -------------------------------------------------------------------------------- /architecture/electricUAV.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/architecture/electricUAV.slx -------------------------------------------------------------------------------- /architecture/electricUAVGCS.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/architecture/electricUAVGCS.slx -------------------------------------------------------------------------------- /architecture/massRollUp.m: -------------------------------------------------------------------------------- 1 | function massRollUp(instance,varargin) 2 | % mySum2 Example Analysis Function 3 | 4 | if instance.isComponent() 5 | 6 | if ~isempty(instance.Components) 7 | mass = 0; 8 | for child=instance.Components 9 | mass = mass + child.getValue('OnboardElement.Mass'); 10 | end 11 | instance.setValue('OnboardElement.Mass',mass); 12 | 13 | end 14 | 15 | end 16 | 17 | end 18 | -------------------------------------------------------------------------------- /data/carModelInputProfiles.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/data/carModelInputProfiles.mat -------------------------------------------------------------------------------- /documentation/images/cosim_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/documentation/images/cosim_overview.png -------------------------------------------------------------------------------- /documentation/images/qgc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/documentation/images/qgc.png -------------------------------------------------------------------------------- /documentation/images/rpi-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/documentation/images/rpi-3.jpg -------------------------------------------------------------------------------- /documentation/images/runShortFlight_xyPlot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/documentation/images/runShortFlight_xyPlot.png -------------------------------------------------------------------------------- /documentation/images/slDroneReferenceApp.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/documentation/images/slDroneReferenceApp.mov -------------------------------------------------------------------------------- /lib/FlightGearLib.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/lib/FlightGearLib.slx -------------------------------------------------------------------------------- /lib/mbdriLib.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/lib/mbdriLib.slx -------------------------------------------------------------------------------- /lib/renameLibLinks.m: -------------------------------------------------------------------------------- 1 | function renameLibLinks(mdl,origLibBlockName,newLibBlockName) 2 | % RENAMELIBLINKS(model, orignalLibraryBlockName, newLibraryBlockName) 3 | % This function will parse through the model for all blocks which are 4 | % linked to originalLibraryBlockName and replace their link with 5 | % newLibraryBLockName 6 | % 7 | % eg. >> renameLibLinks(gcs,'Control/PID Controller','Coordinates/LLA to Flat Earth with Init Pos') 8 | % 9 | % Copyright 2018 The MathWorks, Inc. 10 | 11 | %% Load Model 12 | system = load_system(mdl); 13 | origRefBlock = [origLibBlockName,'.*']; 14 | newRefBlock = newLibBlockName; 15 | blocks = find_system(system,'FollowLinks','on',... 16 | 'LookUnderMasks','on',... 17 | 'RegExp','on',... 18 | 'LinkStatus','resolved',... 19 | 'ReferenceBlock',origRefBlock); 20 | % Unlock Lib Link 21 | set_param(mdl, 'LockLinksToLibrary', 'off') 22 | %% Find lib and rename 23 | for i=1:numel(blocks) 24 | set_param(blocks(i),'ReferenceBlock',newRefBlock); 25 | end 26 | end -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021, The MathWorks, Inc. 2 | All rights reserved. 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 5 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 6 | 3. In all cases, the software is, and all modifications and derivatives of the software shall be, licensed to you solely for use in conjunction with MathWorks products and service offerings. 7 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /models/Autopilot/models/AutopilotControlSystem.slmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/AutopilotControlSystem.slmx -------------------------------------------------------------------------------- /models/Autopilot/models/AutopilotControlSystem.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/AutopilotControlSystem.slx -------------------------------------------------------------------------------- /models/Autopilot/models/Guidance/DirectCommands.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/Guidance/DirectCommands.slx -------------------------------------------------------------------------------- /models/Autopilot/models/Guidance/Orbit.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/Guidance/Orbit.slx -------------------------------------------------------------------------------- /models/Autopilot/models/Guidance/RTB_FollowMobile.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/Guidance/RTB_FollowMobile.slx -------------------------------------------------------------------------------- /models/Autopilot/models/Guidance/WP_Guidance.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/Guidance/WP_Guidance.slx -------------------------------------------------------------------------------- /models/Autopilot/models/QGroundControlInterface.slxp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/QGroundControlInterface.slxp -------------------------------------------------------------------------------- /models/Autopilot/models/QGroundControlInterface_unix.slxp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/QGroundControlInterface_unix.slxp -------------------------------------------------------------------------------- /models/Autopilot/models/raspiAutopilotControlSystem.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/raspiAutopilotControlSystem.slx -------------------------------------------------------------------------------- /models/Autopilot/models/raspiHostFlightGearVisualization.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/models/raspiHostFlightGearVisualization.slx -------------------------------------------------------------------------------- /models/Autopilot/qgc/qgcGains.params: -------------------------------------------------------------------------------- 1 | # Onboard parameters for Vehicle 5 2 | # 3 | # Vehicle-Id Component-Id Name Value Type 4 | 5 1 CMDS_FOLLOW 0.000000000000000000 9 5 | 5 1 CMDS_GDNC_MD 3.000000000000000000 9 6 | 5 1 CMDS_H_C_MIDL 50.000000000000000000 9 7 | 5 1 CMDS_IS_MAN 0.000000000000000000 9 8 | 5 1 CMDS_PSID_C_M 0.000000000000000000 9 9 | 5 1 CMDS_RTB 1.000000000000000000 9 10 | 5 1 CMDS_U_C 18.000000000000000000 9 11 | 5 1 CMDS_VIEW_IDX 6.000000000000000000 9 12 | 5 1 CTRL_DE_FFWD 0.000000000000000000 9 13 | 5 1 CTRL_DT_FFWD 0.000000000000000000 9 14 | 5 1 CTRL_HE2THE_D 0.000000000000000000 9 15 | 5 1 CTRL_HE2THE_I 0.000000000000000000 9 16 | 5 1 CTRL_HE2THE_P 0.070000000298023224 9 17 | 5 1 CTRL_ROLL_D 0.300000011920928955 9 18 | 5 1 CTRL_ROLL_I 2.000000000000000000 9 19 | 5 1 CTRL_ROLL_P 10.000000000000000000 9 20 | 5 1 CTRL_TH2DT_D 0.000000000000000000 9 21 | 5 1 CTRL_TH2DT_I -0.200000002980232239 9 22 | 5 1 CTRL_TH2DT_P -1.100000023841857910 9 23 | 5 1 CTRL_UHOLD_D 0.000000000000000000 9 24 | 5 1 CTRL_UHOLD_I 0.150000005960464478 9 25 | 5 1 CTRL_UHOLD_P 1.299999952316284180 9 26 | 5 1 CTRL_YAW_D 0.000000000000000000 9 27 | 5 1 CTRL_YAW_I 0.050000000745058060 9 28 | 5 1 CTRL_YAW_P 0.029999999329447746 9 29 | 5 1 GDNC_TSTAR 2.500000000000000000 9 30 | 5 1 GDNC_TURN_LEAD 6.500000000000000000 9 31 | 5 1 SYS_ID 12.000000000000000000 9 32 | -------------------------------------------------------------------------------- /models/Autopilot/qgc/qgcNatickMission.mission: -------------------------------------------------------------------------------- 1 | { 2 | "firmwareType": 0, 3 | "groundStation": "QGroundControl", 4 | "items": [ 5 | { 6 | "autoContinue": true, 7 | "command": 16, 8 | "coordinate": [ 9 | 42.299296856672406, 10 | -71.348616436709364, 11 | 50 12 | ], 13 | "doJumpId": 1, 14 | "frame": 3, 15 | "params": [ 16 | 0, 17 | 0, 18 | 0, 19 | 0 20 | ], 21 | "type": "SimpleItem" 22 | }, 23 | { 24 | "autoContinue": true, 25 | "command": 16, 26 | "coordinate": [ 27 | 42.301317210000001, 28 | -71.348414160000004, 29 | 50 30 | ], 31 | "doJumpId": 2, 32 | "frame": 3, 33 | "params": [ 34 | 0, 35 | 0, 36 | 0, 37 | 0 38 | ], 39 | "type": "SimpleItem" 40 | }, 41 | { 42 | "autoContinue": true, 43 | "command": 16, 44 | "coordinate": [ 45 | 42.299973440000002, 46 | -71.359936039999994, 47 | 50 48 | ], 49 | "doJumpId": 3, 50 | "frame": 3, 51 | "params": [ 52 | 0, 53 | 0, 54 | 0, 55 | 0 56 | ], 57 | "type": "SimpleItem" 58 | }, 59 | { 60 | "autoContinue": true, 61 | "command": 16, 62 | "coordinate": [ 63 | 42.298612640000002, 64 | -71.370538010000004, 65 | 50 66 | ], 67 | "doJumpId": 4, 68 | "frame": 3, 69 | "params": [ 70 | 0, 71 | 0, 72 | 0, 73 | 0 74 | ], 75 | "type": "SimpleItem" 76 | }, 77 | { 78 | "autoContinue": true, 79 | "command": 16, 80 | "coordinate": [ 81 | 42.300415700000002, 82 | -71.374447630000006, 83 | 50 84 | ], 85 | "doJumpId": 5, 86 | "frame": 3, 87 | "params": [ 88 | 0, 89 | 0, 90 | 0, 91 | 0 92 | ], 93 | "type": "SimpleItem" 94 | }, 95 | { 96 | "autoContinue": true, 97 | "command": 16, 98 | "coordinate": [ 99 | 42.295329580000001, 100 | -71.374033670000003, 101 | 50 102 | ], 103 | "doJumpId": 6, 104 | "frame": 3, 105 | "params": [ 106 | 0, 107 | 0, 108 | 0, 109 | 0 110 | ], 111 | "type": "SimpleItem" 112 | }, 113 | { 114 | "autoContinue": true, 115 | "command": 16, 116 | "coordinate": [ 117 | 42.28781217734479, 118 | -71.375506888940762, 119 | 50 120 | ], 121 | "doJumpId": 7, 122 | "frame": 3, 123 | "params": [ 124 | 0, 125 | 0, 126 | 0, 127 | 0 128 | ], 129 | "type": "SimpleItem" 130 | }, 131 | { 132 | "autoContinue": true, 133 | "command": 16, 134 | "coordinate": [ 135 | 42.282230509999998, 136 | -71.363622530000001, 137 | 50 138 | ], 139 | "doJumpId": 8, 140 | "frame": 3, 141 | "params": [ 142 | 0, 143 | 0, 144 | 0, 145 | 0 146 | ], 147 | "type": "SimpleItem" 148 | }, 149 | { 150 | "autoContinue": true, 151 | "command": 16, 152 | "coordinate": [ 153 | 42.289897259999996, 154 | -71.355226909999999, 155 | 50 156 | ], 157 | "doJumpId": 9, 158 | "frame": 3, 159 | "params": [ 160 | 0, 161 | 0, 162 | 0, 163 | 0 164 | ], 165 | "type": "SimpleItem" 166 | } 167 | ], 168 | "plannedHomePosition": [ 169 | 42.299640599999996, 170 | -71.351776099999995, 171 | 0 172 | ], 173 | "version": 2 174 | } 175 | -------------------------------------------------------------------------------- /models/Autopilot/qgc/qgcShortNatickMission.mission: -------------------------------------------------------------------------------- 1 | { 2 | "firmwareType": 0, 3 | "groundStation": "QGroundControl", 4 | "items": [ 5 | { 6 | "autoContinue": true, 7 | "command": 16, 8 | "coordinate": [ 9 | 42.298556818076655, 10 | -71.345583219507802, 11 | 50 12 | ], 13 | "doJumpId": 1, 14 | "frame": 3, 15 | "params": [ 16 | 0, 17 | 0, 18 | 0, 19 | 0 20 | ], 21 | "type": "SimpleItem" 22 | }, 23 | { 24 | "autoContinue": true, 25 | "command": 16, 26 | "coordinate": [ 27 | 42.301444343102006, 28 | -71.345852984878093, 29 | 50 30 | ], 31 | "doJumpId": 2, 32 | "frame": 3, 33 | "params": [ 34 | 0, 35 | 0, 36 | 0, 37 | 0 38 | ], 39 | "type": "SimpleItem" 40 | }, 41 | { 42 | "autoContinue": true, 43 | "command": 16, 44 | "coordinate": [ 45 | 42.301058562760041, 46 | -71.351316677588457, 47 | 50 48 | ], 49 | "doJumpId": 3, 50 | "frame": 3, 51 | "params": [ 52 | 0, 53 | 0, 54 | 0, 55 | 0 56 | ], 57 | "type": "SimpleItem" 58 | }, 59 | { 60 | "autoContinue": true, 61 | "command": 16, 62 | "coordinate": [ 63 | 42.304239569920902, 64 | -71.35198014566771, 65 | 50 66 | ], 67 | "doJumpId": 4, 68 | "frame": 3, 69 | "params": [ 70 | 0, 71 | 0, 72 | 0, 73 | 0 74 | ], 75 | "type": "SimpleItem" 76 | }, 77 | { 78 | "autoContinue": true, 79 | "command": 16, 80 | "coordinate": [ 81 | 42.303535676246376, 82 | -71.36013036491687, 83 | 50 84 | ], 85 | "doJumpId": 5, 86 | "frame": 3, 87 | "params": [ 88 | 0, 89 | 0, 90 | 0, 91 | 0 92 | ], 93 | "type": "SimpleItem" 94 | }, 95 | { 96 | "autoContinue": true, 97 | "command": 16, 98 | "coordinate": [ 99 | 42.298824890564518, 100 | -71.359474704431463, 101 | 50 102 | ], 103 | "doJumpId": 6, 104 | "frame": 3, 105 | "params": [ 106 | 0, 107 | 0, 108 | 0, 109 | 0 110 | ], 111 | "type": "SimpleItem" 112 | }, 113 | { 114 | "autoContinue": true, 115 | "command": 16, 116 | "coordinate": [ 117 | 42.299233382468685, 118 | -71.354458346301215, 119 | 50 120 | ], 121 | "doJumpId": 7, 122 | "frame": 3, 123 | "params": [ 124 | 0, 125 | 0, 126 | 0, 127 | 0 128 | ], 129 | "type": "SimpleItem" 130 | }, 131 | { 132 | "autoContinue": true, 133 | "command": 16, 134 | "coordinate": [ 135 | 42.296150344612549, 136 | -71.35380877052549, 137 | 50 138 | ], 139 | "doJumpId": 8, 140 | "frame": 3, 141 | "params": [ 142 | 0, 143 | 0, 144 | 0, 145 | 0 146 | ], 147 | "type": "SimpleItem" 148 | }, 149 | { 150 | "autoContinue": true, 151 | "command": 16, 152 | "coordinate": [ 153 | 42.296842528794869, 154 | -71.345456422327047, 155 | 50 156 | ], 157 | "doJumpId": 9, 158 | "frame": 3, 159 | "params": [ 160 | 0, 161 | 0, 162 | 0, 163 | 0 164 | ], 165 | "type": "SimpleItem" 166 | } 167 | ], 168 | "plannedHomePosition": [ 169 | 42.299640599999996, 170 | -71.351776099999995, 171 | 0 172 | ], 173 | "version": 2 174 | } 175 | -------------------------------------------------------------------------------- /models/Autopilot/qgc/qgcSimulinkWidget.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * QML QGC Widget to Control a Simulink Model 3 | * Copyright 2018 The MathWorks, Inc. 4 | * 5 | ****************************************************************************/ 6 | 7 | 8 | import QtQuick 2.5 9 | import QtQuick.Controls 1.4 10 | 11 | import QGroundControl.FactSystem 1.0 12 | import QGroundControl.FactControls 1.0 13 | import QGroundControl.Palette 1.0 14 | import QGroundControl.Controls 1.0 15 | import QGroundControl.ScreenTools 1.0 16 | 17 | SetupPage { 18 | id: simulinkController 19 | pageComponent: simulinkControllerComponent 20 | 21 | Component { 22 | id: simulinkControllerComponent 23 | 24 | Column { 25 | width: availableWidth 26 | spacing: _margins 27 | 28 | FactPanelController { id: controller; factPanel: simulinkController.viewPanel } 29 | 30 | QGCPalette { id: palette; colorGroupEnabled: true } 31 | 32 | property Fact _U_c: controller.getParameterFact(-1, "CMDS_U_C") 33 | property Fact _h_c_midLevel: controller.getParameterFact(-1, "CMDS_H_C_MIDL") 34 | property Fact _psiDot_c_midLevel: controller.getParameterFact(-1, "CMDS_PSID_C_M") 35 | property Fact _RTB: controller.getParameterFact(-1, "CMDS_RTB") 36 | property Fact _followMobile: controller.getParameterFact(-1, "CMDS_FOLLOW") 37 | property Fact _isManualModeOn: controller.getParameterFact(-1, "CMDS_IS_MAN") 38 | property Fact _guidanceMode: controller.getParameterFact(-1, "CMDS_GDNC_MD") 39 | property Fact _viewPointIdx: controller.getParameterFact(-1, "CMDS_VIEW_IDX") 40 | 41 | Component.onCompleted: { 42 | // Things to do once launch is completed 43 | 44 | // Set RTB to the right state 45 | rtbSwitch.checked= _RTB.value > 0.0 ? 1: 0 46 | if (rtbSwitch.checked > 0 ) { 47 | sliderLabel.text = qsTr("Click to Continue Mission") 48 | } else { 49 | sliderLabel.text = qsTr("Click to Return To Base") 50 | } 51 | 52 | // Set Guidance mode to the write state 53 | gdncSwitch.checked = _guidanceMode == 2.0 ? 0:1 54 | if (gdncSwitch.checked > 0 ) { 55 | gdncModeLabel.text = qsTr("Click to Switch to Orbit Guidance") 56 | } else { 57 | gdncModeLabel.text = qsTr("Click to Switch to WP Guidance") 58 | } 59 | } 60 | 61 | // Connections { target: _ch7Opt; onValueChanged: calcAutoTuneChannel() } 62 | 63 | 64 | QGCLabel { 65 | id: basicLabel 66 | text: qsTr("Control Simulink Model") 67 | font.family: ScreenTools.demiboldFontFamily 68 | } 69 | 70 | Flow { 71 | id: flowLayout 72 | anchors.left: parent.left 73 | anchors.right: parent.right 74 | spacing: _margins 75 | 76 | Rectangle { 77 | height: rtbLabel.height + rtbRect.height 78 | width: rtbRect.width 79 | color: palette.window 80 | 81 | QGCLabel { 82 | id: rtbLabel 83 | text: qsTr("Ground Station Commands") 84 | font.family: ScreenTools.demiboldFontFamily 85 | } 86 | 87 | Rectangle { 88 | id: rtbRect 89 | width: rtbColumn.x + rtbColumn.width + _margins 90 | height: rtbColumn.y + rtbColumn.height + _margins 91 | anchors.top: rtbLabel.bottom 92 | color: palette.windowShade 93 | 94 | Column { 95 | id: rtbColumn 96 | anchors.margins: _margins 97 | anchors.left: parent.left 98 | anchors.top: parent.top 99 | spacing: _margins 100 | 101 | Row { 102 | spacing: _margins 103 | } 104 | 105 | Row { 106 | spacing: _margins 107 | QGCLabel { 108 | id: sliderLabel 109 | //anchors.baseline: rtbSwitch.baseline 110 | //text: qsTr("Click to Return To Base") 111 | } 112 | 113 | Switch { 114 | id: rtbSwitch 115 | 116 | onClicked:{ 117 | controller.getParameterFact(-1, "CMDS_RTB").value = rtbSwitch.checked 118 | 119 | if (rtbSwitch.checked > 0 ) { 120 | sliderLabel.text = qsTr("Click to Continue Mission") 121 | } else { 122 | sliderLabel.text = qsTr("Click to Return To Base") 123 | } 124 | } 125 | } 126 | } // Row 127 | 128 | 129 | Row { 130 | spacing: _margins 131 | 132 | QGCLabel { 133 | id: gdncModeLabel 134 | //anchors.baseline: rtbSwitch.baseline 135 | //text: qsTr("Click to Return To Base") 136 | } 137 | 138 | Switch { 139 | id: gdncSwitch 140 | 141 | onClicked:{ 142 | 143 | if (gdncSwitch.checked > 0 ) { 144 | controller.getParameterFact(-1, "CMDS_GDNC_MD").value = 2 145 | gdncModeLabel.text = qsTr("Click to Switch to Orbit Guidance") 146 | } else { 147 | controller.getParameterFact(-1, "CMDS_GDNC_MD").value = 3 148 | gdncModeLabel.text = qsTr("Click to Switch to WP Guidance") 149 | } 150 | } // onClicked 151 | } // Switch 152 | }// Row 153 | 154 | Row{ 155 | spacing: _margins 156 | QGCLabel { 157 | id: wpIdxLabel 158 | //anchors.baseline: rtbSwitch.baseline 159 | text: qsTr("Orbit WP Idx") 160 | } 161 | 162 | FactTextField { 163 | id: wpIdx 164 | validator: DoubleValidator {bottom: 1; top: 9;} 165 | fact: controller.getParameterFact(-1, "CMDS_VIEW_IDX") 166 | } 167 | } 168 | 169 | } // Column 170 | } // Rectangle - RTB 171 | } // Rectangle - RTB Label 172 | } // Flow 173 | } // Column 174 | } // Component 175 | } // SetupView 176 | -------------------------------------------------------------------------------- /models/Autopilot/qgc/qgcUCSCWaypoints.mission: -------------------------------------------------------------------------------- 1 | { 2 | "firmwareType": 0, 3 | "groundStation": "QGroundControl", 4 | "items": [ 5 | { 6 | "autoContinue": true, 7 | "command": 16, 8 | "coordinate": [ 9 | 36.9932175, 10 | -122.04241943359, 11 | 50 12 | ], 13 | "doJumpId": 1, 14 | "frame": 3, 15 | "params": [ 16 | 0, 17 | 0, 18 | 0, 19 | 0 20 | ], 21 | "type": "SimpleItem" 22 | }, 23 | { 24 | "autoContinue": true, 25 | "command": 16, 26 | "coordinate": [ 27 | 36.993217468262003, 28 | -122.04887390137, 29 | 50 30 | ], 31 | "doJumpId": 2, 32 | "frame": 3, 33 | "params": [ 34 | 0, 35 | 0, 36 | 0, 37 | 0 38 | ], 39 | "type": "SimpleItem" 40 | }, 41 | { 42 | "autoContinue": true, 43 | "command": 16, 44 | "coordinate": [ 45 | 36.990737915038999, 46 | -122.0488739, 47 | 50 48 | ], 49 | "doJumpId": 3, 50 | "frame": 3, 51 | "params": [ 52 | 0, 53 | 0, 54 | 0, 55 | 0 56 | ], 57 | "type": "SimpleItem" 58 | }, 59 | { 60 | "autoContinue": true, 61 | "command": 16, 62 | "coordinate": [ 63 | 36.990737899999999, 64 | -122.05196380615, 65 | 50 66 | ], 67 | "doJumpId": 4, 68 | "frame": 3, 69 | "params": [ 70 | 0, 71 | 0, 72 | 0, 73 | 0 74 | ], 75 | "type": "SimpleItem" 76 | }, 77 | { 78 | "autoContinue": true, 79 | "command": 16, 80 | "coordinate": [ 81 | 36.9947929, 82 | -122.05196380615, 83 | 50 84 | ], 85 | "doJumpId": 5, 86 | "frame": 3, 87 | "params": [ 88 | 0, 89 | 0, 90 | 0, 91 | 0 92 | ], 93 | "type": "SimpleItem" 94 | }, 95 | { 96 | "autoContinue": true, 97 | "command": 16, 98 | "coordinate": [ 99 | 36.994792938232003, 100 | -122.04241943359, 101 | 50 102 | ], 103 | "doJumpId": 6, 104 | "frame": 3, 105 | "params": [ 106 | 0, 107 | 0, 108 | 0, 109 | 0 110 | ], 111 | "type": "SimpleItem" 112 | } 113 | ], 114 | "plannedHomePosition": [ 115 | 36.989837646483998, 116 | -122.0519638, 117 | 0 118 | ], 119 | "version": 2 120 | } 121 | -------------------------------------------------------------------------------- /models/Autopilot/src/interfaceDefinition.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file interfaceDefinition.h 3 | * @brief Interface Definition of C Structs to Bus mappings for MBDRI 4 | * @author Mariano Lizarraga 5 | * @date February 2017 6 | */ 7 | 8 | #ifndef INTERFACE_DEFINITION_H 9 | #define INTERFACE_DEFINITION_H 10 | 11 | #include 12 | 13 | /** 14 | * @brief Data structure defining a single Waypoint 15 | */ 16 | typedef struct { 17 | double wpPos[3]; /// Lat lon in degrees, H in m ASL 18 | uint8_t wpType; /// Waypoint Type, so far only 1 is used 19 | double wpMetaData; /// Reserved for later 20 | } waypoint; 21 | 22 | /** 23 | * @brief Ground Stattion Commands data structure 24 | */ 25 | typedef struct { 26 | double U_c; /// Airspeed command 27 | double h_c_midLevel; /// Height command - mid level commands 28 | double psiDot_c_midLevel;/// Turn rate command - mid level commands 29 | uint8_t RTB; /// Return to base flag 30 | uint8_t followMobile; /// Follow Mobile GS flag; 31 | uint8_t isManualModeOn; /// Is the AP in manual or auto? 32 | uint8_t guidanceMode; /// Guidance Model for AP 33 | uint8_t viewPointIdx; /// Waypoint to look at when in orbit mode 34 | double MobileLocation[3]; /// Lat, Lon, H of mobile GS. 35 | uint8_t heartbeat; /// Heartbeat value. 36 | } gsCommandsBus; 37 | 38 | /** 39 | * @brief Configuration parameters data structure 40 | */ 41 | typedef struct { 42 | double T_star; /// Optimal turn value 43 | double turnLead; /// Turn lead time 44 | double airspeedHoldPID[3]; /// Airspeed Hold PID values 45 | double dEFeedForward; /// dE Feed Forward term 46 | double he2ThPID[3]; /// Height Error to throttle PID values 47 | double th2dTPID[3]; /// Pitch to dT PID values 48 | double dTFeedForward; /// dT Feed Forward term 49 | double rollControlPID[3]; /// Roll Control PID values 50 | double yawDamperPID[3]; /// Yaw Damper PID values 51 | } apConfigParamsBus; 52 | 53 | /** 54 | * @brief GPS data structure used to hold the five basic data 55 | */ 56 | typedef struct { 57 | double gps_latLon[2]; /// Lat Lon in degrees 58 | double gps_h; /// Height 59 | double gps_cog; /// Course Over Ground 60 | double gps_sog; /// Speed Over Ground 61 | uint8_t gps_fix; /// Fix Type 62 | } gpsReading; 63 | 64 | /** 65 | * @brief Main data structure used to report the Autopilot status 66 | */ 67 | typedef struct { 68 | double Ab[3]; /// Accelration in Body Frame (m/s^2) 69 | double G[3]; /// Gyros (rad/sec) 70 | double Euler[3]; /// Euler Angles (rad) 71 | double ias; /// Indicated air speed (m/s) 72 | double baro; /// Barometric Pressure (Pa) 73 | double Xe[3]; /// LTP UAV Location (m) 74 | double Ve[3]; /// UAV Inertial Velocity (m/s) 75 | gpsReading GPS; /// GPS Lat, Lon, H, COG, SOG, FixType 76 | uint8_t guidanceMode;///Current UAV Guidance guidanceMode 77 | uint8_t currentWp; /// Current WP being navigated to 78 | } apStatusBus; 79 | 80 | typedef struct { 81 | int16_t Euler_raw[3]; /// Euler Angle measurement raw as read from an IMU sensor 82 | int16_t Ab_raw[3]; /// Acceleration measurement raw as read from a MEMS SPI Accelerometer 83 | int16_t G_raw[3]; /// Angular velocity raw as read from a MEMS SPI Gyro 84 | uint16_t q_raw; /// Dynamic pressure as read from a Dynamic Pressure Sensor 85 | uint16_t static_raw; /// Barometric pressure raw as read of a barometer 86 | int16_t T_raw; /// Raw temperature as read of an Analog Thermistor 87 | int16_t ctrlSurface_PWM[5]; /// Ctrl Surface PWM commands in raw as read by a IC peripheral 88 | }rawSensorDataBus; 89 | 90 | typedef struct { 91 | double elevatorCmd; /// Elevator Cmd in Radians 92 | double throttleCmd; /// Throttle Cmd in % 0-1 93 | double aileronCmd; /// Aileron Cmd in Radians 94 | double rudderCmd; /// Rudder Cmd in Radians 95 | double flapCmd; /// Flap Cmd in Radians 96 | } ctrlCmdsBus; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/checksum.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | // Visual Studio versions before 2010 don't have stdint.h, so we just error out. 8 | #if (defined _MSC_VER) && (_MSC_VER < 1600) 9 | #error "The C-MAVLink implementation requires Visual Studio 2010 or greater" 10 | #endif 11 | 12 | #include 13 | 14 | /** 15 | * 16 | * CALCULATE THE CHECKSUM 17 | * 18 | */ 19 | 20 | #define X25_INIT_CRC 0xffff 21 | #define X25_VALIDATE_CRC 0xf0b8 22 | 23 | #ifndef HAVE_CRC_ACCUMULATE 24 | /** 25 | * @brief Accumulate the X.25 CRC by adding one char at a time. 26 | * 27 | * The checksum function adds the hash of one char at a time to the 28 | * 16 bit checksum (uint16_t). 29 | * 30 | * @param data new char to hash 31 | * @param crcAccum the already accumulated checksum 32 | **/ 33 | static inline void crc_accumulate(uint8_t data, uint16_t *crcAccum) 34 | { 35 | /*Accumulate one byte of data into the CRC*/ 36 | uint8_t tmp; 37 | 38 | tmp = data ^ (uint8_t)(*crcAccum &0xff); 39 | tmp ^= (tmp<<4); 40 | *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4); 41 | } 42 | #endif 43 | 44 | 45 | /** 46 | * @brief Initiliaze the buffer for the X.25 CRC 47 | * 48 | * @param crcAccum the 16 bit X.25 CRC 49 | */ 50 | static inline void crc_init(uint16_t* crcAccum) 51 | { 52 | *crcAccum = X25_INIT_CRC; 53 | } 54 | 55 | 56 | /** 57 | * @brief Calculates the X.25 checksum on a byte buffer 58 | * 59 | * @param pBuffer buffer containing the byte array to hash 60 | * @param length length of the byte array 61 | * @return the checksum over the buffer bytes 62 | **/ 63 | static inline uint16_t crc_calculate(const uint8_t* pBuffer, uint16_t length) 64 | { 65 | uint16_t crcTmp; 66 | crc_init(&crcTmp); 67 | while (length--) { 68 | crc_accumulate(*pBuffer++, &crcTmp); 69 | } 70 | return crcTmp; 71 | } 72 | 73 | 74 | /** 75 | * @brief Accumulate the X.25 CRC by adding an array of bytes 76 | * 77 | * The checksum function adds the hash of one char at a time to the 78 | * 16 bit checksum (uint16_t). 79 | * 80 | * @param data new bytes to hash 81 | * @param crcAccum the already accumulated checksum 82 | **/ 83 | static inline void crc_accumulate_buffer(uint16_t *crcAccum, const char *pBuffer, uint16_t length) 84 | { 85 | const uint8_t *p = (const uint8_t *)pBuffer; 86 | while (length--) { 87 | crc_accumulate(*p++, crcAccum); 88 | } 89 | } 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | * @brief MAVLink comm protocol built from common.xml 3 | * @see http://mavlink.org 4 | */ 5 | #pragma once 6 | #ifndef MAVLINK_H 7 | #define MAVLINK_H 8 | 9 | #define MAVLINK_PRIMARY_XML_IDX 1 10 | 11 | #ifndef MAVLINK_STX 12 | #define MAVLINK_STX 253 13 | #endif 14 | 15 | #ifndef MAVLINK_ENDIAN 16 | #define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN 17 | #endif 18 | 19 | #ifndef MAVLINK_ALIGNED_FIELDS 20 | #define MAVLINK_ALIGNED_FIELDS 1 21 | #endif 22 | 23 | #ifndef MAVLINK_CRC_EXTRA 24 | #define MAVLINK_CRC_EXTRA 1 25 | #endif 26 | 27 | #ifndef MAVLINK_COMMAND_24BIT 28 | #define MAVLINK_COMMAND_24BIT 1 29 | #endif 30 | 31 | #include "version.h" 32 | #include "common.h" 33 | 34 | #endif // MAVLINK_H 35 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_auth_key.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE AUTH_KEY PACKING 3 | 4 | #define MAVLINK_MSG_ID_AUTH_KEY 7 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_auth_key_t { 8 | char key[32]; /*< key*/ 9 | }) mavlink_auth_key_t; 10 | 11 | #define MAVLINK_MSG_ID_AUTH_KEY_LEN 32 12 | #define MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN 32 13 | #define MAVLINK_MSG_ID_7_LEN 32 14 | #define MAVLINK_MSG_ID_7_MIN_LEN 32 15 | 16 | #define MAVLINK_MSG_ID_AUTH_KEY_CRC 119 17 | #define MAVLINK_MSG_ID_7_CRC 119 18 | 19 | #define MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN 32 20 | 21 | #if MAVLINK_COMMAND_24BIT 22 | #define MAVLINK_MESSAGE_INFO_AUTH_KEY { \ 23 | 7, \ 24 | "AUTH_KEY", \ 25 | 1, \ 26 | { { "key", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_auth_key_t, key) }, \ 27 | } \ 28 | } 29 | #else 30 | #define MAVLINK_MESSAGE_INFO_AUTH_KEY { \ 31 | "AUTH_KEY", \ 32 | 1, \ 33 | { { "key", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_auth_key_t, key) }, \ 34 | } \ 35 | } 36 | #endif 37 | 38 | /** 39 | * @brief Pack a auth_key message 40 | * @param system_id ID of this system 41 | * @param component_id ID of this component (e.g. 200 for IMU) 42 | * @param msg The MAVLink message to compress the data into 43 | * 44 | * @param key key 45 | * @return length of the message in bytes (excluding serial stream start sign) 46 | */ 47 | static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 48 | const char *key) 49 | { 50 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 51 | char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN]; 52 | 53 | _mav_put_char_array(buf, 0, key, 32); 54 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTH_KEY_LEN); 55 | #else 56 | mavlink_auth_key_t packet; 57 | 58 | mav_array_memcpy(packet.key, key, sizeof(char)*32); 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN); 60 | #endif 61 | 62 | msg->msgid = MAVLINK_MSG_ID_AUTH_KEY; 63 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 64 | } 65 | 66 | /** 67 | * @brief Pack a auth_key message on a channel 68 | * @param system_id ID of this system 69 | * @param component_id ID of this component (e.g. 200 for IMU) 70 | * @param chan The MAVLink channel this message will be sent over 71 | * @param msg The MAVLink message to compress the data into 72 | * @param key key 73 | * @return length of the message in bytes (excluding serial stream start sign) 74 | */ 75 | static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 76 | mavlink_message_t* msg, 77 | const char *key) 78 | { 79 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 80 | char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN]; 81 | 82 | _mav_put_char_array(buf, 0, key, 32); 83 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTH_KEY_LEN); 84 | #else 85 | mavlink_auth_key_t packet; 86 | 87 | mav_array_memcpy(packet.key, key, sizeof(char)*32); 88 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTH_KEY_LEN); 89 | #endif 90 | 91 | msg->msgid = MAVLINK_MSG_ID_AUTH_KEY; 92 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 93 | } 94 | 95 | /** 96 | * @brief Encode a auth_key struct 97 | * 98 | * @param system_id ID of this system 99 | * @param component_id ID of this component (e.g. 200 for IMU) 100 | * @param msg The MAVLink message to compress the data into 101 | * @param auth_key C-struct to read the message contents from 102 | */ 103 | static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key) 104 | { 105 | return mavlink_msg_auth_key_pack(system_id, component_id, msg, auth_key->key); 106 | } 107 | 108 | /** 109 | * @brief Encode a auth_key struct on a channel 110 | * 111 | * @param system_id ID of this system 112 | * @param component_id ID of this component (e.g. 200 for IMU) 113 | * @param chan The MAVLink channel this message will be sent over 114 | * @param msg The MAVLink message to compress the data into 115 | * @param auth_key C-struct to read the message contents from 116 | */ 117 | static inline uint16_t mavlink_msg_auth_key_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key) 118 | { 119 | return mavlink_msg_auth_key_pack_chan(system_id, component_id, chan, msg, auth_key->key); 120 | } 121 | 122 | /** 123 | * @brief Send a auth_key message 124 | * @param chan MAVLink channel to send the message 125 | * 126 | * @param key key 127 | */ 128 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 129 | 130 | static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char *key) 131 | { 132 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 133 | char buf[MAVLINK_MSG_ID_AUTH_KEY_LEN]; 134 | 135 | _mav_put_char_array(buf, 0, key, 32); 136 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 137 | #else 138 | mavlink_auth_key_t packet; 139 | 140 | mav_array_memcpy(packet.key, key, sizeof(char)*32); 141 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 142 | #endif 143 | } 144 | 145 | /** 146 | * @brief Send a auth_key message 147 | * @param chan MAVLink channel to send the message 148 | * @param struct The MAVLink struct to serialize 149 | */ 150 | static inline void mavlink_msg_auth_key_send_struct(mavlink_channel_t chan, const mavlink_auth_key_t* auth_key) 151 | { 152 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 153 | mavlink_msg_auth_key_send(chan, auth_key->key); 154 | #else 155 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)auth_key, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 156 | #endif 157 | } 158 | 159 | #if MAVLINK_MSG_ID_AUTH_KEY_LEN <= MAVLINK_MAX_PAYLOAD_LEN 160 | /* 161 | This varient of _send() can be used to save stack space by re-using 162 | memory from the receive buffer. The caller provides a 163 | mavlink_message_t which is the size of a full mavlink message. This 164 | is usually the receive buffer for the channel, and allows a reply to an 165 | incoming message with minimum stack space usage. 166 | */ 167 | static inline void mavlink_msg_auth_key_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *key) 168 | { 169 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 170 | char *buf = (char *)msgbuf; 171 | 172 | _mav_put_char_array(buf, 0, key, 32); 173 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 174 | #else 175 | mavlink_auth_key_t *packet = (mavlink_auth_key_t *)msgbuf; 176 | 177 | mav_array_memcpy(packet->key, key, sizeof(char)*32); 178 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)packet, MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN, MAVLINK_MSG_ID_AUTH_KEY_LEN, MAVLINK_MSG_ID_AUTH_KEY_CRC); 179 | #endif 180 | } 181 | #endif 182 | 183 | #endif 184 | 185 | // MESSAGE AUTH_KEY UNPACKING 186 | 187 | 188 | /** 189 | * @brief Get field key from auth_key message 190 | * 191 | * @return key 192 | */ 193 | static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg, char *key) 194 | { 195 | return _MAV_RETURN_char_array(msg, key, 32, 0); 196 | } 197 | 198 | /** 199 | * @brief Decode a auth_key message into a struct 200 | * 201 | * @param msg The message to decode 202 | * @param auth_key C-struct to decode the message contents into 203 | */ 204 | static inline void mavlink_msg_auth_key_decode(const mavlink_message_t* msg, mavlink_auth_key_t* auth_key) 205 | { 206 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 207 | mavlink_msg_auth_key_get_key(msg, auth_key->key); 208 | #else 209 | uint8_t len = msg->len < MAVLINK_MSG_ID_AUTH_KEY_LEN? msg->len : MAVLINK_MSG_ID_AUTH_KEY_LEN; 210 | memset(auth_key, 0, MAVLINK_MSG_ID_AUTH_KEY_LEN); 211 | memcpy(auth_key, _MAV_PAYLOAD(msg), len); 212 | #endif 213 | } 214 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_command_ack.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE COMMAND_ACK PACKING 3 | 4 | #define MAVLINK_MSG_ID_COMMAND_ACK 77 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_command_ack_t { 8 | uint16_t command; /*< Command ID, as defined by MAV_CMD enum.*/ 9 | uint8_t result; /*< See MAV_RESULT enum*/ 10 | }) mavlink_command_ack_t; 11 | 12 | #define MAVLINK_MSG_ID_COMMAND_ACK_LEN 3 13 | #define MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN 3 14 | #define MAVLINK_MSG_ID_77_LEN 3 15 | #define MAVLINK_MSG_ID_77_MIN_LEN 3 16 | 17 | #define MAVLINK_MSG_ID_COMMAND_ACK_CRC 143 18 | #define MAVLINK_MSG_ID_77_CRC 143 19 | 20 | 21 | 22 | #if MAVLINK_COMMAND_24BIT 23 | #define MAVLINK_MESSAGE_INFO_COMMAND_ACK { \ 24 | 77, \ 25 | "COMMAND_ACK", \ 26 | 2, \ 27 | { { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_command_ack_t, command) }, \ 28 | { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_command_ack_t, result) }, \ 29 | } \ 30 | } 31 | #else 32 | #define MAVLINK_MESSAGE_INFO_COMMAND_ACK { \ 33 | "COMMAND_ACK", \ 34 | 2, \ 35 | { { "command", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_command_ack_t, command) }, \ 36 | { "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_command_ack_t, result) }, \ 37 | } \ 38 | } 39 | #endif 40 | 41 | /** 42 | * @brief Pack a command_ack message 43 | * @param system_id ID of this system 44 | * @param component_id ID of this component (e.g. 200 for IMU) 45 | * @param msg The MAVLink message to compress the data into 46 | * 47 | * @param command Command ID, as defined by MAV_CMD enum. 48 | * @param result See MAV_RESULT enum 49 | * @return length of the message in bytes (excluding serial stream start sign) 50 | */ 51 | static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 52 | uint16_t command, uint8_t result) 53 | { 54 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 55 | char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN]; 56 | _mav_put_uint16_t(buf, 0, command); 57 | _mav_put_uint8_t(buf, 2, result); 58 | 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN); 60 | #else 61 | mavlink_command_ack_t packet; 62 | packet.command = command; 63 | packet.result = result; 64 | 65 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN); 66 | #endif 67 | 68 | msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK; 69 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 70 | } 71 | 72 | /** 73 | * @brief Pack a command_ack message on a channel 74 | * @param system_id ID of this system 75 | * @param component_id ID of this component (e.g. 200 for IMU) 76 | * @param chan The MAVLink channel this message will be sent over 77 | * @param msg The MAVLink message to compress the data into 78 | * @param command Command ID, as defined by MAV_CMD enum. 79 | * @param result See MAV_RESULT enum 80 | * @return length of the message in bytes (excluding serial stream start sign) 81 | */ 82 | static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 83 | mavlink_message_t* msg, 84 | uint16_t command,uint8_t result) 85 | { 86 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 87 | char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN]; 88 | _mav_put_uint16_t(buf, 0, command); 89 | _mav_put_uint8_t(buf, 2, result); 90 | 91 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_COMMAND_ACK_LEN); 92 | #else 93 | mavlink_command_ack_t packet; 94 | packet.command = command; 95 | packet.result = result; 96 | 97 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_COMMAND_ACK_LEN); 98 | #endif 99 | 100 | msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK; 101 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 102 | } 103 | 104 | /** 105 | * @brief Encode a command_ack struct 106 | * 107 | * @param system_id ID of this system 108 | * @param component_id ID of this component (e.g. 200 for IMU) 109 | * @param msg The MAVLink message to compress the data into 110 | * @param command_ack C-struct to read the message contents from 111 | */ 112 | static inline uint16_t mavlink_msg_command_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack) 113 | { 114 | return mavlink_msg_command_ack_pack(system_id, component_id, msg, command_ack->command, command_ack->result); 115 | } 116 | 117 | /** 118 | * @brief Encode a command_ack struct on a channel 119 | * 120 | * @param system_id ID of this system 121 | * @param component_id ID of this component (e.g. 200 for IMU) 122 | * @param chan The MAVLink channel this message will be sent over 123 | * @param msg The MAVLink message to compress the data into 124 | * @param command_ack C-struct to read the message contents from 125 | */ 126 | static inline uint16_t mavlink_msg_command_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack) 127 | { 128 | return mavlink_msg_command_ack_pack_chan(system_id, component_id, chan, msg, command_ack->command, command_ack->result); 129 | } 130 | 131 | /** 132 | * @brief Send a command_ack message 133 | * @param chan MAVLink channel to send the message 134 | * 135 | * @param command Command ID, as defined by MAV_CMD enum. 136 | * @param result See MAV_RESULT enum 137 | */ 138 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 139 | 140 | static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, uint16_t command, uint8_t result) 141 | { 142 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 143 | char buf[MAVLINK_MSG_ID_COMMAND_ACK_LEN]; 144 | _mav_put_uint16_t(buf, 0, command); 145 | _mav_put_uint8_t(buf, 2, result); 146 | 147 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 148 | #else 149 | mavlink_command_ack_t packet; 150 | packet.command = command; 151 | packet.result = result; 152 | 153 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)&packet, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 154 | #endif 155 | } 156 | 157 | /** 158 | * @brief Send a command_ack message 159 | * @param chan MAVLink channel to send the message 160 | * @param struct The MAVLink struct to serialize 161 | */ 162 | static inline void mavlink_msg_command_ack_send_struct(mavlink_channel_t chan, const mavlink_command_ack_t* command_ack) 163 | { 164 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 165 | mavlink_msg_command_ack_send(chan, command_ack->command, command_ack->result); 166 | #else 167 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)command_ack, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 168 | #endif 169 | } 170 | 171 | #if MAVLINK_MSG_ID_COMMAND_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN 172 | /* 173 | This varient of _send() can be used to save stack space by re-using 174 | memory from the receive buffer. The caller provides a 175 | mavlink_message_t which is the size of a full mavlink message. This 176 | is usually the receive buffer for the channel, and allows a reply to an 177 | incoming message with minimum stack space usage. 178 | */ 179 | static inline void mavlink_msg_command_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t command, uint8_t result) 180 | { 181 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 182 | char *buf = (char *)msgbuf; 183 | _mav_put_uint16_t(buf, 0, command); 184 | _mav_put_uint8_t(buf, 2, result); 185 | 186 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 187 | #else 188 | mavlink_command_ack_t *packet = (mavlink_command_ack_t *)msgbuf; 189 | packet->command = command; 190 | packet->result = result; 191 | 192 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)packet, MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN, MAVLINK_MSG_ID_COMMAND_ACK_LEN, MAVLINK_MSG_ID_COMMAND_ACK_CRC); 193 | #endif 194 | } 195 | #endif 196 | 197 | #endif 198 | 199 | // MESSAGE COMMAND_ACK UNPACKING 200 | 201 | 202 | /** 203 | * @brief Get field command from command_ack message 204 | * 205 | * @return Command ID, as defined by MAV_CMD enum. 206 | */ 207 | static inline uint16_t mavlink_msg_command_ack_get_command(const mavlink_message_t* msg) 208 | { 209 | return _MAV_RETURN_uint16_t(msg, 0); 210 | } 211 | 212 | /** 213 | * @brief Get field result from command_ack message 214 | * 215 | * @return See MAV_RESULT enum 216 | */ 217 | static inline uint8_t mavlink_msg_command_ack_get_result(const mavlink_message_t* msg) 218 | { 219 | return _MAV_RETURN_uint8_t(msg, 2); 220 | } 221 | 222 | /** 223 | * @brief Decode a command_ack message into a struct 224 | * 225 | * @param msg The message to decode 226 | * @param command_ack C-struct to decode the message contents into 227 | */ 228 | static inline void mavlink_msg_command_ack_decode(const mavlink_message_t* msg, mavlink_command_ack_t* command_ack) 229 | { 230 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 231 | command_ack->command = mavlink_msg_command_ack_get_command(msg); 232 | command_ack->result = mavlink_msg_command_ack_get_result(msg); 233 | #else 234 | uint8_t len = msg->len < MAVLINK_MSG_ID_COMMAND_ACK_LEN? msg->len : MAVLINK_MSG_ID_COMMAND_ACK_LEN; 235 | memset(command_ack, 0, MAVLINK_MSG_ID_COMMAND_ACK_LEN); 236 | memcpy(command_ack, _MAV_PAYLOAD(msg), len); 237 | #endif 238 | } 239 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_mission_current.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE MISSION_CURRENT PACKING 3 | 4 | #define MAVLINK_MSG_ID_MISSION_CURRENT 42 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_mission_current_t { 8 | uint16_t seq; /*< Sequence*/ 9 | }) mavlink_mission_current_t; 10 | 11 | #define MAVLINK_MSG_ID_MISSION_CURRENT_LEN 2 12 | #define MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN 2 13 | #define MAVLINK_MSG_ID_42_LEN 2 14 | #define MAVLINK_MSG_ID_42_MIN_LEN 2 15 | 16 | #define MAVLINK_MSG_ID_MISSION_CURRENT_CRC 28 17 | #define MAVLINK_MSG_ID_42_CRC 28 18 | 19 | 20 | 21 | #if MAVLINK_COMMAND_24BIT 22 | #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \ 23 | 42, \ 24 | "MISSION_CURRENT", \ 25 | 1, \ 26 | { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \ 27 | } \ 28 | } 29 | #else 30 | #define MAVLINK_MESSAGE_INFO_MISSION_CURRENT { \ 31 | "MISSION_CURRENT", \ 32 | 1, \ 33 | { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_current_t, seq) }, \ 34 | } \ 35 | } 36 | #endif 37 | 38 | /** 39 | * @brief Pack a mission_current message 40 | * @param system_id ID of this system 41 | * @param component_id ID of this component (e.g. 200 for IMU) 42 | * @param msg The MAVLink message to compress the data into 43 | * 44 | * @param seq Sequence 45 | * @return length of the message in bytes (excluding serial stream start sign) 46 | */ 47 | static inline uint16_t mavlink_msg_mission_current_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 48 | uint16_t seq) 49 | { 50 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 51 | char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; 52 | _mav_put_uint16_t(buf, 0, seq); 53 | 54 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); 55 | #else 56 | mavlink_mission_current_t packet; 57 | packet.seq = seq; 58 | 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); 60 | #endif 61 | 62 | msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT; 63 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 64 | } 65 | 66 | /** 67 | * @brief Pack a mission_current message on a channel 68 | * @param system_id ID of this system 69 | * @param component_id ID of this component (e.g. 200 for IMU) 70 | * @param chan The MAVLink channel this message will be sent over 71 | * @param msg The MAVLink message to compress the data into 72 | * @param seq Sequence 73 | * @return length of the message in bytes (excluding serial stream start sign) 74 | */ 75 | static inline uint16_t mavlink_msg_mission_current_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 76 | mavlink_message_t* msg, 77 | uint16_t seq) 78 | { 79 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 80 | char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; 81 | _mav_put_uint16_t(buf, 0, seq); 82 | 83 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); 84 | #else 85 | mavlink_mission_current_t packet; 86 | packet.seq = seq; 87 | 88 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); 89 | #endif 90 | 91 | msg->msgid = MAVLINK_MSG_ID_MISSION_CURRENT; 92 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 93 | } 94 | 95 | /** 96 | * @brief Encode a mission_current struct 97 | * 98 | * @param system_id ID of this system 99 | * @param component_id ID of this component (e.g. 200 for IMU) 100 | * @param msg The MAVLink message to compress the data into 101 | * @param mission_current C-struct to read the message contents from 102 | */ 103 | static inline uint16_t mavlink_msg_mission_current_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current) 104 | { 105 | return mavlink_msg_mission_current_pack(system_id, component_id, msg, mission_current->seq); 106 | } 107 | 108 | /** 109 | * @brief Encode a mission_current struct on a channel 110 | * 111 | * @param system_id ID of this system 112 | * @param component_id ID of this component (e.g. 200 for IMU) 113 | * @param chan The MAVLink channel this message will be sent over 114 | * @param msg The MAVLink message to compress the data into 115 | * @param mission_current C-struct to read the message contents from 116 | */ 117 | static inline uint16_t mavlink_msg_mission_current_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_current_t* mission_current) 118 | { 119 | return mavlink_msg_mission_current_pack_chan(system_id, component_id, chan, msg, mission_current->seq); 120 | } 121 | 122 | /** 123 | * @brief Send a mission_current message 124 | * @param chan MAVLink channel to send the message 125 | * 126 | * @param seq Sequence 127 | */ 128 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 129 | 130 | static inline void mavlink_msg_mission_current_send(mavlink_channel_t chan, uint16_t seq) 131 | { 132 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 133 | char buf[MAVLINK_MSG_ID_MISSION_CURRENT_LEN]; 134 | _mav_put_uint16_t(buf, 0, seq); 135 | 136 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 137 | #else 138 | mavlink_mission_current_t packet; 139 | packet.seq = seq; 140 | 141 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 142 | #endif 143 | } 144 | 145 | /** 146 | * @brief Send a mission_current message 147 | * @param chan MAVLink channel to send the message 148 | * @param struct The MAVLink struct to serialize 149 | */ 150 | static inline void mavlink_msg_mission_current_send_struct(mavlink_channel_t chan, const mavlink_mission_current_t* mission_current) 151 | { 152 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 153 | mavlink_msg_mission_current_send(chan, mission_current->seq); 154 | #else 155 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)mission_current, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 156 | #endif 157 | } 158 | 159 | #if MAVLINK_MSG_ID_MISSION_CURRENT_LEN <= MAVLINK_MAX_PAYLOAD_LEN 160 | /* 161 | This varient of _send() can be used to save stack space by re-using 162 | memory from the receive buffer. The caller provides a 163 | mavlink_message_t which is the size of a full mavlink message. This 164 | is usually the receive buffer for the channel, and allows a reply to an 165 | incoming message with minimum stack space usage. 166 | */ 167 | static inline void mavlink_msg_mission_current_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq) 168 | { 169 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 170 | char *buf = (char *)msgbuf; 171 | _mav_put_uint16_t(buf, 0, seq); 172 | 173 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, buf, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 174 | #else 175 | mavlink_mission_current_t *packet = (mavlink_mission_current_t *)msgbuf; 176 | packet->seq = seq; 177 | 178 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CURRENT, (const char *)packet, MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_LEN, MAVLINK_MSG_ID_MISSION_CURRENT_CRC); 179 | #endif 180 | } 181 | #endif 182 | 183 | #endif 184 | 185 | // MESSAGE MISSION_CURRENT UNPACKING 186 | 187 | 188 | /** 189 | * @brief Get field seq from mission_current message 190 | * 191 | * @return Sequence 192 | */ 193 | static inline uint16_t mavlink_msg_mission_current_get_seq(const mavlink_message_t* msg) 194 | { 195 | return _MAV_RETURN_uint16_t(msg, 0); 196 | } 197 | 198 | /** 199 | * @brief Decode a mission_current message into a struct 200 | * 201 | * @param msg The message to decode 202 | * @param mission_current C-struct to decode the message contents into 203 | */ 204 | static inline void mavlink_msg_mission_current_decode(const mavlink_message_t* msg, mavlink_mission_current_t* mission_current) 205 | { 206 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 207 | mission_current->seq = mavlink_msg_mission_current_get_seq(msg); 208 | #else 209 | uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CURRENT_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CURRENT_LEN; 210 | memset(mission_current, 0, MAVLINK_MSG_ID_MISSION_CURRENT_LEN); 211 | memcpy(mission_current, _MAV_PAYLOAD(msg), len); 212 | #endif 213 | } 214 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_mission_item_reached.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE MISSION_ITEM_REACHED PACKING 3 | 4 | #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED 46 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_mission_item_reached_t { 8 | uint16_t seq; /*< Sequence*/ 9 | }) mavlink_mission_item_reached_t; 10 | 11 | #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN 2 12 | #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN 2 13 | #define MAVLINK_MSG_ID_46_LEN 2 14 | #define MAVLINK_MSG_ID_46_MIN_LEN 2 15 | 16 | #define MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC 11 17 | #define MAVLINK_MSG_ID_46_CRC 11 18 | 19 | 20 | 21 | #if MAVLINK_COMMAND_24BIT 22 | #define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \ 23 | 46, \ 24 | "MISSION_ITEM_REACHED", \ 25 | 1, \ 26 | { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \ 27 | } \ 28 | } 29 | #else 30 | #define MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED { \ 31 | "MISSION_ITEM_REACHED", \ 32 | 1, \ 33 | { { "seq", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_mission_item_reached_t, seq) }, \ 34 | } \ 35 | } 36 | #endif 37 | 38 | /** 39 | * @brief Pack a mission_item_reached message 40 | * @param system_id ID of this system 41 | * @param component_id ID of this component (e.g. 200 for IMU) 42 | * @param msg The MAVLink message to compress the data into 43 | * 44 | * @param seq Sequence 45 | * @return length of the message in bytes (excluding serial stream start sign) 46 | */ 47 | static inline uint16_t mavlink_msg_mission_item_reached_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 48 | uint16_t seq) 49 | { 50 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 51 | char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN]; 52 | _mav_put_uint16_t(buf, 0, seq); 53 | 54 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); 55 | #else 56 | mavlink_mission_item_reached_t packet; 57 | packet.seq = seq; 58 | 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); 60 | #endif 61 | 62 | msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; 63 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 64 | } 65 | 66 | /** 67 | * @brief Pack a mission_item_reached message on a channel 68 | * @param system_id ID of this system 69 | * @param component_id ID of this component (e.g. 200 for IMU) 70 | * @param chan The MAVLink channel this message will be sent over 71 | * @param msg The MAVLink message to compress the data into 72 | * @param seq Sequence 73 | * @return length of the message in bytes (excluding serial stream start sign) 74 | */ 75 | static inline uint16_t mavlink_msg_mission_item_reached_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 76 | mavlink_message_t* msg, 77 | uint16_t seq) 78 | { 79 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 80 | char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN]; 81 | _mav_put_uint16_t(buf, 0, seq); 82 | 83 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); 84 | #else 85 | mavlink_mission_item_reached_t packet; 86 | packet.seq = seq; 87 | 88 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); 89 | #endif 90 | 91 | msg->msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED; 92 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 93 | } 94 | 95 | /** 96 | * @brief Encode a mission_item_reached struct 97 | * 98 | * @param system_id ID of this system 99 | * @param component_id ID of this component (e.g. 200 for IMU) 100 | * @param msg The MAVLink message to compress the data into 101 | * @param mission_item_reached C-struct to read the message contents from 102 | */ 103 | static inline uint16_t mavlink_msg_mission_item_reached_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached) 104 | { 105 | return mavlink_msg_mission_item_reached_pack(system_id, component_id, msg, mission_item_reached->seq); 106 | } 107 | 108 | /** 109 | * @brief Encode a mission_item_reached struct on a channel 110 | * 111 | * @param system_id ID of this system 112 | * @param component_id ID of this component (e.g. 200 for IMU) 113 | * @param chan The MAVLink channel this message will be sent over 114 | * @param msg The MAVLink message to compress the data into 115 | * @param mission_item_reached C-struct to read the message contents from 116 | */ 117 | static inline uint16_t mavlink_msg_mission_item_reached_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_item_reached_t* mission_item_reached) 118 | { 119 | return mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, chan, msg, mission_item_reached->seq); 120 | } 121 | 122 | /** 123 | * @brief Send a mission_item_reached message 124 | * @param chan MAVLink channel to send the message 125 | * 126 | * @param seq Sequence 127 | */ 128 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 129 | 130 | static inline void mavlink_msg_mission_item_reached_send(mavlink_channel_t chan, uint16_t seq) 131 | { 132 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 133 | char buf[MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN]; 134 | _mav_put_uint16_t(buf, 0, seq); 135 | 136 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 137 | #else 138 | mavlink_mission_item_reached_t packet; 139 | packet.seq = seq; 140 | 141 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)&packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 142 | #endif 143 | } 144 | 145 | /** 146 | * @brief Send a mission_item_reached message 147 | * @param chan MAVLink channel to send the message 148 | * @param struct The MAVLink struct to serialize 149 | */ 150 | static inline void mavlink_msg_mission_item_reached_send_struct(mavlink_channel_t chan, const mavlink_mission_item_reached_t* mission_item_reached) 151 | { 152 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 153 | mavlink_msg_mission_item_reached_send(chan, mission_item_reached->seq); 154 | #else 155 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)mission_item_reached, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 156 | #endif 157 | } 158 | 159 | #if MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN <= MAVLINK_MAX_PAYLOAD_LEN 160 | /* 161 | This varient of _send() can be used to save stack space by re-using 162 | memory from the receive buffer. The caller provides a 163 | mavlink_message_t which is the size of a full mavlink message. This 164 | is usually the receive buffer for the channel, and allows a reply to an 165 | incoming message with minimum stack space usage. 166 | */ 167 | static inline void mavlink_msg_mission_item_reached_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint16_t seq) 168 | { 169 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 170 | char *buf = (char *)msgbuf; 171 | _mav_put_uint16_t(buf, 0, seq); 172 | 173 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, buf, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 174 | #else 175 | mavlink_mission_item_reached_t *packet = (mavlink_mission_item_reached_t *)msgbuf; 176 | packet->seq = seq; 177 | 178 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_ITEM_REACHED, (const char *)packet, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_CRC); 179 | #endif 180 | } 181 | #endif 182 | 183 | #endif 184 | 185 | // MESSAGE MISSION_ITEM_REACHED UNPACKING 186 | 187 | 188 | /** 189 | * @brief Get field seq from mission_item_reached message 190 | * 191 | * @return Sequence 192 | */ 193 | static inline uint16_t mavlink_msg_mission_item_reached_get_seq(const mavlink_message_t* msg) 194 | { 195 | return _MAV_RETURN_uint16_t(msg, 0); 196 | } 197 | 198 | /** 199 | * @brief Decode a mission_item_reached message into a struct 200 | * 201 | * @param msg The message to decode 202 | * @param mission_item_reached C-struct to decode the message contents into 203 | */ 204 | static inline void mavlink_msg_mission_item_reached_decode(const mavlink_message_t* msg, mavlink_mission_item_reached_t* mission_item_reached) 205 | { 206 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 207 | mission_item_reached->seq = mavlink_msg_mission_item_reached_get_seq(msg); 208 | #else 209 | uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN? msg->len : MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN; 210 | memset(mission_item_reached, 0, MAVLINK_MSG_ID_MISSION_ITEM_REACHED_LEN); 211 | memcpy(mission_item_reached, _MAV_PAYLOAD(msg), len); 212 | #endif 213 | } 214 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_terrain_check.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE TERRAIN_CHECK PACKING 3 | 4 | #define MAVLINK_MSG_ID_TERRAIN_CHECK 135 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_terrain_check_t { 8 | int32_t lat; /*< Latitude (degrees *10^7)*/ 9 | int32_t lon; /*< Longitude (degrees *10^7)*/ 10 | }) mavlink_terrain_check_t; 11 | 12 | #define MAVLINK_MSG_ID_TERRAIN_CHECK_LEN 8 13 | #define MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN 8 14 | #define MAVLINK_MSG_ID_135_LEN 8 15 | #define MAVLINK_MSG_ID_135_MIN_LEN 8 16 | 17 | #define MAVLINK_MSG_ID_TERRAIN_CHECK_CRC 203 18 | #define MAVLINK_MSG_ID_135_CRC 203 19 | 20 | 21 | 22 | #if MAVLINK_COMMAND_24BIT 23 | #define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \ 24 | 135, \ 25 | "TERRAIN_CHECK", \ 26 | 2, \ 27 | { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_terrain_check_t, lat) }, \ 28 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_terrain_check_t, lon) }, \ 29 | } \ 30 | } 31 | #else 32 | #define MAVLINK_MESSAGE_INFO_TERRAIN_CHECK { \ 33 | "TERRAIN_CHECK", \ 34 | 2, \ 35 | { { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_terrain_check_t, lat) }, \ 36 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_terrain_check_t, lon) }, \ 37 | } \ 38 | } 39 | #endif 40 | 41 | /** 42 | * @brief Pack a terrain_check message 43 | * @param system_id ID of this system 44 | * @param component_id ID of this component (e.g. 200 for IMU) 45 | * @param msg The MAVLink message to compress the data into 46 | * 47 | * @param lat Latitude (degrees *10^7) 48 | * @param lon Longitude (degrees *10^7) 49 | * @return length of the message in bytes (excluding serial stream start sign) 50 | */ 51 | static inline uint16_t mavlink_msg_terrain_check_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 52 | int32_t lat, int32_t lon) 53 | { 54 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 55 | char buf[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN]; 56 | _mav_put_int32_t(buf, 0, lat); 57 | _mav_put_int32_t(buf, 4, lon); 58 | 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); 60 | #else 61 | mavlink_terrain_check_t packet; 62 | packet.lat = lat; 63 | packet.lon = lon; 64 | 65 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); 66 | #endif 67 | 68 | msg->msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; 69 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 70 | } 71 | 72 | /** 73 | * @brief Pack a terrain_check message on a channel 74 | * @param system_id ID of this system 75 | * @param component_id ID of this component (e.g. 200 for IMU) 76 | * @param chan The MAVLink channel this message will be sent over 77 | * @param msg The MAVLink message to compress the data into 78 | * @param lat Latitude (degrees *10^7) 79 | * @param lon Longitude (degrees *10^7) 80 | * @return length of the message in bytes (excluding serial stream start sign) 81 | */ 82 | static inline uint16_t mavlink_msg_terrain_check_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 83 | mavlink_message_t* msg, 84 | int32_t lat,int32_t lon) 85 | { 86 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 87 | char buf[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN]; 88 | _mav_put_int32_t(buf, 0, lat); 89 | _mav_put_int32_t(buf, 4, lon); 90 | 91 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); 92 | #else 93 | mavlink_terrain_check_t packet; 94 | packet.lat = lat; 95 | packet.lon = lon; 96 | 97 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); 98 | #endif 99 | 100 | msg->msgid = MAVLINK_MSG_ID_TERRAIN_CHECK; 101 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 102 | } 103 | 104 | /** 105 | * @brief Encode a terrain_check struct 106 | * 107 | * @param system_id ID of this system 108 | * @param component_id ID of this component (e.g. 200 for IMU) 109 | * @param msg The MAVLink message to compress the data into 110 | * @param terrain_check C-struct to read the message contents from 111 | */ 112 | static inline uint16_t mavlink_msg_terrain_check_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_terrain_check_t* terrain_check) 113 | { 114 | return mavlink_msg_terrain_check_pack(system_id, component_id, msg, terrain_check->lat, terrain_check->lon); 115 | } 116 | 117 | /** 118 | * @brief Encode a terrain_check struct on a channel 119 | * 120 | * @param system_id ID of this system 121 | * @param component_id ID of this component (e.g. 200 for IMU) 122 | * @param chan The MAVLink channel this message will be sent over 123 | * @param msg The MAVLink message to compress the data into 124 | * @param terrain_check C-struct to read the message contents from 125 | */ 126 | static inline uint16_t mavlink_msg_terrain_check_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_terrain_check_t* terrain_check) 127 | { 128 | return mavlink_msg_terrain_check_pack_chan(system_id, component_id, chan, msg, terrain_check->lat, terrain_check->lon); 129 | } 130 | 131 | /** 132 | * @brief Send a terrain_check message 133 | * @param chan MAVLink channel to send the message 134 | * 135 | * @param lat Latitude (degrees *10^7) 136 | * @param lon Longitude (degrees *10^7) 137 | */ 138 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 139 | 140 | static inline void mavlink_msg_terrain_check_send(mavlink_channel_t chan, int32_t lat, int32_t lon) 141 | { 142 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 143 | char buf[MAVLINK_MSG_ID_TERRAIN_CHECK_LEN]; 144 | _mav_put_int32_t(buf, 0, lat); 145 | _mav_put_int32_t(buf, 4, lon); 146 | 147 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_CHECK, buf, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 148 | #else 149 | mavlink_terrain_check_t packet; 150 | packet.lat = lat; 151 | packet.lon = lon; 152 | 153 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_CHECK, (const char *)&packet, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 154 | #endif 155 | } 156 | 157 | /** 158 | * @brief Send a terrain_check message 159 | * @param chan MAVLink channel to send the message 160 | * @param struct The MAVLink struct to serialize 161 | */ 162 | static inline void mavlink_msg_terrain_check_send_struct(mavlink_channel_t chan, const mavlink_terrain_check_t* terrain_check) 163 | { 164 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 165 | mavlink_msg_terrain_check_send(chan, terrain_check->lat, terrain_check->lon); 166 | #else 167 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_CHECK, (const char *)terrain_check, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 168 | #endif 169 | } 170 | 171 | #if MAVLINK_MSG_ID_TERRAIN_CHECK_LEN <= MAVLINK_MAX_PAYLOAD_LEN 172 | /* 173 | This varient of _send() can be used to save stack space by re-using 174 | memory from the receive buffer. The caller provides a 175 | mavlink_message_t which is the size of a full mavlink message. This 176 | is usually the receive buffer for the channel, and allows a reply to an 177 | incoming message with minimum stack space usage. 178 | */ 179 | static inline void mavlink_msg_terrain_check_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int32_t lat, int32_t lon) 180 | { 181 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 182 | char *buf = (char *)msgbuf; 183 | _mav_put_int32_t(buf, 0, lat); 184 | _mav_put_int32_t(buf, 4, lon); 185 | 186 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_CHECK, buf, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 187 | #else 188 | mavlink_terrain_check_t *packet = (mavlink_terrain_check_t *)msgbuf; 189 | packet->lat = lat; 190 | packet->lon = lon; 191 | 192 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TERRAIN_CHECK, (const char *)packet, MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN, MAVLINK_MSG_ID_TERRAIN_CHECK_CRC); 193 | #endif 194 | } 195 | #endif 196 | 197 | #endif 198 | 199 | // MESSAGE TERRAIN_CHECK UNPACKING 200 | 201 | 202 | /** 203 | * @brief Get field lat from terrain_check message 204 | * 205 | * @return Latitude (degrees *10^7) 206 | */ 207 | static inline int32_t mavlink_msg_terrain_check_get_lat(const mavlink_message_t* msg) 208 | { 209 | return _MAV_RETURN_int32_t(msg, 0); 210 | } 211 | 212 | /** 213 | * @brief Get field lon from terrain_check message 214 | * 215 | * @return Longitude (degrees *10^7) 216 | */ 217 | static inline int32_t mavlink_msg_terrain_check_get_lon(const mavlink_message_t* msg) 218 | { 219 | return _MAV_RETURN_int32_t(msg, 4); 220 | } 221 | 222 | /** 223 | * @brief Decode a terrain_check message into a struct 224 | * 225 | * @param msg The message to decode 226 | * @param terrain_check C-struct to decode the message contents into 227 | */ 228 | static inline void mavlink_msg_terrain_check_decode(const mavlink_message_t* msg, mavlink_terrain_check_t* terrain_check) 229 | { 230 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 231 | terrain_check->lat = mavlink_msg_terrain_check_get_lat(msg); 232 | terrain_check->lon = mavlink_msg_terrain_check_get_lon(msg); 233 | #else 234 | uint8_t len = msg->len < MAVLINK_MSG_ID_TERRAIN_CHECK_LEN? msg->len : MAVLINK_MSG_ID_TERRAIN_CHECK_LEN; 235 | memset(terrain_check, 0, MAVLINK_MSG_ID_TERRAIN_CHECK_LEN); 236 | memcpy(terrain_check, _MAV_PAYLOAD(msg), len); 237 | #endif 238 | } 239 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/mavlink_msg_timesync.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // MESSAGE TIMESYNC PACKING 3 | 4 | #define MAVLINK_MSG_ID_TIMESYNC 111 5 | 6 | MAVPACKED( 7 | typedef struct __mavlink_timesync_t { 8 | int64_t tc1; /*< Time sync timestamp 1*/ 9 | int64_t ts1; /*< Time sync timestamp 2*/ 10 | }) mavlink_timesync_t; 11 | 12 | #define MAVLINK_MSG_ID_TIMESYNC_LEN 16 13 | #define MAVLINK_MSG_ID_TIMESYNC_MIN_LEN 16 14 | #define MAVLINK_MSG_ID_111_LEN 16 15 | #define MAVLINK_MSG_ID_111_MIN_LEN 16 16 | 17 | #define MAVLINK_MSG_ID_TIMESYNC_CRC 34 18 | #define MAVLINK_MSG_ID_111_CRC 34 19 | 20 | 21 | 22 | #if MAVLINK_COMMAND_24BIT 23 | #define MAVLINK_MESSAGE_INFO_TIMESYNC { \ 24 | 111, \ 25 | "TIMESYNC", \ 26 | 2, \ 27 | { { "tc1", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_timesync_t, tc1) }, \ 28 | { "ts1", NULL, MAVLINK_TYPE_INT64_T, 0, 8, offsetof(mavlink_timesync_t, ts1) }, \ 29 | } \ 30 | } 31 | #else 32 | #define MAVLINK_MESSAGE_INFO_TIMESYNC { \ 33 | "TIMESYNC", \ 34 | 2, \ 35 | { { "tc1", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_timesync_t, tc1) }, \ 36 | { "ts1", NULL, MAVLINK_TYPE_INT64_T, 0, 8, offsetof(mavlink_timesync_t, ts1) }, \ 37 | } \ 38 | } 39 | #endif 40 | 41 | /** 42 | * @brief Pack a timesync message 43 | * @param system_id ID of this system 44 | * @param component_id ID of this component (e.g. 200 for IMU) 45 | * @param msg The MAVLink message to compress the data into 46 | * 47 | * @param tc1 Time sync timestamp 1 48 | * @param ts1 Time sync timestamp 2 49 | * @return length of the message in bytes (excluding serial stream start sign) 50 | */ 51 | static inline uint16_t mavlink_msg_timesync_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, 52 | int64_t tc1, int64_t ts1) 53 | { 54 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 55 | char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; 56 | _mav_put_int64_t(buf, 0, tc1); 57 | _mav_put_int64_t(buf, 8, ts1); 58 | 59 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIMESYNC_LEN); 60 | #else 61 | mavlink_timesync_t packet; 62 | packet.tc1 = tc1; 63 | packet.ts1 = ts1; 64 | 65 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIMESYNC_LEN); 66 | #endif 67 | 68 | msg->msgid = MAVLINK_MSG_ID_TIMESYNC; 69 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 70 | } 71 | 72 | /** 73 | * @brief Pack a timesync message on a channel 74 | * @param system_id ID of this system 75 | * @param component_id ID of this component (e.g. 200 for IMU) 76 | * @param chan The MAVLink channel this message will be sent over 77 | * @param msg The MAVLink message to compress the data into 78 | * @param tc1 Time sync timestamp 1 79 | * @param ts1 Time sync timestamp 2 80 | * @return length of the message in bytes (excluding serial stream start sign) 81 | */ 82 | static inline uint16_t mavlink_msg_timesync_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, 83 | mavlink_message_t* msg, 84 | int64_t tc1,int64_t ts1) 85 | { 86 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 87 | char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; 88 | _mav_put_int64_t(buf, 0, tc1); 89 | _mav_put_int64_t(buf, 8, ts1); 90 | 91 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_TIMESYNC_LEN); 92 | #else 93 | mavlink_timesync_t packet; 94 | packet.tc1 = tc1; 95 | packet.ts1 = ts1; 96 | 97 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_TIMESYNC_LEN); 98 | #endif 99 | 100 | msg->msgid = MAVLINK_MSG_ID_TIMESYNC; 101 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 102 | } 103 | 104 | /** 105 | * @brief Encode a timesync struct 106 | * 107 | * @param system_id ID of this system 108 | * @param component_id ID of this component (e.g. 200 for IMU) 109 | * @param msg The MAVLink message to compress the data into 110 | * @param timesync C-struct to read the message contents from 111 | */ 112 | static inline uint16_t mavlink_msg_timesync_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_timesync_t* timesync) 113 | { 114 | return mavlink_msg_timesync_pack(system_id, component_id, msg, timesync->tc1, timesync->ts1); 115 | } 116 | 117 | /** 118 | * @brief Encode a timesync struct on a channel 119 | * 120 | * @param system_id ID of this system 121 | * @param component_id ID of this component (e.g. 200 for IMU) 122 | * @param chan The MAVLink channel this message will be sent over 123 | * @param msg The MAVLink message to compress the data into 124 | * @param timesync C-struct to read the message contents from 125 | */ 126 | static inline uint16_t mavlink_msg_timesync_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_timesync_t* timesync) 127 | { 128 | return mavlink_msg_timesync_pack_chan(system_id, component_id, chan, msg, timesync->tc1, timesync->ts1); 129 | } 130 | 131 | /** 132 | * @brief Send a timesync message 133 | * @param chan MAVLink channel to send the message 134 | * 135 | * @param tc1 Time sync timestamp 1 136 | * @param ts1 Time sync timestamp 2 137 | */ 138 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 139 | 140 | static inline void mavlink_msg_timesync_send(mavlink_channel_t chan, int64_t tc1, int64_t ts1) 141 | { 142 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 143 | char buf[MAVLINK_MSG_ID_TIMESYNC_LEN]; 144 | _mav_put_int64_t(buf, 0, tc1); 145 | _mav_put_int64_t(buf, 8, ts1); 146 | 147 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 148 | #else 149 | mavlink_timesync_t packet; 150 | packet.tc1 = tc1; 151 | packet.ts1 = ts1; 152 | 153 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)&packet, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 154 | #endif 155 | } 156 | 157 | /** 158 | * @brief Send a timesync message 159 | * @param chan MAVLink channel to send the message 160 | * @param struct The MAVLink struct to serialize 161 | */ 162 | static inline void mavlink_msg_timesync_send_struct(mavlink_channel_t chan, const mavlink_timesync_t* timesync) 163 | { 164 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 165 | mavlink_msg_timesync_send(chan, timesync->tc1, timesync->ts1); 166 | #else 167 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)timesync, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 168 | #endif 169 | } 170 | 171 | #if MAVLINK_MSG_ID_TIMESYNC_LEN <= MAVLINK_MAX_PAYLOAD_LEN 172 | /* 173 | This varient of _send() can be used to save stack space by re-using 174 | memory from the receive buffer. The caller provides a 175 | mavlink_message_t which is the size of a full mavlink message. This 176 | is usually the receive buffer for the channel, and allows a reply to an 177 | incoming message with minimum stack space usage. 178 | */ 179 | static inline void mavlink_msg_timesync_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, int64_t tc1, int64_t ts1) 180 | { 181 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 182 | char *buf = (char *)msgbuf; 183 | _mav_put_int64_t(buf, 0, tc1); 184 | _mav_put_int64_t(buf, 8, ts1); 185 | 186 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, buf, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 187 | #else 188 | mavlink_timesync_t *packet = (mavlink_timesync_t *)msgbuf; 189 | packet->tc1 = tc1; 190 | packet->ts1 = ts1; 191 | 192 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_TIMESYNC, (const char *)packet, MAVLINK_MSG_ID_TIMESYNC_MIN_LEN, MAVLINK_MSG_ID_TIMESYNC_LEN, MAVLINK_MSG_ID_TIMESYNC_CRC); 193 | #endif 194 | } 195 | #endif 196 | 197 | #endif 198 | 199 | // MESSAGE TIMESYNC UNPACKING 200 | 201 | 202 | /** 203 | * @brief Get field tc1 from timesync message 204 | * 205 | * @return Time sync timestamp 1 206 | */ 207 | static inline int64_t mavlink_msg_timesync_get_tc1(const mavlink_message_t* msg) 208 | { 209 | return _MAV_RETURN_int64_t(msg, 0); 210 | } 211 | 212 | /** 213 | * @brief Get field ts1 from timesync message 214 | * 215 | * @return Time sync timestamp 2 216 | */ 217 | static inline int64_t mavlink_msg_timesync_get_ts1(const mavlink_message_t* msg) 218 | { 219 | return _MAV_RETURN_int64_t(msg, 8); 220 | } 221 | 222 | /** 223 | * @brief Decode a timesync message into a struct 224 | * 225 | * @param msg The message to decode 226 | * @param timesync C-struct to decode the message contents into 227 | */ 228 | static inline void mavlink_msg_timesync_decode(const mavlink_message_t* msg, mavlink_timesync_t* timesync) 229 | { 230 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS 231 | timesync->tc1 = mavlink_msg_timesync_get_tc1(msg); 232 | timesync->ts1 = mavlink_msg_timesync_get_ts1(msg); 233 | #else 234 | uint8_t len = msg->len < MAVLINK_MSG_ID_TIMESYNC_LEN? msg->len : MAVLINK_MSG_ID_TIMESYNC_LEN; 235 | memset(timesync, 0, MAVLINK_MSG_ID_TIMESYNC_LEN); 236 | memcpy(timesync, _MAV_PAYLOAD(msg), len); 237 | #endif 238 | } 239 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/common/version.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | * @brief MAVLink comm protocol built from common.xml 3 | * @see http://mavlink.org 4 | */ 5 | #pragma once 6 | 7 | #ifndef MAVLINK_VERSION_H 8 | #define MAVLINK_VERSION_H 9 | 10 | #define MAVLINK_BUILD_DATE "Thu Feb 16 2017" 11 | #define MAVLINK_WIRE_PROTOCOL_VERSION "2.0" 12 | #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255 13 | 14 | #endif // MAVLINK_VERSION_H 15 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/mavlink_conversions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* enable math defines on Windows */ 4 | #ifdef _MSC_VER 5 | #ifndef _USE_MATH_DEFINES 6 | #define _USE_MATH_DEFINES 7 | #endif 8 | #endif 9 | #include 10 | 11 | #ifndef M_PI_2 12 | #define M_PI_2 ((float)asin(1)) 13 | #endif 14 | 15 | /** 16 | * @file mavlink_conversions.h 17 | * 18 | * These conversion functions follow the NASA rotation standards definition file 19 | * available online. 20 | * 21 | * Their intent is to lower the barrier for MAVLink adopters to use gimbal-lock free 22 | * (both rotation matrices, sometimes called DCM, and quaternions are gimbal-lock free) 23 | * rotation representations. Euler angles (roll, pitch, yaw) will be phased out of the 24 | * protocol as widely as possible. 25 | * 26 | * @author James Goppert 27 | * @author Thomas Gubler 28 | */ 29 | 30 | 31 | /** 32 | * Converts a quaternion to a rotation matrix 33 | * 34 | * @param quaternion a [w, x, y, z] ordered quaternion (null-rotation being 1 0 0 0) 35 | * @param dcm a 3x3 rotation matrix 36 | */ 37 | MAVLINK_HELPER void mavlink_quaternion_to_dcm(const float quaternion[4], float dcm[3][3]) 38 | { 39 | double a = quaternion[0]; 40 | double b = quaternion[1]; 41 | double c = quaternion[2]; 42 | double d = quaternion[3]; 43 | double aSq = a * a; 44 | double bSq = b * b; 45 | double cSq = c * c; 46 | double dSq = d * d; 47 | dcm[0][0] = aSq + bSq - cSq - dSq; 48 | dcm[0][1] = 2 * (b * c - a * d); 49 | dcm[0][2] = 2 * (a * c + b * d); 50 | dcm[1][0] = 2 * (b * c + a * d); 51 | dcm[1][1] = aSq - bSq + cSq - dSq; 52 | dcm[1][2] = 2 * (c * d - a * b); 53 | dcm[2][0] = 2 * (b * d - a * c); 54 | dcm[2][1] = 2 * (a * b + c * d); 55 | dcm[2][2] = aSq - bSq - cSq + dSq; 56 | } 57 | 58 | 59 | /** 60 | * Converts a rotation matrix to euler angles 61 | * 62 | * @param dcm a 3x3 rotation matrix 63 | * @param roll the roll angle in radians 64 | * @param pitch the pitch angle in radians 65 | * @param yaw the yaw angle in radians 66 | */ 67 | MAVLINK_HELPER void mavlink_dcm_to_euler(const float dcm[3][3], float* roll, float* pitch, float* yaw) 68 | { 69 | float phi, theta, psi; 70 | theta = asin(-dcm[2][0]); 71 | 72 | if (fabsf(theta - (float)M_PI_2) < 1.0e-3f) { 73 | phi = 0.0f; 74 | psi = (atan2f(dcm[1][2] - dcm[0][1], 75 | dcm[0][2] + dcm[1][1]) + phi); 76 | 77 | } else if (fabsf(theta + (float)M_PI_2) < 1.0e-3f) { 78 | phi = 0.0f; 79 | psi = atan2f(dcm[1][2] - dcm[0][1], 80 | dcm[0][2] + dcm[1][1] - phi); 81 | 82 | } else { 83 | phi = atan2f(dcm[2][1], dcm[2][2]); 84 | psi = atan2f(dcm[1][0], dcm[0][0]); 85 | } 86 | 87 | *roll = phi; 88 | *pitch = theta; 89 | *yaw = psi; 90 | } 91 | 92 | 93 | /** 94 | * Converts a quaternion to euler angles 95 | * 96 | * @param quaternion a [w, x, y, z] ordered quaternion (null-rotation being 1 0 0 0) 97 | * @param roll the roll angle in radians 98 | * @param pitch the pitch angle in radians 99 | * @param yaw the yaw angle in radians 100 | */ 101 | MAVLINK_HELPER void mavlink_quaternion_to_euler(const float quaternion[4], float* roll, float* pitch, float* yaw) 102 | { 103 | float dcm[3][3]; 104 | mavlink_quaternion_to_dcm(quaternion, dcm); 105 | mavlink_dcm_to_euler((const float(*)[3])dcm, roll, pitch, yaw); 106 | } 107 | 108 | 109 | /** 110 | * Converts euler angles to a quaternion 111 | * 112 | * @param roll the roll angle in radians 113 | * @param pitch the pitch angle in radians 114 | * @param yaw the yaw angle in radians 115 | * @param quaternion a [w, x, y, z] ordered quaternion (null-rotation being 1 0 0 0) 116 | */ 117 | MAVLINK_HELPER void mavlink_euler_to_quaternion(float roll, float pitch, float yaw, float quaternion[4]) 118 | { 119 | float cosPhi_2 = cosf(roll / 2); 120 | float sinPhi_2 = sinf(roll / 2); 121 | float cosTheta_2 = cosf(pitch / 2); 122 | float sinTheta_2 = sinf(pitch / 2); 123 | float cosPsi_2 = cosf(yaw / 2); 124 | float sinPsi_2 = sinf(yaw / 2); 125 | quaternion[0] = (cosPhi_2 * cosTheta_2 * cosPsi_2 + 126 | sinPhi_2 * sinTheta_2 * sinPsi_2); 127 | quaternion[1] = (sinPhi_2 * cosTheta_2 * cosPsi_2 - 128 | cosPhi_2 * sinTheta_2 * sinPsi_2); 129 | quaternion[2] = (cosPhi_2 * sinTheta_2 * cosPsi_2 + 130 | sinPhi_2 * cosTheta_2 * sinPsi_2); 131 | quaternion[3] = (cosPhi_2 * cosTheta_2 * sinPsi_2 - 132 | sinPhi_2 * sinTheta_2 * cosPsi_2); 133 | } 134 | 135 | 136 | /** 137 | * Converts a rotation matrix to a quaternion 138 | * Reference: 139 | * - Shoemake, Quaternions, 140 | * http://www.cs.ucr.edu/~vbz/resources/quatut.pdf 141 | * 142 | * @param dcm a 3x3 rotation matrix 143 | * @param quaternion a [w, x, y, z] ordered quaternion (null-rotation being 1 0 0 0) 144 | */ 145 | MAVLINK_HELPER void mavlink_dcm_to_quaternion(const float dcm[3][3], float quaternion[4]) 146 | { 147 | float tr = dcm[0][0] + dcm[1][1] + dcm[2][2]; 148 | if (tr > 0.0f) { 149 | float s = sqrtf(tr + 1.0f); 150 | quaternion[0] = s * 0.5f; 151 | s = 0.5f / s; 152 | quaternion[1] = (dcm[2][1] - dcm[1][2]) * s; 153 | quaternion[2] = (dcm[0][2] - dcm[2][0]) * s; 154 | quaternion[3] = (dcm[1][0] - dcm[0][1]) * s; 155 | } else { 156 | /* Find maximum diagonal element in dcm 157 | * store index in dcm_i */ 158 | int dcm_i = 0; 159 | int i; 160 | for (i = 1; i < 3; i++) { 161 | if (dcm[i][i] > dcm[dcm_i][dcm_i]) { 162 | dcm_i = i; 163 | } 164 | } 165 | 166 | int dcm_j = (dcm_i + 1) % 3; 167 | int dcm_k = (dcm_i + 2) % 3; 168 | 169 | float s = sqrtf((dcm[dcm_i][dcm_i] - dcm[dcm_j][dcm_j] - 170 | dcm[dcm_k][dcm_k]) + 1.0f); 171 | quaternion[dcm_i + 1] = s * 0.5f; 172 | s = 0.5f / s; 173 | quaternion[dcm_j + 1] = (dcm[dcm_i][dcm_j] + dcm[dcm_j][dcm_i]) * s; 174 | quaternion[dcm_k + 1] = (dcm[dcm_k][dcm_i] + dcm[dcm_i][dcm_k]) * s; 175 | quaternion[0] = (dcm[dcm_k][dcm_j] - dcm[dcm_j][dcm_k]) * s; 176 | } 177 | } 178 | 179 | 180 | /** 181 | * Converts euler angles to a rotation matrix 182 | * 183 | * @param roll the roll angle in radians 184 | * @param pitch the pitch angle in radians 185 | * @param yaw the yaw angle in radians 186 | * @param dcm a 3x3 rotation matrix 187 | */ 188 | MAVLINK_HELPER void mavlink_euler_to_dcm(float roll, float pitch, float yaw, float dcm[3][3]) 189 | { 190 | float cosPhi = cosf(roll); 191 | float sinPhi = sinf(roll); 192 | float cosThe = cosf(pitch); 193 | float sinThe = sinf(pitch); 194 | float cosPsi = cosf(yaw); 195 | float sinPsi = sinf(yaw); 196 | 197 | dcm[0][0] = cosThe * cosPsi; 198 | dcm[0][1] = -cosPhi * sinPsi + sinPhi * sinThe * cosPsi; 199 | dcm[0][2] = sinPhi * sinPsi + cosPhi * sinThe * cosPsi; 200 | 201 | dcm[1][0] = cosThe * sinPsi; 202 | dcm[1][1] = cosPhi * cosPsi + sinPhi * sinThe * sinPsi; 203 | dcm[1][2] = -sinPhi * cosPsi + cosPhi * sinThe * sinPsi; 204 | 205 | dcm[2][0] = -sinThe; 206 | dcm[2][1] = sinPhi * cosThe; 207 | dcm[2][2] = cosPhi * cosThe; 208 | } 209 | 210 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/mavlink_get_info.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef MAVLINK_USE_MESSAGE_INFO 4 | #define MAVLINK_HAVE_GET_MESSAGE_INFO 5 | /* 6 | return the message_info struct for a message 7 | */ 8 | MAVLINK_HELPER const mavlink_message_info_t *mavlink_get_message_info(const mavlink_message_t *msg) 9 | { 10 | static const mavlink_message_info_t mavlink_message_info[] = MAVLINK_MESSAGE_INFO; 11 | /* 12 | use a bisection search to find the right entry. A perfect hash may be better 13 | Note that this assumes the table is sorted with primary key msgid 14 | */ 15 | uint32_t msgid = msg->msgid; 16 | uint32_t low=0, high=sizeof(mavlink_message_info)/sizeof(mavlink_message_info[0]); 17 | while (low < high) { 18 | uint32_t mid = (low+1+high)/2; 19 | if (msgid < mavlink_message_info[mid].msgid) { 20 | high = mid-1; 21 | continue; 22 | } 23 | if (msgid > mavlink_message_info[mid].msgid) { 24 | low = mid; 25 | continue; 26 | } 27 | low = mid; 28 | break; 29 | } 30 | if (mavlink_message_info[low].msgid == msgid) { 31 | return &mavlink_message_info[low]; 32 | } 33 | return NULL; 34 | } 35 | #endif // MAVLINK_USE_MESSAGE_INFO 36 | 37 | 38 | -------------------------------------------------------------------------------- /models/Autopilot/src/messages/mavlink_sha256.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/src/messages/mavlink_sha256.h -------------------------------------------------------------------------------- /models/Autopilot/src/sfun_manageMAVLinkConnection.mexa64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/src/sfun_manageMAVLinkConnection.mexa64 -------------------------------------------------------------------------------- /models/Autopilot/src/sfun_manageMAVLinkConnection.mexmaci64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/src/sfun_manageMAVLinkConnection.mexmaci64 -------------------------------------------------------------------------------- /models/Autopilot/src/sfun_manageMAVLinkConnection.mexw64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Autopilot/src/sfun_manageMAVLinkConnection.mexw64 -------------------------------------------------------------------------------- /models/PlantModel/PlantModel.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/PlantModel/PlantModel.slx -------------------------------------------------------------------------------- /models/PlantModel/slrtPlantModel.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/PlantModel/slrtPlantModel.slx -------------------------------------------------------------------------------- /models/Simulation/parsimUtilities/PlotFlightResultsFcn.m: -------------------------------------------------------------------------------- 1 | function [] = PlotFlightResultsFcn(simIn, simOut) 2 | % This function is used to plot the results of a flight simulation. 3 | % Input arguments: 4 | % simIn - Simulink.SimulationInput containing the input values to the Simulation 5 | % simOut - simStruct containing the results of the simulaiton 6 | % 7 | % Copyright 2018 The MathWorks, Inc. 8 | 9 | sigs = simOut.get('logsout'); 10 | 11 | % Position 12 | % ======== 13 | 14 | % Estimated Position 15 | x = sigs.get('apStatus').Values.Xe.Data(:,1); 16 | y = sigs.get('apStatus').Values.Xe.Data(:,2); 17 | 18 | % Estimated Velocities 19 | vn = sigs.get('apStatus').Values.Ve.Data(:,1); 20 | ve = sigs.get('apStatus').Values.Ve.Data(:,2); 21 | 22 | simIn_var_names = {simIn.Variables.Name}; 23 | 24 | uav = simIn.Variables(strcmp('uav', simIn_var_names)).Value; 25 | 26 | % Initial Position 27 | IP = uav.ic.Pos_0; 28 | 29 | % Waypoints 30 | Xwpt = simIn.Variables(strcmp('Xpoints', simIn_var_names)).Value; 31 | Ywpt = simIn.Variables(strcmp('Ypoints', simIn_var_names)).Value; 32 | 33 | % Keep all waypoints that are not [0,0] 34 | both_zero = and(Xwpt==0, Ywpt==0); 35 | Xwpt = Xwpt(not(both_zero)); 36 | Ywpt = Ywpt(not(both_zero)); 37 | 38 | % housekeeping variables 39 | i = length(vn); 40 | 41 | % Produce XY Plot of the mission 42 | figure; 43 | clf; 44 | 45 | % Plot the waypoint path 46 | plot(Ywpt,Xwpt,'k','LineWidth',0.5); 47 | hold on 48 | 49 | % Label the Waypoints 50 | for nn = 1:length(Xwpt) 51 | text(double(Ywpt(nn)+25),double(Xwpt(nn)+25),num2str(nn)) 52 | end 53 | 54 | % Plot WPs themselves 55 | plot([Ywpt(end) Ywpt(1)],[Xwpt(end) Xwpt(1)],'k','LineWidth',0.5); 56 | plot(Ywpt,Xwpt,'sk'); 57 | 58 | title('Position'); 59 | 60 | %plot the initial Point 61 | if (~isempty(IP)) 62 | plot( IP(2), IP(1),'ks','MarkerSize',5,'MarkerFaceColor','g'); 63 | end 64 | plot( y(100), x(100),'ks','MarkerSize',15,'MarkerFaceColor','b'); 65 | axis equal; 66 | 67 | for j=100:100:i-1 68 | plot(y(j),x(j) ,'-s','MarkerSize',3); 69 | 70 | %plot the velocity vector 71 | plot ([y(j) y(j)+ve(j)], [x(j) x(j)+vn(j)], 'r'); 72 | end 73 | plot(y(100:end),x(100:end) ,'-','LineWidth',2.5); 74 | xlabel('Y(m)'); 75 | ylabel('X(m)'); 76 | grid on; 77 | hold off 78 | end -------------------------------------------------------------------------------- /models/Simulation/parsimUtilities/configParSim.m: -------------------------------------------------------------------------------- 1 | % Script shortcut to set up models for local parallel simulation 2 | % 3 | % Copyright 2018 The MathWorks, Inc. 4 | 5 | models_set_up(eTask.TestFlightController); -------------------------------------------------------------------------------- /models/Simulation/parsimUtilities/random_waypoint_generator.m: -------------------------------------------------------------------------------- 1 | function wps = random_waypoint_generator(wpCount) 2 | % This function generates a given number of random waypoints that are a minimum 3 | % distance from each other. 4 | % Input arguments: 5 | % wpCount - number - The number of desired waypoints. It can not exceed 9. 6 | % 7 | % Output arguments: 8 | % wps - array - Waypoint array produced by the function 9 | % 10 | % Copyright 2018 The MathWorks, Inc. 11 | arguments 12 | wpCount (1,1) {mustBeInteger, mustBeLessThanOrEqual(wpCount,9)} 13 | end 14 | 15 | % create the array to hold the values 16 | wps = ones(9,3) .* generate_single_wp(); 17 | 18 | for ii = 2:wpCount 19 | attempts = 1; 20 | while attempts < 2000 21 | % generate the next waypoint 22 | wp = generate_single_wp(); 23 | 24 | % check the separation between all WPs 25 | if(all(norm(wps(1:ii-1,1:2) - wp(1:2)) > 350)) 26 | wps(ii,:) = wp; 27 | break; 28 | end 29 | attempts = attempts+1; 30 | end 31 | 32 | end 33 | 34 | end 35 | 36 | function wp = generate_single_wp() 37 | x_wp = single(randn*700); 38 | y_wp = single(randn*700); 39 | max_z_wp = 500; 40 | min_z_wp = 250; 41 | z_wp = single((max_z_wp-min_z_wp).*rand + min_z_wp); 42 | 43 | wp = [x_wp, y_wp, z_wp]; 44 | end -------------------------------------------------------------------------------- /models/Simulation/parsimUtilities/runRandomParFlight.m: -------------------------------------------------------------------------------- 1 | % Script shortcut to run local parallel simulation 2 | % Copyright 2018 The MathWorks, Inc. 3 | % Set the number of local sims to run 4 | n = 8; 5 | 6 | % Let user know how many parsims 7 | disp(['Running ' num2str(n) ' Parallel Simulations. Edit runRandomParFlight.m to change this number']); 8 | 9 | % Run the simulations 10 | [simIn, simOut] = runparsim(n, 1000); -------------------------------------------------------------------------------- /models/Simulation/parsimUtilities/runparsim.m: -------------------------------------------------------------------------------- 1 | function [simIn, simOut] = runparsim(num_runs, simTime, cluster_profile) 2 | % runparsim Run a given number of flights in parallel using 3 | % parsim 4 | % 5 | % Input arguments: 6 | % numRuns - number - number of simulations to run. 7 | % use_mdcs - boolean - if 0, run locally, use MDCS otherwise 8 | % cluster_profile - if use_mdcs~=0, you must provide a cluster profile to 9 | % run in MDCS 10 | % 11 | % Output arguments: 12 | % simIn - Simulink.SimulationInput containing the input values to the Simulation 13 | % simOut - simStruct containing the results of the simulaiton 14 | % 15 | % Copyright 2018 The MathWorks, Inc. 16 | arguments 17 | num_runs (1,1) {mustBePositive} 18 | simTime (1,1) {mustBeNonnegative} = 425; 19 | cluster_profile (1,:) = ''; 20 | end 21 | 22 | % Function parameters 23 | maxWPnum = 9; 24 | minWPnum = 5; 25 | model = 'simModel'; 26 | 27 | simIn(1:num_runs) = Simulink.SimulationInput(model); 28 | 29 | for sim_ctr = 1:num_runs 30 | 31 | % Random number of waypoints 32 | wpCount = round((maxWPnum-minWPnum).*rand + minWPnum); 33 | wps = random_waypoint_generator(wpCount); 34 | 35 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('Xpoints', round(wps(:,1)')); 36 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('Ypoints', round(wps(:,2)')); 37 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('Zpoints', round(wps(:,3)')); 38 | 39 | % Random Heading 40 | psi_ic = 2*pi*rand-pi; 41 | Euler_0 = [0; 0; psi_ic]'; 42 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('uav.ic.Euler_0', Euler_0'); 43 | 44 | % Random Position 45 | x_ic = randn*100; 46 | y_ic = randn*100; 47 | z_ic = 250*rand+250; 48 | 49 | Pos_0 = [x_ic y_ic z_ic]; 50 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('uav.ic.Pos_0', round(Pos_0')); 51 | 52 | % Random Commanded Airspeed 53 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('U_comm', 17*rand+18); 54 | 55 | % Random Wind Conditions 56 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('windBase', 4*rand+3.5); 57 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('windDirTurb', 360*rand); 58 | simIn(sim_ctr) = simIn(sim_ctr).setVariable('windDirHor', 360*rand); 59 | end 60 | 61 | simIn = simIn.setModelParameter('StopTime',num2str(simTime)); 62 | 63 | % Check if a cluster is already started 64 | poolObj = gcp('nocreate'); 65 | % Create a new pool, if one does not exist 66 | if isempty(poolObj) 67 | % If a cluster profile is not given to the function, use the default 68 | % cluster 69 | if ~isempty(cluster_profile) 70 | parpool(cluster_profile); 71 | else 72 | parpool; 73 | end 74 | end 75 | 76 | % Start parallel simulation 77 | simOut = parsim(simIn,... 78 | 'ShowProgress', 'on', ... 79 | 'ShowSimulationManager', 'off', ... %speeds up the sim 80 | 'TransferBaseWorkspaceVariables','on',... 81 | 'UseFastRestart','on',... 82 | 'AttachedFiles','interfaceDefinition.h'); 83 | 84 | % Plot results 85 | for idx = 1:num_runs 86 | if isempty(simOut(idx).ErrorMessage) 87 | % Plot the results when the simulation finishes 88 | disp(['Simulation #' num2str(idx) ' successful.']) 89 | PlotFlightResultsFcn(simIn(idx), simOut(idx)); 90 | else 91 | % Otherwise, print out an error message 92 | disp(['Error occurred during simulation #' num2str(idx) ':\n' ... 93 | simOut(idx).ErrorMessage]) 94 | end 95 | end 96 | 97 | end -------------------------------------------------------------------------------- /models/Simulation/simModel.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/models/Simulation/simModel.slx -------------------------------------------------------------------------------- /models/Simulation/simUtilities/PlotFlightResults.m: -------------------------------------------------------------------------------- 1 | function PlotFlightResults(simOut) 2 | % Copyright 2018 The MathWorks, Inc. 3 | 4 | sigs = simOut.get('logsout'); 5 | 6 | project = currentProject; 7 | workFolder = project.ProjectStartupFolder; 8 | 9 | % Position 10 | % ======== 11 | 12 | % Real Position from 6DOF model 13 | x_real = sigs.get('uavState').Values.X_e.Data(:,1); 14 | y_real = sigs.get('uavState').Values.X_e.Data(:,2); 15 | z_real = sigs.get('uavState').Values.X_e.Data(:,3); 16 | 17 | % Estimated Position 18 | x = sigs.get('apStatus').Values.Xe.Data(:,1); 19 | y = sigs.get('apStatus').Values.Xe.Data(:,2); 20 | z = sigs.get('apStatus').Values.Xe.Data(:,3); 21 | 22 | % Real Velocities from 6DOF model 23 | vn_real = sigs.get('uavState').Values.V_e.Data(:,1); 24 | ve_real = sigs.get('uavState').Values.V_e.Data(:,2); 25 | vd_real = sigs.get('uavState').Values.V_e.Data(:,3); 26 | 27 | % Estimated Velocities 28 | vn = sigs.get('apStatus').Values.Ve.Data(:,1); 29 | ve = sigs.get('apStatus').Values.Ve.Data(:,2); 30 | vd = sigs.get('apStatus').Values.Ve.Data(:,3); 31 | 32 | 33 | uav = evalin('base', 'uavData'); 34 | 35 | % Initial Position 36 | IP = uav.ic.Pos_0; 37 | 38 | % Waypoints 39 | Xwpt = evalin('base', 'Xpoints'); 40 | Ywpt = evalin('base', 'Ypoints'); 41 | 42 | % Get time vector 43 | timeAp = sigs.get('apStatus').Values.Euler.Time; 44 | timePl = sigs.get('uavState').Values.X_e.Time; 45 | 46 | % Estimated Euler_hat Angles 47 | phi = sigs.get('apStatus').Values.Euler.Data(:,1); 48 | theta = sigs.get('apStatus').Values.Euler.Data(:,2); 49 | psi = sigs.get('apStatus').Values.Euler.Data(:,3); 50 | 51 | % Real Euler Angles 52 | phi_real = sigs.get('uavState').Values.Euler.Data(:,1); 53 | theta_real = sigs.get('uavState').Values.Euler.Data(:,2); 54 | psi_real = sigs.get('uavState').Values.Euler.Data(:,3); 55 | 56 | 57 | phi_cPl = sigs.get('midLevelCmds').Values.phi_c.Data; 58 | theta_cPl = sigs.get('theta_c').Values.Data; 59 | 60 | % Collect Airspeed 61 | umPl = sigs.get('apStatus').Values.ias.Data(:,1); 62 | um_cPl = sigs.get('midLevelCmds').Values.U_c.Data(:); 63 | 64 | % Altitude 65 | h_cPl = sigs.get('midLevelCmds').Values.h_c.Data(:); 66 | 67 | 68 | % housekeeping variables 69 | i = length(vn); 70 | figct = 1; 71 | 72 | % Turn the Pause On 73 | pauseOn = 1; 74 | 75 | %% Produce XY Plot of the mission 76 | figure(figct); 77 | clf; 78 | 79 | % Plot the waypoint path 80 | plot(Ywpt,Xwpt,'k','LineWidth',0.5); 81 | hold on 82 | 83 | % Label the Waypoints 84 | for nn = 1:length(Xwpt) 85 | text(Ywpt(nn)+25,Xwpt(nn)+25,num2str(nn)) 86 | end 87 | 88 | % Plot WPs themselves 89 | plot([Ywpt(end) Ywpt(1)],[Xwpt(end) Xwpt(1)],'k','LineWidth',0.5); 90 | plot(Ywpt,Xwpt,'sk'); 91 | 92 | 93 | title('Position and L2 Vector'); 94 | 95 | %plot the initial Point 96 | if (~isempty(IP)) 97 | plot( IP(2), IP(1),'ks','MarkerSize',15,'MarkerFaceColor','g'); 98 | end 99 | 100 | axis equal; 101 | 102 | for j=100:100:i-1 103 | plot(y(j),x(j) ,'-s','MarkerSize',3); 104 | 105 | %plot the velocity vector 106 | plot ([y(j) y(j)+ve(j)], [x(j) x(j)+vn(j)], 'r'); 107 | 108 | %plot the L2 vector 109 | if j > 10 % REN 05/24/10 && L2Enabled(j) == 1 110 | % plot ([y(j) y(j)+L2(j,2)], [x(j) x(j)+L2(j,1)], 'm-'); 111 | end 112 | 113 | %pause the animation 114 | if pauseOn == 1 115 | if (mod(j,200)==0) 116 | pause(0.1); 117 | end 118 | end 119 | end 120 | plot(y(100:end),x(100:end) ,'-','LineWidth',2.5); 121 | xlabel('Y(m)'); 122 | ylabel('X(m)'); 123 | grid on; 124 | hold off 125 | 126 | print(fullfile(workFolder,['fig',num2str(figct),'_',datestr(now,'yyyy-mm-dd-HH_MM_SS')]),'-dpng'); 127 | 128 | figct = figct + 1; 129 | 130 | %% Plot the Inner Loop Commands 131 | figure(figct) 132 | clf 133 | subplot(4,1,1) 134 | plot(timeAp(50:end),umPl(50:end),'b', timeAp(50:end), um_cPl(50:end), 'r'); 135 | xlabel('Time(s)'); 136 | ylabel('Airspeed (m/s)'); 137 | legend('Measured','Commanded'); 138 | axis tight 139 | grid on; 140 | 141 | subplot(4,1,2) 142 | plot(timeAp(50:end),phi(50:end)*180/pi,'b',timeAp(50:end),phi_cPl(50:end)*180/pi,'r'); 143 | xlabel('Time(s)'); 144 | ylabel('\phi (deg)'); 145 | legend('Measured','Commanded'); 146 | axis tight 147 | grid on; 148 | 149 | subplot(4,1,3) 150 | plot(timeAp(50:end),theta(50:end)*180/pi,'b',timeAp(50:end),theta_cPl(50:end)*180/pi,'r'); 151 | xlabel('Time(s)'); 152 | ylabel('\theta (deg)'); 153 | legend('Measured','Commanded'); 154 | axis tight 155 | grid on; 156 | 157 | subplot(4,1,4) 158 | plot(timeAp(50:end), z(50:end), 'b', timeAp(50:end), h_cPl(50:end), 'r'); 159 | xlabel('Time(s)'); 160 | ylabel('Altitude (m)'); 161 | legend('Measured', 'Commanded'); 162 | axis tight 163 | grid on; 164 | 165 | print(fullfile(workFolder,['fig',num2str(figct),'_',datestr(now,'yyyy-mm-dd-HH_MM_SS')]),'-dpng'); 166 | 167 | figct = figct + 1; 168 | 169 | %% Plot the Estimated vs Real Position 170 | % Remove first second to account for filter convergence 171 | figure(figct) 172 | clf 173 | subplot(3,1,1) 174 | plot(timeAp(100:end), x(100:end), 'b', timePl(200:end), x_real(200:end), 'r'); 175 | xlabel('Time(s)'); 176 | ylabel('X (m)'); 177 | legend('Estimated', 'Real'); 178 | axis tight 179 | grid on; 180 | 181 | subplot(3,1,2) 182 | plot(timeAp(100:end), y(100:end), 'b', timePl(200:end), y_real(200:end), 'r'); 183 | xlabel('Time(s)'); 184 | ylabel('Y (m)'); 185 | legend('Estimated', 'Real'); 186 | axis tight 187 | grid on; 188 | 189 | subplot(3,1,3) 190 | plot(timeAp(100:end), -z(100:end), 'b', timePl(200:end), z_real(200:end), 'r'); 191 | xlabel('Time(s)'); 192 | ylabel('Z (m)'); 193 | legend('Estimated', 'Real'); 194 | axis tight 195 | grid on; 196 | 197 | print(fullfile(workFolder,['fig',num2str(figct),'_',datestr(now,'yyyy-mm-dd-HH_MM_SS')]),'-dpng'); 198 | 199 | figct = figct + 1; 200 | 201 | %% Plot the Estimated vs. Real Velocities 202 | % Remove first second to account for filter convergence 203 | figure(figct) 204 | clf 205 | subplot(3,1,1) 206 | plot(timeAp(120:end), vn(120:end), 'b', timePl(240:end), vn_real(240:end), 'r'); 207 | xlabel('Time(s)'); 208 | ylabel('V_n(m/s)'); 209 | legend('Estimated', 'Real'); 210 | axis tight 211 | grid on; 212 | 213 | subplot(3,1,2) 214 | plot(timeAp(120:end), ve(120:end), 'b', timePl(240:end), ve_real(240:end), 'r'); 215 | xlabel('Time(s)'); 216 | ylabel('V_e(m/s)'); 217 | legend('Estimated', 'Real'); 218 | axis tight 219 | grid on; 220 | 221 | subplot(3,1,3) 222 | plot(timeAp(120:end), -vd(120:end), 'b', timePl(240:end), vd_real(240:end), 'r'); 223 | xlabel('Time(s)'); 224 | ylabel('V_d(m/s)'); 225 | legend('Estimated', 'Real'); 226 | axis tight 227 | grid on; 228 | 229 | print(fullfile(workFolder,['fig',num2str(figct),'_',datestr(now,'yyyy-mm-dd-HH_MM_SS')]),'-dpng'); 230 | 231 | figct = figct + 1; 232 | 233 | %% Plot the Estimated vs. Real Velocities 234 | % Remove first second to account for filter convergence 235 | figure(figct) 236 | clf 237 | subplot(3,1,1) 238 | plot(timeAp(100:end), phi(100:end), 'b', timePl(200:end), phi_real(200:end), 'r'); 239 | xlabel('Time(s)'); 240 | ylabel('\phi(rad)'); 241 | legend('Estimated', 'Real'); 242 | axis tight 243 | grid on; 244 | 245 | subplot(3,1,2) 246 | plot(timeAp(100:end), theta(100:end), 'b', timePl(200:end), theta_real(200:end), 'r'); 247 | xlabel('Time(s)'); 248 | ylabel('\theta(rad)'); 249 | legend('Estimated', 'Real'); 250 | axis tight 251 | grid on; 252 | 253 | subplot(3,1,3) 254 | plot(timeAp(100:end), psi(100:end), 'b', timePl(200:end), psi_real(200:end), 'r'); 255 | xlabel('Time(s)'); 256 | ylabel('\psi(rad)'); 257 | legend('Estimated', 'Real'); 258 | axis tight 259 | grid on; 260 | 261 | print(fullfile(workFolder,['fig',num2str(figct),'_',datestr(now,'yyyy-mm-dd-HH_MM_SS')]),'-dpng'); 262 | 263 | figct = figct + 1; 264 | 265 | end 266 | -------------------------------------------------------------------------------- /models/Simulation/simUtilities/configCoSim.m: -------------------------------------------------------------------------------- 1 | % Script shortcut to set up models for co-simulation with QGGroundControl 2 | % 3 | % Copyright 2018 The MathWorks, Inc. 4 | 5 | models_set_up(eTask.UAVSMECapabilities, true); 6 | -------------------------------------------------------------------------------- /models/Simulation/simUtilities/configHILSim.m: -------------------------------------------------------------------------------- 1 | % Script shortcut to set up models for HIl Simulation 2 | % 3 | % Copyright 2018 The MathWorks, Inc. 4 | 5 | models_set_up(eTask.SystemIntegrationTest, true); 6 | -------------------------------------------------------------------------------- /models/Simulation/simUtilities/configSim.m: -------------------------------------------------------------------------------- 1 | % Script shortcut to set up models for Simulation 2 | % 3 | % Copyright 2018 The MathWorks, Inc. 4 | 5 | models_set_up(eTask.FlightControllerDesign, true); 6 | -------------------------------------------------------------------------------- /models/Simulation/simUtilities/runShortFlight.m: -------------------------------------------------------------------------------- 1 | function simout = runShortFlight(model, simTime) 2 | % Script shortcut to run a short flight in an L pattern 3 | % 4 | % Copyright 2018 The MathWorks, Inc. 5 | 6 | arguments 7 | model (1,:) char = bdroot(); 8 | simTime (1,1) {mustBeNonnegative} = 425; 9 | end 10 | 11 | %% Sim the model 12 | simout = sim(model,'StopTime',num2str(simTime),'ReturnWorkspaceOutputs','on'); 13 | 14 | %% Plot the flight results 15 | PlotFlightResults(simout); 16 | 17 | end -------------------------------------------------------------------------------- /requirements/SystemLevelRequirements.slreqx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/requirements/SystemLevelRequirements.slreqx -------------------------------------------------------------------------------- /requirements/electricUAVReqs.slreqx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/requirements/electricUAVReqs.slreqx -------------------------------------------------------------------------------- /tests/B2B_tests/AutopilotControlSystem_test1.mldatx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/B2B_tests/AutopilotControlSystem_test1.mldatx -------------------------------------------------------------------------------- /tests/B2B_tests/AutopilotControlSystem_test1.slmx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/B2B_tests/AutopilotControlSystem_test1.slmx -------------------------------------------------------------------------------- /tests/B2B_tests/baselineAutopilotControlSystem.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/B2B_tests/baselineAutopilotControlSystem.mat -------------------------------------------------------------------------------- /tests/B2B_tests/inputs_on_2021_08_17_at_08_10_16.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/B2B_tests/inputs_on_2021_08_17_at_08_10_16.mat -------------------------------------------------------------------------------- /tests/regression_tests/baselineShortFlight.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/regression_tests/baselineShortFlight.mat -------------------------------------------------------------------------------- /tests/regression_tests/baselineShortFlight_Accel.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/regression_tests/baselineShortFlight_Accel.mat -------------------------------------------------------------------------------- /tests/regression_tests/baselineShortFlight_SF_Accel.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/regression_tests/baselineShortFlight_SF_Accel.mat -------------------------------------------------------------------------------- /tests/regression_tests/baselineShortFlight_SIL.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/regression_tests/baselineShortFlight_SIL.mat -------------------------------------------------------------------------------- /tests/regression_tests/regression_tests.mldatx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/tests/regression_tests/regression_tests.mldatx -------------------------------------------------------------------------------- /tests/runTestsuite.m: -------------------------------------------------------------------------------- 1 | function runTestsuite(tags) 2 | 3 | arguments 4 | tags {mustBeText} = ''; 5 | end 6 | 7 | import matlab.unittest.TestRunner; 8 | import matlab.unittest.TestSuite; 9 | import matlab.unittest.Verbosity; 10 | import matlab.unittest.plugins.XMLPlugin; 11 | import matlab.unittest.plugins.TestReportPlugin; 12 | import matlab.unittest.selectors.HasTag; 13 | 14 | projObj = currentProject; 15 | 16 | suite = TestSuite.fromProject(projObj); 17 | if ~isempty(tags) 18 | suite = suite.selectIf(HasTag(tags)); 19 | end 20 | 21 | runner = TestRunner.withTextOutput('OutputDetail', Verbosity.Detailed); 22 | runner.addPlugin(XMLPlugin.producingJUnitFormat('results.xml')); 23 | runner.addPlugin(TestReportPlugin.producingPDF('results.pdf')); 24 | runner.addSimulinkTestResults(); 25 | 26 | results = runner.run(suite); 27 | 28 | if ~ismember('github',tags) 29 | % GitHub actions evaluate test success from Test Report 30 | disp(results.assertSuccess); 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /utilities/base_workspace_set_up.m: -------------------------------------------------------------------------------- 1 | function base_workspace_set_up() 2 | 3 | % Load the dictionary data into the workspace 4 | evalin('base', 'dd'); 5 | 6 | % Load the configuration sets for the models 7 | evalin('base', 'simConfigSet = sim_plant_configset;'); 8 | 9 | % Check if raspberrypi class (Raspberry Pi Support Package) is in MATLAB path 10 | if exist('raspberrypi','class') 11 | evalin('base', 'ctrlConfigSet = raspi_ctrl_configset;'); 12 | else 13 | warning('Simulink Support Package for Raspberry Pi Hardware is not installed.'); 14 | evalin('base', 'ctrlConfigSet = sim_plant_configset;'); 15 | end 16 | 17 | evalin('base', 'slrtConfigSet = slrt_plant_configset;'); 18 | 19 | end -------------------------------------------------------------------------------- /utilities/clean_up_project.m: -------------------------------------------------------------------------------- 1 | function clean_up_project() 2 | %clean_up_project Clean up local customizations of the task 3 | % 4 | % Clean up the task for the current project. This function undoes 5 | % the settings applied in "set_up_project". It is set to Run at Shutdown. 6 | % Copyright 2018 The MathWorks, Inc. 7 | 8 | % Close the task UI if one is open 9 | taskselobj = findall(groot, 'Name', 'Task Selection'); 10 | for sel_ctr = 1:length(taskselobj) 11 | taskselobj(sel_ctr).delete; 12 | end 13 | 14 | end 15 | -------------------------------------------------------------------------------- /utilities/models_set_up.m: -------------------------------------------------------------------------------- 1 | function models_set_up(selectedTask, isInteractiveMode) 2 | % Copyright 2018 The MathWorks, Inc. 3 | 4 | arguments 5 | selectedTask 6 | isInteractiveMode {mustBeNonnegative} = false 7 | end 8 | 9 | % Load PlantModel to enable setting the configuration set 10 | load_system('PlantModel'); 11 | 12 | switch selectedTask 13 | case {eTask.FlightControllerDesign, eTask.TestFlightController, eTask.FlightEnvelopeCharacterization} 14 | % Set the variant for QGroundControl 15 | evalin('base', 'useQGC = false;'); 16 | 17 | % Set the variant for Simulation Mode 18 | evalin('base', 'simMode=0;'); 19 | 20 | % Set the variant for Animation Mode 21 | evalin('base', 'animMode=0;'); 22 | 23 | % Set Sim as active configuration set for PlantModel 24 | setActiveConfigSet('PlantModel','Sim'); 25 | 26 | % Open the Simulation Model 27 | if isInteractiveMode 28 | open_system('simModel'); 29 | end 30 | 31 | % Let user know config is done 32 | disp ('Simulation Configuration Completed') 33 | 34 | case eTask.TestAutopilotCodeOffline 35 | % Set the variant for QGroundControl 36 | evalin('base', 'useQGC = false;'); 37 | 38 | % Set the variant for Simulation Mode 39 | evalin('base', 'simMode=1;'); 40 | 41 | % Set the variant for Animation Mode 42 | evalin('base', 'animMode=0;'); 43 | 44 | % Set Sim as active configuration set for PlantModel 45 | setActiveConfigSet('PlantModel','Sim'); 46 | 47 | % Open the Simulation Model 48 | if isInteractiveMode 49 | open_system('simModel'); 50 | end 51 | 52 | % Let user know config is done 53 | disp ('SIL Configuration Completed') 54 | 55 | case eTask.TestAutopilotCodeOnTarget 56 | % Set the variant for QGroundControl 57 | evalin('base', 'useQGC = false;'); 58 | 59 | % Set the variant for Simulation Mode 60 | evalin('base', 'simMode=2;'); 61 | 62 | % Set the variant for Animation Mode 63 | evalin('base', 'animMode=0;'); 64 | 65 | % Set Sim as active configuration set for PlantModel 66 | setActiveConfigSet('PlantModel','Sim'); 67 | 68 | % Open the Simulation Model 69 | if isInteractiveMode 70 | open_system('simModel'); 71 | end 72 | 73 | % Let user know config is done 74 | disp ('PIL Configuration Completed') 75 | 76 | case eTask.UAVSMECapabilities 77 | % Set the variant for QGroundControl 78 | evalin('base', 'useQGC = true;'); 79 | 80 | % Set the variant for Simulation Mode 81 | evalin('base', 'simMode=0;'); 82 | 83 | % Set the variant for Animation Mode 84 | evalin('base', 'animMode=1;'); 85 | 86 | % Set Sim as active configuration set for PlantModel 87 | setActiveConfigSet('PlantModel','Sim'); 88 | 89 | if isInteractiveMode 90 | % Open the Simulation Model 91 | open_system('simModel'); 92 | 93 | % Launch QGroundControl 94 | launchQGC; 95 | end 96 | 97 | % Let user know config is done 98 | disp ('Co-Simulation Configuration Completed') 99 | 100 | case eTask.SystemIntegrationTest 101 | % Set the variant for QGroundControl 102 | evalin('base', 'useQGC = true;'); 103 | 104 | % Set the variant for Simulation Mode 105 | evalin('base', 'simMode=0;'); 106 | 107 | % Set SLRT as active configuration set for PlantModel 108 | setActiveConfigSet('PlantModel','SLRT'); 109 | 110 | if isInteractiveMode 111 | % Open the Raspberry Pi Autopilot Model 112 | open_system('raspiAutopilotControlSystem'); 113 | 114 | % Open the SLRT Plant Model 115 | open_system('slrtPlantModel'); 116 | 117 | % Launch QGroundControl 118 | launchQGC; 119 | end 120 | 121 | % Let user know config is done 122 | disp ('HIL Configuration Completed') 123 | 124 | case eTask.RunRegressionTests 125 | runTestsuite; 126 | 127 | otherwise 128 | error('Function was called with an unsupported task') 129 | end 130 | 131 | end 132 | 133 | %% Subfunction launch QGC 134 | function launchQGC 135 | 136 | if ismac 137 | try 138 | !/Applications/QGroundControl.app/Contents/MacOS/QGroundControl& 139 | catch 140 | warning ('Seems like QGroundControl is not properly installed.'); 141 | end 142 | elseif isunix 143 | % Set here how to launch from Linux 144 | else 145 | [~,cmdout] = system('tasklist'); 146 | if ~contains(cmdout,'QGroundControl.exe') 147 | QGCexePath = fullfile(getenv('ProgramFiles'),'QGroundControl\QGroundControl.exe'); 148 | if isfile(QGCexePath) 149 | % Try starting QGroundControl if not already running 150 | system(['start "" /b "',QGCexePath,'"']); 151 | else 152 | warning('QGroundControl was not found in the default installation path.'); 153 | end 154 | end 155 | end 156 | 157 | end -------------------------------------------------------------------------------- /utilities/runfg_mac: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | cd /Applications/FlightGear.app/Contents/Resources 4 | 5 | ./../MacOS/fgfs --fg-root=./ --aircraft=Malolo1 --fdm=network,localhost,5501,5502,5503 --fog-fastest --disable-clouds --start-date-lat=2004:06:01:09:00:00 --disable-sound --in-air --enable-freeze --airport=BOS --runway=10L --altitude=150 --heading=90 --offset-distance=4.72 --offset-azimuth=0 --enable-terrasync 6 | -------------------------------------------------------------------------------- /utilities/set_up_project.m: -------------------------------------------------------------------------------- 1 | function set_up_project() 2 | %set_up_project: Configure the task for this project 3 | % 4 | % Set up the task for the current project. This function is set to 5 | % Run at Startup. 6 | % Copyright 2018 The MathWorks, Inc. 7 | 8 | %% Adding logic for initializing git submodule 9 | 10 | % Use Simulink Project API to get the current project: 11 | project = currentProject; 12 | % Set the location of slprj to be the "work" folder of the current project: 13 | projectRoot = project.RootFolder; 14 | 15 | % Initialize submodules directly 16 | submodulesList = {fullfile(projectRoot,'models','Autopilot','src','mavlink','missionlib')}; 17 | for i = 1:length(submodulesList) 18 | if ~isfolder(submodulesList{i}) 19 | if ~batchStartupOptionUsed 20 | choice_sub = questdlg('It looks like you do not have the submodule correctly initialized. Do you wish to set it up ? This will run !git submodule update --init', ... 21 | 'Git submodule missing', ... 22 | 'Yes','No', 'Yes'); 23 | if strcmp(choice_sub, 'Yes') 24 | try 25 | !git submodule update --init 26 | catch ME 27 | errordlg('Unable to setup git submodule', ... 28 | 'Git submodule setup Failed'); 29 | rethrow(ME); 30 | end 31 | end 32 | else 33 | error('Submodule ''%s'' is not initialized.',submodulesList{i}); 34 | end 35 | else 36 | fprintf('Submodule ''%s'' was found.\n',submodulesList{i}); 37 | end 38 | end 39 | 40 | end -------------------------------------------------------------------------------- /utilities/ui/convertListBoxTextToEnum.m: -------------------------------------------------------------------------------- 1 | function selTask = convertListBoxTextToEnum(listBoxValue) 2 | % This function converts the raw list box text into a "eTask" enumeration 3 | % 4 | % Copyright 2018 The MathWorks, Inc. 5 | 6 | switch listBoxValue 7 | case 'Flight Controller Design' 8 | selTask = eTask.FlightControllerDesign; 9 | case 'Test Flight Controller Under Different Conditions' 10 | selTask = eTask.TestFlightController; 11 | case 'Flight Envelope Characterization' 12 | selTask = eTask.FlightEnvelopeCharacterization; 13 | case 'UAV SME Capabilities Assessment' 14 | selTask = eTask.UAVSMECapabilities; 15 | case 'Test Correctness of the Autopilot’s Generated Code' 16 | selTask = eTask.TestAutopilotCodeOffline; 17 | case 'Deploy and Test Correctness of the Autopilot’s Generated Code' 18 | selTask = eTask.TestAutopilotCodeOnTarget; 19 | case 'System Integration Test' 20 | selTask = eTask.SystemIntegrationTest; 21 | case 'Run Regression Tests' 22 | selTask = eTask.RunRegressionTests; 23 | otherwise 24 | error(['Unsupported task ' listBoxValue ' in convertListBoxTextToEnum.m']) 25 | end 26 | -------------------------------------------------------------------------------- /utilities/ui/eTask.m: -------------------------------------------------------------------------------- 1 | classdef eTask < uint32 2 | % This enumeration defines all of the tasks that a user can select. 3 | % 4 | % Copyright 2018 The MathWorks, Inc. 5 | enumeration 6 | FlightControllerDesign (0) 7 | TestFlightController (1) 8 | FlightEnvelopeCharacterization (2) 9 | UAVSMECapabilities (3) 10 | TestAutopilotCodeOffline (4) 11 | TestAutopilotCodeOnTarget (5) 12 | SystemIntegrationTest (6) 13 | RunRegressionTests (7) 14 | end 15 | end -------------------------------------------------------------------------------- /utilities/ui/launchTaskSelectorApp.m: -------------------------------------------------------------------------------- 1 | % This function allows the app to be opened from the command line 2 | % 3 | % Copyright 2018 The MathWorks, Inc. 4 | if ~batchStartupOptionUsed 5 | taskSelectApplication; 6 | end -------------------------------------------------------------------------------- /utilities/ui/taskDescriptionCallback.m: -------------------------------------------------------------------------------- 1 | function [new_description, disabled] = taskDescriptionCallback(task) 2 | % This function determines what the description should say given the 3 | % installed toolboxes and support packages. 4 | % 5 | % Copyright 2018 The MathWorks, Inc. 6 | disabled = false; 7 | 8 | % These are the toolboxes needed to run ALL of the models 9 | [tlbox_not_installed, spkg_not_installed, no_license] = taskToolboxStatus(task); 10 | 11 | all_good = isempty(tlbox_not_installed) && isempty(spkg_not_installed) && isempty(no_license); 12 | 13 | if all_good 14 | switch task 15 | case eTask.FlightControllerDesign 16 | new_description = ['Enable a control systems engineer to develop a UAV autopilot' ... 17 | ' and test its behavior in a realistic 6DOF aircraft simulation. ']; 18 | case eTask.TestFlightController 19 | new_description = ['Enable a Controls System Engineer to rapidly assess the performance' ... 20 | ' of an autopilot under many conditions. This command should be executed at' ... 21 | ' the command line to start the process: ' char(13) ' >> runparsim(, 0, '''')']; 22 | case eTask.FlightEnvelopeCharacterization 23 | new_description = ['Enable a Flight Engineer to rapidly characterize the aircraft�s' ... 24 | ' performance under a wide range of environmental and initial conditions. One' ... 25 | ' of the commands below should be executed at' ... 26 | ' the command line to start the process: ' char(13)]; 27 | 28 | clstr_profs = parallel.clusterProfiles; 29 | for idx = 1:length(clstr_profs) 30 | new_description = [new_description '>> runparsim(, 1, ''' clstr_profs{idx} ''')' char(13)]; %#ok 31 | end 32 | 33 | case eTask.UAVSMECapabilities 34 | new_description = ['Demonstrate, early in the design process, the UAV�s' .... 35 | ' capabilities to a Subject Matter Expert and gather feedback on usability and its functionality. ']; 36 | 37 | case eTask.TestAutopilotCodeOffline 38 | new_description = ['Test the autopilot�s generated code on a personal' ... 39 | ' computer for same results (within bounds) of the designed autopilot. ']; 40 | 41 | case eTask.TestAutopilotCodeOnTarget 42 | new_description = ['Test the autopilot�s generated code on a development' ... 43 | ' board for same results (within bounds) of the designed autopilot.' ]; 44 | 45 | case eTask.SystemIntegrationTest 46 | new_description = ['Test the autopilot controller deployed in the' ... 47 | ' development board with real-time simulated data from a realistic' ... 48 | ' 6DOF aircraft simulation']; 49 | 50 | case eTask.RunRegressionTests 51 | new_description = 'Run Regression tests locally.'; 52 | 53 | otherwise 54 | error('Unsupported task in taskDescriptionCallback') 55 | end 56 | else 57 | switch task 58 | case eTask.FlightControllerDesign 59 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 60 | disabled = true; 61 | 62 | case eTask.TestFlightController 63 | pct_match = contains(tlbox_not_installed, 'Parallel Computing Toolbox'); 64 | if length(tlbox_not_installed) == 1 && any(pct_match) 65 | new_description = ['Enable a Controls System Engineer to rapidly assess the performance' ... 66 | ' of an autopilot under many conditions. This command should be executed at' ... 67 | ' the command line to start the process: ' char(13) ' >> runparsim(,0, '''')' ... 68 | char(13) char(13) 'Parallel Computing Toolbox is not installed, so the simulation will run serially.']; 69 | else 70 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 71 | disabled = true; 72 | end 73 | 74 | case eTask.FlightEnvelopeCharacterization 75 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 76 | disabled = true; 77 | 78 | case eTask.UAVSMECapabilities 79 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 80 | disabled = true; 81 | 82 | case eTask.TestAutopilotCodeOffline 83 | % Special logic needed to take into account the raspberry pi 84 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 85 | if ~isempty(new_description) 86 | disabled = true; 87 | end 88 | 89 | %Check Support packages 90 | rpi_match = contains(spkg_not_installed, 'Simulink Support Package for Raspberry Pi Hardware'); 91 | if any(rpi_match) 92 | new_description = [new_description char(13) char(13) 'The Simulink Raspberry Pi support package needs to be installed to build and download to the Raspberry Pi.']; 93 | end 94 | case eTask.TestAutopilotCodeOnTarget 95 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 96 | disabled = true; 97 | 98 | case eTask.SystemIntegrationTest 99 | % Special logic needed to take into account the raspberry pi 100 | % and slrt 101 | if ismac || isunix 102 | %Remove SLRT from list if this is a mac or linux. Instead, add 103 | %warning about the ability to execute SLRT plant model 104 | slrt_str = 'Simulink Real-Time is not available on the Mac or Linux. The plant model can be viewed only.'; 105 | tlbox_not_installed = setdiff(tlbox_not_installed, {'MATLAB Coder', 'Simulink Real-Time'}); 106 | else 107 | slrt_str = ''; 108 | end 109 | 110 | if ~isempty(tlbox_not_installed) 111 | new_description = descriptionForUninstalledToolboxes(tlbox_not_installed); 112 | disabled = true; 113 | else 114 | new_description = ['This task is intended to demonstrate the interaction in a hardware in the loop' ... 115 | 'system. There are two models, one for the controller on a Raspberry Pi and one for the ' ... 116 | 'plant which will run via Simulink Real Time.']; 117 | end 118 | 119 | if ~isempty(slrt_str) 120 | new_description = [new_description char(13) char(13) slrt_str]; 121 | end 122 | 123 | %Check Support packages 124 | rpi_match = contains(spkg_not_installed, 'Simulink Support Package for Raspberry Pi Hardware'); 125 | if any(rpi_match) 126 | new_description = [new_description char(13) char(13) 'The Simulink Raspberry Pi support package needs to be installed to build and download to the Raspberry Pi.']; 127 | end 128 | 129 | otherwise 130 | error('Unsupported task in taskDescriptionCallback') 131 | end 132 | 133 | end 134 | end 135 | 136 | function description_str = descriptionForUninstalledToolboxes(toolboxes) 137 | 138 | if ~isempty(toolboxes) 139 | description_str = ['The following toolboxes are required and not installed: ' char(13)]; 140 | 141 | for tlbx_ctr = 1:length(toolboxes) 142 | description_str = [description_str char(13) toolboxes{tlbx_ctr}]; %#ok 143 | end 144 | 145 | description_str = [description_str char(13) char(13) 'Without these toolboxes, the task will not function properly. Please install.']; 146 | else 147 | description_str = ''; 148 | end 149 | end 150 | -------------------------------------------------------------------------------- /utilities/ui/taskSelectApplication.mlapp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mathworks/simulinkDroneReferenceApp/4d1cde3f2996b917aac9e0d0d3a6d9b912608bdb/utilities/ui/taskSelectApplication.mlapp -------------------------------------------------------------------------------- /utilities/ui/taskShutdownCallback.m: -------------------------------------------------------------------------------- 1 | function abort = taskShutdownCallback(sel_task) 2 | % This function tears down the specified task 3 | % 4 | % Copyright 2018 The MathWorks, Inc. 5 | abort = false; 6 | 7 | switch sel_task 8 | case eTask.FlightControllerDesign 9 | model_list = {'simModel'}; 10 | case eTask.UAVSMECapabilities 11 | model_list = {'simModel'}; 12 | case eTask.SystemIntegrationTest 13 | model_list = {'raspiAutopilotControlSystem', 'slrtPlantModel'}; 14 | case eTask.TestAutopilotCodeOffline 15 | model_list = {'simModel'}; 16 | case eTask.TestAutopilotCodeOnTarget 17 | model_list = {'simModel'}; 18 | case eTask.TestFlightController 19 | model_list = {}; 20 | case eTask.FlightEnvelopeCharacterization 21 | model_list = {}; 22 | case eTask.RunRegressionTests 23 | model_list = {}; 24 | otherwise 25 | error('Unsupported task in taskShutdownCallback') 26 | end 27 | 28 | for model_ctr = 1:length(model_list) 29 | model = model_list{model_ctr}; 30 | if bdIsLoaded(model) 31 | if isequal(get_param(model, 'Dirty'), 'off') 32 | close_system(model, 0); 33 | else 34 | message_str = ['Do you want to lose all unsaved changes to model ' char(model) ' ? Y/N [Y]:']; 35 | choice = questdlg(char(message_str), ... 36 | 'Lose unsaved changed?', 'Yes', 'No', 'No'); 37 | 38 | % Handle response 39 | switch choice 40 | case 'Yes' 41 | close_system(model, 0); 42 | case 'No' 43 | % Skip the rest of the operation 44 | abort = true; 45 | otherwise 46 | % Skip the rest of the operation 47 | abort = true; 48 | end 49 | end 50 | end 51 | end % for model_ctr = 1:length(models_to_close) 52 | 53 | if ~abort 54 | %Shut down the current task 55 | evalin('base', 'clearvars'); 56 | end 57 | 58 | -------------------------------------------------------------------------------- /utilities/ui/taskToolboxStatus.m: -------------------------------------------------------------------------------- 1 | function [tlbox_not_installed, spkg_not_installed, no_license] = taskToolboxStatus(sel_task) 2 | % This function determines the licensing and installation status for all 3 | % required toolboxes and support packages. 4 | % 5 | % Copyright 2018 The MathWorks, Inc. 6 | no_license = {}; 7 | 8 | % These are the toolboxes needed to run ALL of the models 9 | base_tlbxs = { ... 10 | 'Simulink' ... 11 | 'Stateflow' ... 12 | 'Control System Toolbox' ... % "zpk" is used in the controller model 13 | 'Aerospace Blockset' ... 14 | }; 15 | 16 | base_spkgs = {}; 17 | 18 | switch sel_task 19 | case eTask.FlightControllerDesign 20 | extra_tlbxs = {}; 21 | extra_spkgs = {}; 22 | case eTask.UAVSMECapabilities 23 | extra_tlbxs = {}; 24 | extra_spkgs = {}; 25 | case eTask.SystemIntegrationTest 26 | extra_tlbxs = { ... 27 | 'Simulink Coder' ... 28 | 'Embedded Coder' ... 29 | 'MATLAB Coder' ... % Required by Simulink Real-Time 30 | 'Simulink Real-Time' ... 31 | }; 32 | %This is the master list of required support packages 33 | extra_spkgs = { ... 34 | 'Simulink Support Package for Raspberry Pi Hardware' ... 35 | }; 36 | 37 | case eTask.TestAutopilotCodeOffline 38 | extra_tlbxs = { ... 39 | 'Simulink Coder' ... 40 | 'Embedded Coder' ... 41 | }; 42 | extra_spkgs = { ... 43 | 'Simulink Support Package for Raspberry Pi Hardware' ... 44 | }; 45 | 46 | case eTask.TestAutopilotCodeOnTarget 47 | extra_tlbxs = { ... 48 | 'Simulink Coder' ... 49 | 'Embedded Coder' ... 50 | }; 51 | 52 | extra_spkgs = { ... 53 | 'Simulink Support Package for Raspberry Pi Hardware' ... 54 | }; 55 | 56 | case eTask.TestFlightController 57 | extra_tlbxs = { ... 58 | 'Parallel Computing Toolbox' ... 59 | }; 60 | extra_spkgs = {}; 61 | 62 | case eTask.FlightEnvelopeCharacterization 63 | extra_tlbxs = { ... 64 | 'Parallel Computing Toolbox' ... 65 | }; 66 | extra_spkgs = {}; 67 | 68 | case eTask.RunRegressionTests 69 | extra_tlbxs = { ... 70 | 'Simulink Test' ... 71 | }; 72 | extra_spkgs = {}; 73 | 74 | otherwise 75 | error('Unsupported task in taskToolboxStatus.m') 76 | end 77 | 78 | all_installed_tlbxs = ver; 79 | all_installed_tlbx_names = {all_installed_tlbxs.Name}; 80 | 81 | % Fuse the base and the "extra" together 82 | all_tlbxs = [base_tlbxs extra_tlbxs]; 83 | 84 | tlbox_not_installed = {}; 85 | for tlbx_ctr = 1:length(all_tlbxs) 86 | tlbx = all_tlbxs{tlbx_ctr}; 87 | 88 | if ~any(strcmp(tlbx, all_installed_tlbx_names)) 89 | %fail to find a required toolbox 90 | tlbox_not_installed{end+1} = tlbx; %#ok 91 | else 92 | % Verify that the product has a license 93 | productidentifier = com.mathworks.product.util.ProductIdentifier.get(tlbx); 94 | feature = char(productidentifier.getFlexName()); 95 | 96 | if ~license('checkout',feature) 97 | % if made it here, the license isn't available 98 | no_license{end+1} = tlbx; %#ok 99 | end 100 | 101 | end 102 | end 103 | 104 | all_spkgs = [base_spkgs extra_spkgs]; 105 | 106 | all_installed_spkgs = matlabshared.supportpkg.getInstalled; 107 | if ~isempty(all_installed_spkgs) 108 | all_installed_spkgs_names = {all_installed_spkgs.Name}; 109 | else 110 | all_installed_spkgs_names = {}; 111 | end 112 | 113 | spkg_not_installed = {}; 114 | for spkg_ctr = 1:length(all_spkgs) 115 | spkg = all_spkgs{spkg_ctr}; 116 | 117 | if ~any(strcmp(spkg, all_installed_spkgs_names)) 118 | %fail to find a required support package 119 | spkg_not_installed{end+1} = spkg; %#ok 120 | end 121 | end 122 | --------------------------------------------------------------------------------