diff --git a/controls/model/Quadcopter_Model_R2015_A.mdl b/controls/model/Quadcopter_Model_R2015_A.mdl new file mode 100644 index 0000000000000000000000000000000000000000..1ce8804095f97383c65bf5506d2a66c794009662 --- /dev/null +++ b/controls/model/Quadcopter_Model_R2015_A.mdl @@ -0,0 +1,9318 @@ +Model { + Name "Quadcopter_Model_R2015_A" + Version 8.5 + SavedCharacterEncoding "windows-1252" + GraphicalInterface { + NumRootInports 0 + NumRootOutports 0 + ParameterArgumentNames "" + ComputedModelVersion "1.351" + NumModelReferences 0 + NumTestPointedSignals 0 + } + ScopeRefreshTime 0.035000 + OverrideScopeRefreshTime on + DisableAllScopes off + DataTypeOverride "UseLocalSettings" + DataTypeOverrideAppliesTo "AllNumericTypes" + MinMaxOverflowLogging "UseLocalSettings" + MinMaxOverflowArchiveMode "Overwrite" + FPTRunName "Run 1" + MaxMDLFileLineLength 120 + Object { + $PropName "BdWindowsInfo" + $ObjectID 1 + $ClassName "Simulink.BDWindowsInfo" + Object { + $PropName "WindowsInfo" + $ObjectID 2 + $ClassName "Simulink.WindowInfo" + IsActive [1] + Location [-8.0, -8.0, 1936.0, 1056.0] + Object { + $PropName "ModelBrowserInfo" + $ObjectID 3 + $ClassName "Simulink.ModelBrowserInfo" + Visible [0] + DockPosition "Left" + Width [50] + Height [50] + Filter [9] + } + Object { + $PropName "ExplorerBarInfo" + $ObjectID 4 + $ClassName "Simulink.ExplorerBarInfo" + Visible [1] + } + Array { + Type "Simulink.EditorInfo" + Dimension 2 + Object { + $ObjectID 5 + IsActive [0] + ViewObjType "SimulinkSubsys" + LoadSaveID "541" + Extents [1755.0, 874.0] + ZoomFactor [1.5] + Offset [-408.3367559523798, 164.59047619047868] + } + Object { + $ObjectID 6 + IsActive [1] + ViewObjType "SimulinkTopLevel" + LoadSaveID "0" + Extents [1755.0, 874.0] + ZoomFactor [1.5] + Offset [661.09523809523807, 324.57142857142884] + } + PropName "EditorsInfo" + } + } + } + Created "Mon Oct 17 15:29:19 2016" + Creator "Andy" + UpdateHistory "UpdateHistoryNever" + ModifiedByFormat "%<Auto>" + LastModifiedBy "Andy" + ModifiedDateFormat "%<Auto>" + LastModifiedDate "Mon Dec 05 22:25:03 2016" + RTWModifiedTimeStamp 402877502 + ModelVersionFormat "1.%<AutoIncrement:351>" + ConfigurationManager "none" + SampleTimeColors off + SampleTimeAnnotations off + LibraryLinkDisplay "disabled" + WideLines off + ShowLineDimensions off + ShowPortDataTypes off + ShowDesignRanges off + ShowLoopsOnError on + IgnoreBidirectionalLines off + ShowStorageClass off + ShowTestPointIcons on + ShowSignalResolutionIcons on + ShowViewerIcons on + SortedOrder off + ExecutionContextIcon off + ShowLinearizationAnnotations on + ShowMarkup on + BlockNameDataTip off + BlockParametersDataTip off + BlockDescriptionStringDataTip off + ToolBar on + StatusBar on + BrowserShowLibraryLinks off + BrowserLookUnderMasks off + SimulationMode "normal" + PauseTimes "5" + NumberOfSteps 1 + SnapshotBufferSize 10 + SnapshotInterval 10 + NumberOfLastSnapshots 0 + LinearizationMsg "none" + Profile off + ParamWorkspaceSource "MATLABWorkspace" + AccelSystemTargetFile "accel.tlc" + AccelTemplateMakefile "accel_default_tmf" + AccelMakeCommand "make_rtw" + TryForcingSFcnDF off + Object { + $PropName "DataLoggingOverride" + $ObjectID 8 + $ClassName "Simulink.SimulationData.ModelLoggingInfo" + model_ "Quadcopter_Model_R2015_A" + overrideMode_ [0.0] + Array { + Type "Cell" + Dimension 1 + Cell "Quadcopter_Model_R2015_A" + PropName "logAsSpecifiedByModels_" + } + Array { + Type "Cell" + Dimension 1 + Cell [] + PropName "logAsSpecifiedByModelsSSIDs_" + } + } + Object { + $PropName "InstrumentedSignals" + $ObjectID 9 + $ClassName "Simulink.HMI.InstrumentedSignals" + Persistence [] + } + RecordCoverage off + CovPath "/" + CovSaveName "covdata" + CovMetricSettings "dwe" + CovNameIncrementing off + CovHtmlReporting off + CovForceBlockReductionOff on + CovEnableCumulative on + covSaveCumulativeToWorkspaceVar off + CovSaveSingleToWorkspaceVar off + CovCumulativeVarName "covCumulativeData" + CovCumulativeReport off + CovReportOnPause on + CovModelRefEnable "Off" + CovExternalEMLEnable on + CovSFcnEnable on + CovBoundaryAbsTol 0.000010 + CovBoundaryRelTol 0.010000 + CovUseTimeInterval off + CovStartTime 0 + CovStopTime 0 + ExtModeBatchMode off + ExtModeEnableFloating on + ExtModeTrigType "manual" + ExtModeTrigMode "normal" + ExtModeTrigPort "1" + ExtModeTrigElement "any" + ExtModeTrigDuration 1000 + ExtModeTrigDurationFloating "auto" + ExtModeTrigHoldOff 0 + ExtModeTrigDelay 0 + ExtModeTrigDirection "rising" + ExtModeTrigLevel 0 + ExtModeArchiveMode "off" + ExtModeAutoIncOneShot off + ExtModeIncDirWhenArm off + ExtModeAddSuffixToVar off + ExtModeWriteAllDataToWs off + ExtModeArmWhenConnect on + ExtModeSkipDownloadWhenConnect off + ExtModeLogAll on + ExtModeAutoUpdateStatusClock on + ShowModelReferenceBlockVersion off + ShowModelReferenceBlockIO off + Array { + Type "Handle" + Dimension 1 + Simulink.ConfigSet { + $ObjectID 10 + Version "1.15.0" + Array { + Type "Handle" + Dimension 8 + Simulink.SolverCC { + $ObjectID 11 + Version "1.15.0" + StartTime "0.0" + StopTime "20" + AbsTol "auto" + FixedStep "auto" + InitialStep "auto" + MaxNumMinSteps "-1" + MaxOrder 5 + ZcThreshold "auto" + ConsecutiveZCsStepRelTol "10*128*eps" + MaxConsecutiveZCs "1000" + ExtrapolationOrder 4 + NumberNewtonIterations 1 + MaxStep "auto" + MinStep "auto" + MaxConsecutiveMinStep "1" + RelTol "1e-3" + SolverMode "SingleTasking" + EnableConcurrentExecution off + ConcurrentTasks off + Solver ode45 + SolverName ode45 + SolverJacobianMethodControl "auto" + ShapePreserveControl "DisableAll" + ZeroCrossControl "UseLocalSettings" + ZeroCrossAlgorithm "Nonadaptive" + AlgebraicLoopSolver "TrustRegion" + SolverResetMethod "Fast" + PositivePriorityOrder off + AutoInsertRateTranBlk off + SampleTimeConstraint "Unconstrained" + InsertRTBMode "Whenever possible" + } + Simulink.DataIOCC { + $ObjectID 12 + Version "1.15.0" + Decimation "1" + ExternalInput "[t, u]" + FinalStateName "xFinal" + InitialState "xInitial" + LimitDataPoints off + MaxDataPoints "1000" + LoadExternalInput off + LoadInitialState off + SaveFinalState off + SaveCompleteFinalSimState off + SaveFormat "Dataset" + SignalLoggingSaveFormat "Dataset" + SaveOutput on + SaveState off + SignalLogging on + DSMLogging on + InspectSignalLogs off + VisualizeSimOutput on + SaveTime on + ReturnWorkspaceOutputs off + StateSaveName "xout" + TimeSaveName "tout" + OutputSaveName "yout" + SignalLoggingName "logsout" + DSMLoggingName "dsmout" + OutputOption "RefineOutputTimes" + OutputTimes "[]" + ReturnWorkspaceOutputsName "out" + Refine "1" + } + Simulink.OptimizationCC { + $ObjectID 13 + Version "1.15.0" + Array { + Type "Cell" + Dimension 8 + Cell "BooleansAsBitfields" + Cell "PassReuseOutputArgsAs" + Cell "PassReuseOutputArgsThreshold" + Cell "ZeroExternalMemoryAtStartup" + Cell "ZeroInternalMemoryAtStartup" + Cell "OptimizeModelRefInitCode" + Cell "NoFixptDivByZeroProtection" + Cell "UseSpecifiedMinMax" + PropName "DisabledProps" + } + BlockReduction on + BooleanDataType on + ConditionallyExecuteInputs on + InlineParams off + UseDivisionForNetSlopeComputation "off" + UseFloatMulNetSlope off + DefaultUnderspecifiedDataType "double" + UseSpecifiedMinMax off + InlineInvariantSignals off + OptimizeBlockIOStorage on + BufferReuse on + EnhancedBackFolding off + CachingGlobalReferences off + GlobalBufferReuse on + StrengthReduction off + ExpressionFolding on + BooleansAsBitfields off + BitfieldContainerType "uint_T" + EnableMemcpy on + MemcpyThreshold 64 + PassReuseOutputArgsAs "Structure reference" + PassReuseOutputArgsThreshold 12 + ExpressionDepthLimit 128 + LocalBlockOutputs on + RollThreshold 5 + StateBitsets off + DataBitsets off + ActiveStateOutputEnumStorageType "Native Integer" + ZeroExternalMemoryAtStartup on + ZeroInternalMemoryAtStartup on + InitFltsAndDblsToZero off + NoFixptDivByZeroProtection off + EfficientFloat2IntCast off + EfficientMapNaN2IntZero on + OptimizeModelRefInitCode off + LifeSpan "inf" + MaxStackSize "Inherit from target" + BufferReusableBoundary on + SimCompilerOptimization "off" + AccelVerboseBuild off + } + Simulink.DebuggingCC { + $ObjectID 14 + Version "1.15.0" + RTPrefix "error" + ConsistencyChecking "none" + ArrayBoundsChecking "none" + SignalInfNanChecking "none" + SignalRangeChecking "none" + ReadBeforeWriteMsg "UseLocalSettings" + WriteAfterWriteMsg "UseLocalSettings" + WriteAfterReadMsg "UseLocalSettings" + AlgebraicLoopMsg "warning" + ArtificialAlgebraicLoopMsg "warning" + SaveWithDisabledLinksMsg "warning" + SaveWithParameterizedLinksMsg "warning" + CheckSSInitialOutputMsg on + UnderspecifiedInitializationDetection "Simplified" + MergeDetectMultiDrivingBlocksExec "error" + CheckExecutionContextPreStartOutputMsg off + CheckExecutionContextRuntimeOutputMsg off + SignalResolutionControl "UseLocalSettings" + BlockPriorityViolationMsg "warning" + MinStepSizeMsg "warning" + TimeAdjustmentMsg "none" + MaxConsecutiveZCsMsg "error" + MaskedZcDiagnostic "warning" + IgnoredZcDiagnostic "warning" + SolverPrmCheckMsg "none" + InheritedTsInSrcMsg "warning" + MultiTaskDSMMsg "error" + MultiTaskCondExecSysMsg "error" + MultiTaskRateTransMsg "error" + SingleTaskRateTransMsg "none" + TasksWithSamePriorityMsg "warning" + SigSpecEnsureSampleTimeMsg "warning" + CheckMatrixSingularityMsg "none" + IntegerOverflowMsg "warning" + Int32ToFloatConvMsg "warning" + ParameterDowncastMsg "error" + ParameterOverflowMsg "error" + ParameterUnderflowMsg "none" + ParameterPrecisionLossMsg "warning" + ParameterTunabilityLossMsg "warning" + FixptConstUnderflowMsg "none" + FixptConstOverflowMsg "none" + FixptConstPrecisionLossMsg "none" + UnderSpecifiedDataTypeMsg "none" + UnnecessaryDatatypeConvMsg "none" + VectorMatrixConversionMsg "none" + InvalidFcnCallConnMsg "error" + FcnCallInpInsideContextMsg "EnableAllAsError" + SignalLabelMismatchMsg "none" + UnconnectedInputMsg "warning" + UnconnectedOutputMsg "warning" + UnconnectedLineMsg "warning" + SFcnCompatibilityMsg "none" + FrameProcessingCompatibilityMsg "error" + UniqueDataStoreMsg "none" + BusObjectLabelMismatch "warning" + RootOutportRequireBusObject "warning" + AssertControl "UseLocalSettings" + ModelReferenceIOMsg "none" + ModelReferenceMultiInstanceNormalModeStructChecksumCheck "error" + ModelReferenceVersionMismatchMessage "none" + ModelReferenceIOMismatchMessage "none" + UnknownTsInhSupMsg "warning" + ModelReferenceDataLoggingMessage "warning" + ModelReferenceSymbolNameMessage "warning" + ModelReferenceExtraNoncontSigs "error" + StateNameClashWarn "none" + SimStateInterfaceChecksumMismatchMsg "warning" + SimStateOlderReleaseMsg "error" + InitInArrayFormatMsg "warning" + StrictBusMsg "ErrorLevel1" + BusNameAdapt "WarnAndRepair" + NonBusSignalsTreatedAsBus "none" + BlockIODiagnostic "none" + SFUnusedDataAndEventsDiag "warning" + SFUnexpectedBacktrackingDiag "error" + SFInvalidInputDataAccessInChartInitDiag "warning" + SFNoUnconditionalDefaultTransitionDiag "error" + SFTransitionOutsideNaturalParentDiag "warning" + SFUnconditionalTransitionShadowingDiag "warning" + SFUndirectedBroadcastEventsDiag "warning" + SFTransitionActionBeforeConditionDiag "warning" + SFOutputUsedAsStateInMooreChartDiag "error" + IntegerSaturationMsg "warning" + } + Simulink.HardwareCC { + $ObjectID 15 + Version "1.15.0" + ProdBitPerChar 8 + ProdBitPerShort 16 + ProdBitPerInt 32 + ProdBitPerLong 32 + ProdBitPerLongLong 64 + ProdBitPerFloat 32 + ProdBitPerDouble 64 + ProdBitPerPointer 64 + ProdLargestAtomicInteger "Char" + ProdLargestAtomicFloat "Float" + ProdIntDivRoundTo "Zero" + ProdEndianess "LittleEndian" + ProdWordSize 32 + ProdShiftRightIntArith on + ProdLongLongMode off + ProdHWDeviceType "Specified" + TargetBitPerChar 8 + TargetBitPerShort 16 + TargetBitPerInt 32 + TargetBitPerLong 32 + TargetBitPerLongLong 64 + TargetBitPerFloat 32 + TargetBitPerDouble 64 + TargetBitPerPointer 32 + TargetLargestAtomicInteger "Char" + TargetLargestAtomicFloat "None" + TargetShiftRightIntArith on + TargetLongLongMode off + TargetIntDivRoundTo "Undefined" + TargetEndianess "Unspecified" + TargetWordSize 32 + TargetPreprocMaxBitsSint 32 + TargetPreprocMaxBitsUint 32 + TargetHWDeviceType "Specified" + TargetUnknown off + ProdEqTarget on + } + Simulink.ModelReferenceCC { + $ObjectID 16 + Version "1.15.0" + UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange" + CheckModelReferenceTargetMessage "error" + EnableParallelModelReferenceBuilds off + ParallelModelReferenceErrorOnInvalidPool on + ParallelModelReferenceMATLABWorkerInit "None" + ModelReferenceNumInstancesAllowed "Multi" + PropagateVarSize "Infer from blocks in model" + ModelReferencePassRootInputsByReference on + ModelReferenceMinAlgLoopOccurrences off + PropagateSignalLabelsOutOfModel on + SupportModelReferenceSimTargetCustomCode off + } + Simulink.SFSimCC { + $ObjectID 17 + Version "1.15.0" + SFSimEcho on + SimCtrlC on + SimIntegrity on + SimUseLocalCustomCode off + SimParseCustomCode on + SimBuildMode "sf_incremental_build" + SimGenImportedTypeDefs off + } + Simulink.RTWCC { + $BackupClass "Simulink.RTWCC" + $ObjectID 18 + Version "1.15.0" + Array { + Type "Cell" + Dimension 13 + Cell "IncludeHyperlinkInReport" + Cell "GenerateTraceInfo" + Cell "GenerateTraceReport" + Cell "GenerateTraceReportSl" + Cell "GenerateTraceReportSf" + Cell "GenerateTraceReportEml" + Cell "PortableWordSizes" + Cell "GenerateWebview" + Cell "GenerateCodeMetricsReport" + Cell "GenerateCodeReplacementReport" + Cell "GenerateMissedCodeReplacementReport" + Cell "GenerateErtSFunction" + Cell "CreateSILPILBlock" + PropName "DisabledProps" + } + SystemTargetFile "grt.tlc" + TLCOptions "" + GenCodeOnly off + MakeCommand "make_rtw" + GenerateMakefile on + PackageGeneratedCodeAndArtifacts off + TemplateMakefile "grt_default_tmf" + PostCodeGenCommand "" + GenerateReport off + SaveLog off + RTWVerbose on + RetainRTWFile off + ProfileTLC off + TLCDebug off + TLCCoverage off + TLCAssert off + RTWUseLocalCustomCode off + RTWUseSimCustomCode off + Toolchain "Automatically locate an installed toolchain" + BuildConfiguration "Faster Builds" + IncludeHyperlinkInReport off + LaunchReport off + PortableWordSizes off + CreateSILPILBlock "None" + CodeExecutionProfiling off + CodeExecutionProfileVariable "executionProfile" + CodeProfilingSaveOptions "SummaryOnly" + CodeProfilingInstrumentation off + SILDebugging off + TargetLang "C" + IncludeBusHierarchyInRTWFileBlockHierarchyMap off + GenerateTraceInfo off + GenerateTraceReport off + GenerateTraceReportSl off + GenerateTraceReportSf off + GenerateTraceReportEml off + GenerateWebview off + GenerateCodeMetricsReport off + GenerateCodeReplacementReport off + GenerateMissedCodeReplacementReport off + RTWCompilerOptimization "off" + RTWCustomCompilerOptimizations "" + CheckMdlBeforeBuild "Off" + SharedConstantsCachingThreshold 1024 + Array { + Type "Handle" + Dimension 2 + Simulink.CodeAppCC { + $ObjectID 19 + Version "1.15.0" + Array { + Type "Cell" + Dimension 25 + Cell "IgnoreCustomStorageClasses" + Cell "IgnoreTestpoints" + Cell "InsertBlockDesc" + Cell "InsertPolySpaceComments" + Cell "SFDataObjDesc" + Cell "MATLABFcnDesc" + Cell "SimulinkDataObjDesc" + Cell "DefineNamingRule" + Cell "SignalNamingRule" + Cell "ParamNamingRule" + Cell "InternalIdentifier" + Cell "InlinedPrmAccess" + Cell "CustomSymbolStr" + Cell "CustomSymbolStrGlobalVar" + Cell "CustomSymbolStrType" + Cell "CustomSymbolStrField" + Cell "CustomSymbolStrFcn" + Cell "CustomSymbolStrModelFcn" + Cell "CustomSymbolStrFcnArg" + Cell "CustomSymbolStrBlkIO" + Cell "CustomSymbolStrTmpVar" + Cell "CustomSymbolStrMacro" + Cell "CustomSymbolStrUtil" + Cell "CustomUserTokenString" + Cell "ReqsInCode" + PropName "DisabledProps" + } + ForceParamTrailComments off + GenerateComments on + CommentStyle "Auto" + IgnoreCustomStorageClasses on + IgnoreTestpoints off + IncHierarchyInIds off + MaxIdLength 31 + PreserveName off + PreserveNameWithParent off + ShowEliminatedStatement off + OperatorAnnotations off + IncAutoGenComments off + SimulinkDataObjDesc off + SFDataObjDesc off + MATLABFcnDesc off + IncDataTypeInIds off + MangleLength 1 + CustomSymbolStrGlobalVar "$R$N$M" + CustomSymbolStrType "$N$R$M_T" + CustomSymbolStrField "$N$M" + CustomSymbolStrFcn "$R$N$M$F" + CustomSymbolStrFcnArg "rt$I$N$M" + CustomSymbolStrBlkIO "rtb_$N$M" + CustomSymbolStrTmpVar "$N$M" + CustomSymbolStrMacro "$R$N$M" + CustomSymbolStrUtil "$N$C" + DefineNamingRule "None" + ParamNamingRule "None" + SignalNamingRule "None" + InsertBlockDesc off + InsertPolySpaceComments off + SimulinkBlockComments on + MATLABSourceComments off + EnableCustomComments off + InternalIdentifier "Shortened" + InlinedPrmAccess "Literals" + ReqsInCode off + UseSimReservedNames off + } + Simulink.GRTTargetCC { + $BackupClass "Simulink.TargetCC" + $ObjectID 20 + Version "1.15.0" + Array { + Type "Cell" + Dimension 15 + Cell "IncludeMdlTerminateFcn" + Cell "SuppressErrorStatus" + Cell "ERTCustomFileBanners" + Cell "GenerateSampleERTMain" + Cell "ExistingSharedCode" + Cell "GenerateTestInterfaces" + Cell "ModelStepFunctionPrototypeControlCompliant" + Cell "GenerateAllocFcn" + Cell "PurelyIntegerCode" + Cell "SupportComplex" + Cell "SupportAbsoluteTime" + Cell "SupportContinuousTime" + Cell "SupportNonInlinedSFcns" + Cell "RemoveDisableFunc" + Cell "RemoveResetFunc" + PropName "DisabledProps" + } + TargetFcnLib "ansi_tfl_table_tmw.mat" + TargetLibSuffix "" + TargetPreCompLibLocation "" + GenFloatMathFcnCalls "NOT IN USE" + TargetLangStandard "C99 (ISO)" + CodeReplacementLibrary "None" + UtilityFuncGeneration "Auto" + ERTMultiwordTypeDef "System defined" + ERTMultiwordLength 256 + MultiwordLength 2048 + GenerateFullHeader on + InferredTypesCompatibility off + GenerateSampleERTMain off + GenerateTestInterfaces off + ModelReferenceCompliant on + ParMdlRefBuildCompliant on + CompOptLevelCompliant on + ConcurrentExecutionCompliant on + IncludeMdlTerminateFcn on + GeneratePreprocessorConditionals "Use local settings" + CombineOutputUpdateFcns on + CombineSignalStateStructs off + SuppressErrorStatus off + ERTFirstTimeCompliant off + IncludeFileDelimiter "Auto" + ERTCustomFileBanners off + SupportAbsoluteTime on + LogVarNameModifier "rt_" + MatFileLogging on + MultiInstanceERTCode off + CodeInterfacePackaging "Nonreusable function" + SupportNonFinite on + SupportComplex on + PurelyIntegerCode off + SupportContinuousTime on + SupportNonInlinedSFcns on + SupportVariableSizeSignals off + ParenthesesLevel "Nominal" + CastingMode "Nominal" + MATLABClassNameForMDSCustomization "Simulink.SoftwareTarget.GRTCustomization" + ModelStepFunctionPrototypeControlCompliant off + CPPClassGenCompliant on + AutosarCompliant off + GRTInterface off + GenerateAllocFcn off + GenerateSharedConstants on + UseMalloc off + ExtMode off + ExtModeStaticAlloc off + ExtModeTesting off + ExtModeStaticAllocSize 1000000 + ExtModeTransport 0 + ExtModeMexFile "ext_comm" + ExtModeIntrfLevel "Level1" + RTWCAPISignals off + RTWCAPIParams off + RTWCAPIStates off + RTWCAPIRootIO off + GenerateASAP2 off + MultiInstanceErrorCode "Error" + } + PropName "Components" + } + } + PropName "Components" + } + Name "Configuration" + CurrentDlgPage "Solver" + ConfigPrmDlgPosition [ 195, 142, 1085, 882 ] + } + PropName "ConfigurationSets" + } + Simulink.ConfigSet { + $PropName "ActiveConfigurationSet" + $ObjectID 10 + } + Object { + $PropName "DataTransfer" + $ObjectID 22 + $ClassName "Simulink.GlobalDataTransfer" + DefaultTransitionBetweenSyncTasks "Ensure deterministic transfer (maximum delay)" + DefaultTransitionBetweenAsyncTasks "Ensure data integrity only" + DefaultTransitionBetweenContTasks "Ensure deterministic transfer (minimum delay)" + DefaultExtrapolationMethodBetweenContTasks "None" + AutoInsertRateTranBlk [0] + } + ExplicitPartitioning off + BlockDefaults { + ForegroundColor "black" + BackgroundColor "white" + DropShadow off + NamePlacement "normal" + FontName "Helvetica" + FontSize 10 + FontWeight "normal" + FontAngle "normal" + ShowName on + BlockRotation 0 + BlockMirror off + } + AnnotationDefaults { + HorizontalAlignment "center" + VerticalAlignment "middle" + ForegroundColor "black" + BackgroundColor "white" + DropShadow off + FontName "Helvetica" + FontSize 10 + FontWeight "normal" + FontAngle "normal" + UseDisplayTextAsClickCallback off + } + LineDefaults { + FontName "Helvetica" + FontSize 9 + FontWeight "normal" + FontAngle "normal" + } + MaskDefaults { + SelfModifiable "off" + IconFrame "on" + IconOpaque "on" + RunInitForIconRedraw "off" + IconRotate "none" + PortRotate "default" + IconUnits "autoscale" + } + MaskParameterDefaults { + Evaluate "on" + Tunable "on" + NeverSave "off" + Internal "off" + ReadOnly "off" + Enabled "on" + Visible "on" + ToolTip "on" + } + BlockParameterDefaults { + Block { + BlockType BusCreator + DisplayOption "none" + OutDataTypeStr "Inherit: auto" + NonVirtualBus off + } + Block { + BlockType BusSelector + OutputSignals "signal1,signal2,signal3" + OutputAsBus off + } + Block { + BlockType Constant + Value "1" + VectorParams1D on + SamplingMode "Sample based" + OutMin "[]" + OutMax "[]" + OutDataTypeStr "Inherit: Inherit from 'Constant value'" + LockScale off + SampleTime "inf" + FramePeriod "inf" + PreserveConstantTs off + } + Block { + BlockType Delay + DelayLengthSource "Dialog" + DelayLength "2" + DelayLengthUpperLimit "100" + InitialConditionSource "Dialog" + InitialCondition "0.0" + ExternalReset "None" + ShowEnablePort off + PreventDirectFeedthrough off + DiagnosticForOutOfRangeDelayLength "None" + RemoveProtectionDelayLength off + InputProcessing "Elements as channels (sample based)" + UseCircularBuffer off + SampleTime "-1" + StateMustResolveToSignalObject off + CodeGenStateStorageClass "Auto" + } + Block { + BlockType Demux + Outputs "4" + DisplayOption "none" + BusSelectionMode off + } + Block { + BlockType Gain + Gain "1" + Multiplication "Element-wise(K.*u)" + ParamMin "[]" + ParamMax "[]" + ParamDataTypeStr "Inherit: Same as input" + OutMin "[]" + OutMax "[]" + OutDataTypeStr "Inherit: Same as input" + LockScale off + RndMeth "Floor" + SaturateOnIntegerOverflow on + SampleTime "-1" + } + Block { + BlockType Ground + } + Block { + BlockType Inport + Port "1" + OutputFunctionCall off + OutMin "[]" + OutMax "[]" + OutDataTypeStr "Inherit: auto" + LockScale off + BusOutputAsStruct off + PortDimensions "-1" + VarSizeSig "Inherit" + SampleTime "-1" + SignalType "auto" + SamplingMode "auto" + LatchByDelayingOutsideSignal off + LatchInputForFeedbackSignals off + Interpolate on + } + Block { + BlockType Integrator + ExternalReset "none" + InitialConditionSource "internal" + InitialCondition "0" + LimitOutput off + UpperSaturationLimit "inf" + LowerSaturationLimit "-inf" + WrapState off + WrappedStateUpperValue "pi" + WrappedStateLowerValue "-pi" + ShowSaturationPort off + ShowStatePort off + AbsoluteTolerance "auto" + IgnoreLimit off + ZeroCross on + ContinuousStateAttributes "''" + } + Block { + BlockType Mux + Inputs "4" + DisplayOption "none" + UseBusObject off + BusObject "BusObject" + NonVirtualBus off + } + Block { + BlockType Outport + Port "1" + OutMin "[]" + OutMax "[]" + OutDataTypeStr "Inherit: auto" + LockScale off + BusOutputAsStruct off + PortDimensions "-1" + VarSizeSig "Inherit" + SampleTime "-1" + SignalType "auto" + SamplingMode "auto" + SourceOfInitialOutputValue "Dialog" + OutputWhenDisabled "held" + InitialOutput "[]" + } + Block { + BlockType Quantizer + QuantizationInterval "0.5" + LinearizeAsGain on + SampleTime "-1" + } + Block { + BlockType RandomNumber + Mean "0" + Variance "1" + Seed "0" + SampleTime "-1" + VectorParams1D on + } + Block { + BlockType RateTransition + Integrity on + Deterministic on + X0 "0" + OutPortSampleTimeOpt "Specify" + OutPortSampleTimeMultiple "1" + OutPortSampleTime "-1" + } + Block { + BlockType S-Function + FunctionName "system" + SFunctionModules "''" + PortCounts "[]" + } + Block { + BlockType Scope + Floating off + } + Block { + BlockType Step + Time "1" + Before "0" + After "1" + SampleTime "-1" + VectorParams1D on + ZeroCross on + } + Block { + BlockType SubSystem + ShowPortLabels "FromPortIcon" + Permissions "ReadWrite" + PermitHierarchicalResolution "All" + TreatAsAtomicUnit off + MinAlgLoopOccurrences off + PropExecContextOutsideSubsystem off + SystemSampleTime "-1" + RTWSystemCode "Auto" + RTWFcnNameOpts "Auto" + RTWFileNameOpts "Auto" + FunctionInterfaceSpec "void_void" + FunctionWithSeparateData off + RTWMemSecFuncInitTerm "Inherit from model" + RTWMemSecFuncExecute "Inherit from model" + RTWMemSecDataConstants "Inherit from model" + RTWMemSecDataInternal "Inherit from model" + RTWMemSecDataParameters "Inherit from model" + SimViewingDevice off + DataTypeOverride "UseLocalSettings" + DataTypeOverrideAppliesTo "AllNumericTypes" + MinMaxOverflowLogging "UseLocalSettings" + Opaque off + MaskHideContents off + SFBlockType "NONE" + GeneratePreprocessorConditionals off + PropagateVariantConditions off + TreatAsGroupedWhenPropagatingVariantConditions on + ContentPreviewEnabled off + IsWebBlock off + } + Block { + BlockType Sum + IconShape "rectangular" + Inputs "++" + CollapseMode "All dimensions" + CollapseDim "1" + InputSameDT on + AccumDataTypeStr "Inherit: Inherit via internal rule" + OutMin "[]" + OutMax "[]" + OutDataTypeStr "Inherit: Same as first input" + LockScale off + RndMeth "Floor" + SaturateOnIntegerOverflow on + SampleTime "-1" + } + Block { + BlockType Terminator + } + Block { + BlockType ZeroOrderHold + SampleTime "1" + } + } + System { + Name "Quadcopter_Model_R2015_A" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "150" + ReportName "simulink-default.rpt" + SIDHighWatermark "1020" + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n" + SID "541" + Ports [4, 6] + Position [1155, 479, 1350, 711] + ZOrder 67 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 23 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Rotor 1 Duty Cycle', 'texmode', 'on');\nport_label('input', 2, 'Rotor 2 Duty Cycle" + "', 'texmode', 'on');\nport_label('input', 3, 'Rotor 3 Duty Cycle', 'texmode', 'on');\nport_label('input', 4, 'Rotor 4" + " Duty Cycle', 'texmode', 'on');\nport_label('output', 1, '^{B}Omega', 'texmode', 'on');\nport_label('output', 2, '\\T" + "heta', 'texmode', 'on');\nport_label('output', 3, '^{B}v_o', 'texmode', 'on');\nport_label('output', 4, '^{E}r_o', 't" + "exmode', 'on');\nport_label('output', 5, '^{B}dv_o/dt', 'texmode', 'on');\nport_label('output', 6, '^{B}g', 'texmode'" + ", 'on');\ndisp('Actuation', 'texmode', 'on'); " + } + System { + Name "\n\n\n\n\n\n" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "150" + Block { + BlockType Inport + Name "Rotor 0 Duty Cycle" + SID "542" + Position [-225, 303, -195, 317] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Rotor 1 Duty Cycle" + SID "543" + Position [-225, 363, -195, 377] + ZOrder 2 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Rotor 2 Duty Cycle" + SID "544" + Position [-225, 423, -195, 437] + ZOrder 1 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Rotor 3 Duty Cycle" + SID "545" + Position [-225, 483, -195, 497] + ZOrder 3 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType SubSystem + Name "\n" + SID "546" + Ports [2, 1] + Position [420, 280, 640, 520] + ZOrder 48 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 24 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Vb_{eff}', 'texmode', 'on');\nport_label('input', 2, '\\omega', 'texmode', " + "'on');\nport_label('output', 1, '\\alpha', 'texmode', 'on');\ndisp('Motor System');\n" + } + System { + Name "\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "33" + Block { + BlockType Inport + Name "Vb_eff" + SID "546::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "angular_velocity" + SID "546::24" + Position [20, 136, 40, 154] + ZOrder 15 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "546::32" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 17 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "546::31" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 5" + Ports [2, 2] + Position [180, 100, 230, 160] + ZOrder 16 + FunctionName "sf_sfun" + Parameters "If,Jreq,Kd,Kq,Kv,Rm" + PortCounts "[2 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "angular_acceleration" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "546::33" + Position [460, 241, 480, 259] + ZOrder 18 + } + Block { + BlockType Outport + Name "angular_acceleration" + SID "546::23" + Position [460, 101, 480, 119] + ZOrder 14 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "Vb_eff" + SrcPort 1 + Points [120, 0] + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "angular_velocity" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "angular_acceleration" + ZOrder 3 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "angular_acceleration" + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n" + SID "547" + Ports [4, 1] + Position [55, 282, 290, 518] + ZOrder 36 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 25 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Rotor 0 Duty Cycle', 'texmode', 'on');\nport_label('input', 2, 'Rotor 1 Dut" + "y Cycle', 'texmode', 'on');\nport_label('input', 3, 'Rotor 2 Duty Cycle', 'texmode', 'on');\nport_label('input', " + "4, 'Rotor 3 Duty Cycle', 'texmode', 'on');\nport_label('output', 1, 'Vb_{eff}', 'texmode', 'on');\ndisp('ESC Syst" + "em');" + } + System { + Name "\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "37" + Block { + BlockType Inport + Name "rotor_0_duty_cycle" + SID "547::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "rotor_1_duty_cycle" + SID "547::22" + Position [20, 136, 40, 154] + ZOrder 13 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "rotor_2_duty_cycle" + SID "547::23" + Position [20, 171, 40, 189] + ZOrder 14 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "rotor_3_duty_cycle" + SID "547::24" + Position [20, 206, 40, 224] + ZOrder 15 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "547::36" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 17 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "547::35" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 4" + Ports [4, 2] + Position [180, 102, 230, 203] + ZOrder 16 + FunctionName "sf_sfun" + Parameters "Pmax,Pmin,Vb" + PortCounts "[4 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "Vb_eff" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "547::37" + Position [460, 241, 480, 259] + ZOrder 18 + } + Block { + BlockType Outport + Name "Vb_eff" + SID "547::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "rotor_0_duty_cycle" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "rotor_1_duty_cycle" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + ZOrder 3 + SrcBlock "rotor_2_duty_cycle" + SrcPort 1 + DstBlock " SFunction " + DstPort 3 + } + Line { + ZOrder 4 + SrcBlock "rotor_3_duty_cycle" + SrcPort 1 + DstBlock " SFunction " + DstPort 4 + } + Line { + Name "Vb_eff" + ZOrder 5 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "Vb_eff" + DstPort 1 + } + Line { + ZOrder 6 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 7 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n" + SID "548" + Ports [0, 1] + Position [335, 664, 485, 786] + ZOrder 96 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 26 + $ClassName "Simulink.Mask" + Display "port_label('output', 1, '^EF_g', 'texmode', 'on');\nfprintf('Gravity');\n" + } + System { + Name "\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "30" + Block { + BlockType Demux + Name " Demux " + SID "548::28" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 19 + Outputs "1" + } + Block { + BlockType Ground + Name " Ground " + SID "548::30" + Position [20, 121, 40, 139] + ZOrder 21 + } + Block { + BlockType S-Function + Name " SFunction " + SID "548::27" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 1" + Ports [1, 2] + Position [180, 100, 230, 160] + ZOrder 18 + FunctionName "sf_sfun" + Parameters "g,m" + PortCounts "[1 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "E_Fg" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "548::29" + Position [460, 241, 480, 259] + ZOrder 20 + } + Block { + BlockType Outport + Name "E_Fg" + SID "548::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + Name "E_Fg" + ZOrder 1 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "E_Fg" + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock " Ground " + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n" + SID "549" + Ports [2, 1] + Position [1395, 499, 1630, 706] + ZOrder 75 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 27 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^Bv_o', 'texmode', 'on');\nport_label('input', 2, '\\Theta', 'texmode', 'on" + "');\nport_label('output', 1, '^Er_o', 'texmode', 'on');\ndisp('L_{EB}', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "31" + Block { + BlockType Inport + Name "B_vo" + SID "549::24" + Position [20, 101, 40, 119] + ZOrder 15 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles" + SID "549::28" + Position [20, 136, 40, 154] + ZOrder 19 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "549::30" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 21 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "549::29" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 2" + Ports [2, 2] + Position [180, 100, 230, 160] + ZOrder 20 + FunctionName "sf_sfun" + PortCounts "[2 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "E_ro" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "549::31" + Position [460, 241, 480, 259] + ZOrder 22 + } + Block { + BlockType Outport + Name "E_ro" + SID "549::26" + Position [460, 101, 480, 119] + ZOrder 17 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "B_vo" + SrcPort 1 + Points [120, 0] + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "euler_angles" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "E_ro" + ZOrder 3 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "E_ro" + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n" + SID "550" + Ports [5, 2] + Position [950, 281, 1150, 519] + ZOrder 52 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 28 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '\\alpha', 'texmode', 'on');\nport_label('input', 2, '\\omega', 'texmode', '" + "on');\nport_label('input', 3, '^BF_g', 'texmode', 'on');\nport_label('input', 4, '^B\\Omega', 'texmode', 'on');\n" + "port_label('input', 5, '^Bv_o', 'texmode', 'on');\nport_label('output', 1, '^Bd\\Omega/dt', 'texmode', 'on');\npo" + "rt_label('output', 2, '^Bdv_o/dt', 'texmode', 'on');\ndisp('Rotor System', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "50" + Block { + BlockType Inport + Name "angular_acceleration" + SID "550::27" + Position [20, 101, 40, 119] + ZOrder 18 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "angular_velocity" + SID "550::28" + Position [20, 136, 40, 154] + ZOrder 19 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_Fg" + SID "550::47" + Position [20, 171, 40, 189] + ZOrder 20 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_omega" + SID "550::25" + Position [20, 206, 40, 224] + ZOrder 16 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_vo" + SID "550::24" + Position [20, 246, 40, 264] + ZOrder 15 + Port "5" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "550::49" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 22 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "550::48" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 6" + Ports [5, 3] + Position [180, 100, 230, 220] + ZOrder 21 + FunctionName "sf_sfun" + Parameters "Jreq,Jxx,Jyy,Jzz,Kd,Kt,m,rhx,rhy,rhz" + PortCounts "[5 3]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "B_omega_dot" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "B_vo_dot" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "550::50" + Position [460, 241, 480, 259] + ZOrder 23 + } + Block { + BlockType Outport + Name "B_omega_dot" + SID "550::22" + Position [460, 101, 480, 119] + ZOrder 13 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "B_vo_dot" + SID "550::5" + Position [460, 136, 480, 154] + ZOrder -5 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "angular_acceleration" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "angular_velocity" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + ZOrder 3 + SrcBlock "B_Fg" + SrcPort 1 + DstBlock " SFunction " + DstPort 3 + } + Line { + ZOrder 4 + SrcBlock "B_omega" + SrcPort 1 + DstBlock " SFunction " + DstPort 4 + } + Line { + ZOrder 5 + SrcBlock "B_vo" + SrcPort 1 + DstBlock " SFunction " + DstPort 5 + } + Line { + Name "B_omega_dot" + ZOrder 6 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "B_omega_dot" + DstPort 1 + } + Line { + Name "B_vo_dot" + ZOrder 7 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 3 + DstBlock "B_vo_dot" + DstPort 1 + } + Line { + ZOrder 8 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 9 + SrcBlock " SFunction " + SrcPort 1 + Points [20, 0] + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SID "551" + Ports [2, 1] + Position [1395, 303, 1630, 452] + ZOrder 81 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 29 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^B\\Omega', 'texmode', 'on');\nport_label('input', 2, '\\Theta', 'texmode'," + " 'on');\nport_label('output', 1, 'd\\Theta/dt', 'texmode', 'on');\ndisp('A_{EB}', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "25" + Block { + BlockType Inport + Name "B_omega" + SID "551::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles" + SID "551::22" + Position [20, 136, 40, 154] + ZOrder 13 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "551::24" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 15 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "551::23" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 7" + Ports [2, 2] + Position [180, 100, 230, 160] + ZOrder 14 + FunctionName "sf_sfun" + PortCounts "[2 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "euler_rates" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "551::25" + Position [460, 241, 480, 259] + ZOrder 16 + } + Block { + BlockType Outport + Name "euler_rates" + SID "551::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "B_omega" + SrcPort 1 + Points [120, 0] + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "euler_angles" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "euler_rates" + ZOrder 3 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "euler_rates" + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SID "552" + Ports [2, 2] + Position [600, 694, 770, 816] + ZOrder 97 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 30 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^EF_g', 'texmode', 'on');\nport_label('input', 2, '\\Theta', 'texmode', 'on" + "');\nport_label('output', 1, '^BF_g', 'texmode', 'on');\ndisp('L_{BE}', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "33" + Block { + BlockType Inport + Name "E_Fg" + SID "552::24" + Position [20, 101, 40, 119] + ZOrder 15 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles" + SID "552::28" + Position [20, 136, 40, 154] + ZOrder 19 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "552::30" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 21 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "552::29" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 8" + Ports [2, 3] + Position [180, 100, 230, 180] + ZOrder 20 + FunctionName "sf_sfun" + Parameters "m" + PortCounts "[2 3]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "B_Fg" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "B_g" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "552::31" + Position [460, 241, 480, 259] + ZOrder 22 + } + Block { + BlockType Outport + Name "B_Fg" + SID "552::26" + Position [460, 101, 480, 119] + ZOrder 17 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "B_g" + SID "552::32" + Position [460, 136, 480, 154] + ZOrder 23 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 19 + SrcBlock "E_Fg" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 20 + SrcBlock "euler_angles" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "B_Fg" + ZOrder 21 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "B_Fg" + DstPort 1 + } + Line { + Name "B_g" + ZOrder 22 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 3 + DstBlock "B_g" + DstPort 1 + } + Line { + ZOrder 23 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 24 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType Demux + Name "Demux" + SID "934" + Ports [1, 4] + Position [-60, 321, -55, 454] + ZOrder 105 + ShowName off + DisplayOption "bar" + } + Block { + BlockType Demux + Name "Demux1" + SID "954" + Ports [1, 3] + Position [1830, 526, 1835, 574] + ZOrder 107 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "x position" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "y position" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "z position" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux2" + SID "955" + Ports [1, 3] + Position [1830, 301, 1835, 349] + ZOrder 109 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "Roll" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "Pitch" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "Yaw" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux3" + SID "957" + Ports [1, 3] + Position [1830, 406, 1835, 454] + ZOrder 117 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "Body x velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "Body y velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "Body z velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux4" + SID "959" + Ports [1, 3] + Position [1830, 161, 1835, 209] + ZOrder 115 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "Body roll velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "Body pitch velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "Body yaw velocity" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux5" + SID "961" + Ports [1, 3] + Position [1830, 641, 1835, 689] + ZOrder 119 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "Body x acceleration" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "Body y acceleration" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "Body z acceleration" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Integrator + Name "Integrator" + SID "553" + Ports [1, 1] + Position [730, 340, 760, 370] + ZOrder 49 + } + Block { + BlockType Integrator + Name "Integrator1" + SID "554" + Ports [1, 1] + Position [1225, 445, 1255, 475] + ZOrder 53 + } + Block { + BlockType Integrator + Name "Integrator2" + SID "555" + Ports [1, 1] + Position [1225, 325, 1255, 355] + ZOrder 54 + } + Block { + BlockType Integrator + Name "Integrator3" + SID "556" + Ports [1, 1] + Position [1685, 590, 1715, 620] + ZOrder 98 + } + Block { + BlockType Integrator + Name "Integrator4" + SID "557" + Ports [1, 1] + Position [1685, 365, 1715, 395] + ZOrder 77 + ContinuousStateAttributes "['phi' 'theta' 'psi']" + } + Block { + BlockType Scope + Name "Scope" + SID "558" + Ports [1] + Position [350, 279, 380, 311] + ZOrder 46 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData + YMin 10.94391 + YMax 11.11734 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope1" + SID "559" + Ports [1] + Position [740, 229, 770, 261] + ZOrder 50 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData1 + YMin -1469.49513 + YMax 13225.4562 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope10" + SID "956" + Ports [3] + Position [1935, 303, 1975, 347] + ZOrder 108 + NumInputPorts "3" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends on + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData1 + YMin -1.00000~-1.00000~-1.00000 + YMax 1.00000~1.00000~1.00000 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + axes2 "%<SignalLabel>" + axes3 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [643 335 1366 766] + } + Block { + BlockType Scope + Name "Scope11" + SID "960" + Ports [3] + Position [1935, 163, 1975, 207] + ZOrder 114 + NumInputPorts "3" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends on + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData3 + YMin -1.00000~-1.00000~-1.00000 + YMax 1.00000~1.00000~1.00000 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + axes2 "%<SignalLabel>" + axes3 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [643 335 1366 766] + } + Block { + BlockType Scope + Name "Scope2" + SID "560" + Ports [1] + Position [890, 229, 920, 261] + ZOrder 51 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData2 + YMin -100.77485 + YMax 906.97366 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope3" + SID "958" + Ports [3] + Position [1935, 408, 1975, 452] + ZOrder 116 + NumInputPorts "3" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends on + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData2 + YMin -1.00000~-71.40595~-81.80792 + YMax 1.00000~93.1255~67.47699 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + axes2 "%<SignalLabel>" + axes3 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope4" + SID "962" + Ports [3] + Position [1935, 643, 1975, 687] + ZOrder 118 + NumInputPorts "3" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends on + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData4 + YMin -1019.9483~-1019.9483~-1019.9483 + YMax 1049.2638~1049.2638~1049.2638 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + axes2 "%<SignalLabel>" + axes3 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope6" + SID "564" + Ports [3] + Position [1935, 528, 1975, 572] + ZOrder 79 + NumInputPorts "3" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends on + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData4 + YMin -1.00000~-1.00000~-980.09781 + YMax 1.00000~1.00000~109.0196 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + axes2 "%<SignalLabel>" + axes3 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [643 335 1366 766] + } + Block { + BlockType Scope + Name "Scope7" + SID "565" + Ports [1] + Position [535, 644, 565, 676] + ZOrder 99 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData1 + YMin -1.45924 + YMax 13.13314 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope8" + SID "566" + Ports [1] + Position [820, 629, 850, 661] + ZOrder 100 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData2 + YMin -14.59237 + YMax 14.59237 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope9" + SID "567" + Ports [1] + Position [1225, 229, 1255, 261] + ZOrder 102 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData3 + YMin -0.0198 + YMax 0.17819 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1909 1039] + } + Block { + BlockType Step + Name "Step" + SID "935" + Position [-150, 375, -120, 405] + ZOrder 106 + Before "68.25*ones(4,1)" + After "[ 68.25; 69.25; 69.25; 68.25 ]" + SampleTime "0" + } + Block { + BlockType Outport + Name "B_omega" + SID "568" + Position [1815, 238, 1845, 252] + ZOrder 61 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "euler_angles" + SID "569" + Position [1815, 373, 1845, 387] + ZOrder 91 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "B_vo" + SID "570" + Position [1815, 468, 1845, 482] + ZOrder 58 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "E_ro" + SID "571" + Position [1830, 598, 1860, 612] + ZOrder 88 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "B_vo_dot" + SID "572" + Position [1830, 718, 1860, 732] + ZOrder 103 + Port "5" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "B_g" + SID "573" + Position [1830, 778, 1860, 792] + ZOrder 104 + Port "6" + IconDisplay "Port number" + } + Line { + ZOrder 5 + SrcBlock "\n\n" + SrcPort 1 + Points [23, 0; 0, -59] + Branch { + ZOrder 6 + Points [2, 0; 0, -46] + DstBlock "Scope" + DstPort 1 + } + Branch { + ZOrder 7 + Points [0, -1] + DstBlock "\n" + DstPort 1 + } + } + Line { + ZOrder 8 + SrcBlock "\n" + SrcPort 1 + Points [40, 0; 0, -45] + Branch { + ZOrder 9 + DstBlock "Integrator" + DstPort 1 + } + Branch { + ZOrder 10 + Points [0, -45] + Branch { + ZOrder 11 + Points [0, -65] + DstBlock "Scope1" + DstPort 1 + } + Branch { + ZOrder 12 + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 1 + } + } + } + Line { + ZOrder 13 + SrcBlock "Integrator" + SrcPort 1 + Points [8, 0] + Branch { + ZOrder 14 + Points [60, 0] + Branch { + ZOrder 15 + Points [0, -110] + DstBlock "Scope2" + DstPort 1 + } + Branch { + ZOrder 16 + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 2 + } + } + Branch { + ZOrder 17 + Points [0, 210; -396, 0; 0, -105] + DstBlock "\n" + DstPort 2 + } + } + Line { + ZOrder 18 + SrcBlock "\n\n\n\n\n\n\n\n" + SrcPort 1 + Points [34, 0] + Branch { + ZOrder 19 + Points [0, -95] + DstBlock "Scope9" + DstPort 1 + } + Branch { + ZOrder 20 + DstBlock "Integrator2" + DstPort 1 + } + } + Line { + ZOrder 21 + SrcBlock "\n\n\n\n\n\n\n\n" + SrcPort 2 + Points [32, 0] + Branch { + ZOrder 22 + Points [0, 265; 600, 0] + Branch { + ZOrder 199 + Points [0, -60] + DstBlock "Demux5" + DstPort 1 + } + Branch { + ZOrder 198 + DstBlock "B_vo_dot" + DstPort 1 + } + } + Branch { + ZOrder 23 + DstBlock "Integrator1" + DstPort 1 + } + } + Line { + ZOrder 24 + SrcBlock "Integrator2" + SrcPort 1 + Points [55, 0] + Branch { + ZOrder 25 + Points [0, -95; 454, 0] + Branch { + ZOrder 117 + DstBlock "B_omega" + DstPort 1 + } + Branch { + ZOrder 115 + Points [0, -60] + DstBlock "Demux4" + DstPort 1 + } + } + Branch { + ZOrder 28 + Points [0, 226; -422, 0; 0, -121] + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 4 + } + Branch { + ZOrder 29 + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 1 + } + } + Line { + ZOrder 37 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SrcPort 1 + DstBlock "Integrator4" + DstPort 1 + } + Line { + ZOrder 47 + SrcBlock "\n\n\n\n" + SrcPort 1 + Points [7, 0] + Branch { + ZOrder 64 + Points [0, -65] + DstBlock "Scope7" + DstPort 1 + } + Branch { + ZOrder 49 + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 1 + } + } + Line { + ZOrder 50 + SrcBlock "\n\n\n\n\n\n\n" + SrcPort 1 + DstBlock "Integrator3" + DstPort 1 + } + Line { + ZOrder 51 + SrcBlock "Integrator3" + SrcPort 1 + Points [64, 0] + Branch { + ZOrder 88 + Points [0, -55] + DstBlock "Demux1" + DstPort 1 + } + Branch { + ZOrder 87 + DstBlock "E_ro" + DstPort 1 + } + } + Line { + ZOrder 54 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SrcPort 1 + Points [24, 0; 0, -30] + Branch { + ZOrder 55 + Points [0, -50] + DstBlock "Scope8" + DstPort 1 + } + Branch { + ZOrder 56 + Points [74, 0; 0, -295] + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 3 + } + } + Line { + ZOrder 61 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SrcPort 2 + DstBlock "B_g" + DstPort 1 + } + Line { + ZOrder 71 + SrcBlock "Demux" + SrcPort 1 + Points [50, 0; 0, -25] + DstBlock "\n\n" + DstPort 1 + } + Line { + ZOrder 72 + SrcBlock "Demux" + SrcPort 2 + DstBlock "\n\n" + DstPort 2 + } + Line { + ZOrder 73 + SrcBlock "Demux" + SrcPort 3 + Points [50, 0; 0, 25] + DstBlock "\n\n" + DstPort 3 + } + Line { + ZOrder 74 + SrcBlock "Demux" + SrcPort 4 + Points [50, 0; 0, 50] + DstBlock "\n\n" + DstPort 4 + } + Line { + ZOrder 70 + SrcBlock "Step" + SrcPort 1 + DstBlock "Demux" + DstPort 1 + } + Line { + Name "y position" + ZOrder 89 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 2 + DstBlock "Scope6" + DstPort 2 + } + Line { + Name "x position" + ZOrder 90 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 1 + DstBlock "Scope6" + DstPort 1 + } + Line { + Name "z position" + ZOrder 91 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 3 + DstBlock "Scope6" + DstPort 3 + } + Line { + ZOrder 38 + SrcBlock "Integrator4" + SrcPort 1 + Points [20, 0] + Branch { + ZOrder 39 + Points [30, 0] + Branch { + ZOrder 97 + Points [0, -55] + DstBlock "Demux2" + DstPort 1 + } + Branch { + ZOrder 96 + DstBlock "euler_angles" + DstPort 1 + } + } + Branch { + ZOrder 42 + Points [0, 460; -385, 0] + Branch { + ZOrder 65 + Points [0, -185] + Branch { + ZOrder 44 + DstBlock "\n\n\n\n\n\n\n" + DstPort 2 + } + Branch { + ZOrder 45 + Points [0, -240] + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 2 + } + } + Branch { + ZOrder 46 + Points [-787, 0; 0, -55] + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 2 + } + } + } + Line { + Name "Pitch" + ZOrder 93 + Labels [0, 0] + SrcBlock "Demux2" + SrcPort 2 + DstBlock "Scope10" + DstPort 2 + } + Line { + Name "Roll" + ZOrder 94 + Labels [0, 0] + SrcBlock "Demux2" + SrcPort 1 + DstBlock "Scope10" + DstPort 1 + } + Line { + Name "Yaw" + ZOrder 95 + Labels [0, 0] + SrcBlock "Demux2" + SrcPort 3 + DstBlock "Scope10" + DstPort 3 + } + Line { + Name "Body pitch velocity" + ZOrder 111 + Labels [0, 0] + SrcBlock "Demux4" + SrcPort 2 + DstBlock "Scope11" + DstPort 2 + } + Line { + Name "Body roll velocity" + ZOrder 112 + Labels [0, 0] + SrcBlock "Demux4" + SrcPort 1 + DstBlock "Scope11" + DstPort 1 + } + Line { + Name "Body yaw velocity" + ZOrder 113 + Labels [0, 0] + SrcBlock "Demux4" + SrcPort 3 + DstBlock "Scope11" + DstPort 3 + } + Line { + Name "Body y velocity" + ZOrder 118 + Labels [0, 0] + SrcBlock "Demux3" + SrcPort 2 + DstBlock "Scope3" + DstPort 2 + } + Line { + Name "Body x velocity" + ZOrder 119 + Labels [0, 0] + SrcBlock "Demux3" + SrcPort 1 + DstBlock "Scope3" + DstPort 1 + } + Line { + Name "Body z velocity" + ZOrder 120 + Labels [0, 0] + SrcBlock "Demux3" + SrcPort 3 + DstBlock "Scope3" + DstPort 3 + } + Line { + Name "Body y acceleration" + ZOrder 124 + Labels [0, 0] + SrcBlock "Demux5" + SrcPort 2 + DstBlock "Scope4" + DstPort 2 + } + Line { + Name "Body x acceleration" + ZOrder 125 + Labels [0, 0] + SrcBlock "Demux5" + SrcPort 1 + DstBlock "Scope4" + DstPort 1 + } + Line { + Name "Body z acceleration" + ZOrder 126 + Labels [0, 0] + SrcBlock "Demux5" + SrcPort 3 + DstBlock "Scope4" + DstPort 3 + } + Line { + ZOrder 30 + SrcBlock "Integrator1" + SrcPort 1 + Points [34, 0; 0, 90] + Branch { + ZOrder 195 + Points [-383, 0; 0, -60] + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 5 + } + Branch { + ZOrder 194 + Points [76, 0] + Branch { + ZOrder 196 + DstBlock "\n\n\n\n\n\n\n" + DstPort 1 + } + Branch { + ZOrder 192 + Points [0, -75; 401, 0] + Branch { + ZOrder 201 + Points [0, -45] + DstBlock "Demux3" + DstPort 1 + } + Branch { + ZOrder 200 + DstBlock "B_vo" + DstPort 1 + } + } + } + } + } + } + Block { + BlockType SubSystem + Name " " + SID "601" + Ports [6, 3] + Position [1445, 477, 1665, 713] + ZOrder 68 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 31 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^{B}Omega', 'texmode', 'on');\nport_label('input', 2, '\\Theta', 'texmode', 'on');" + "\nport_label('input', 3, '^{B}v_o', 'texmode', 'on');\nport_label('input', 4, '^{E}r_o', 'texmode', 'on');\nport_labe" + "l('input', 5, '^{B}dv_o/dt', 'texmode', 'on');\nport_label('input', 6, '^{B}g', 'texmode', 'on');\nport_label('output" + "', 1, 'Euler Angles Filtered', 'texmode', 'on');\nport_label('output', 2, 'Euler Rates', 'texmode', 'on');\nport_labe" + "l('output', 3, 'Current Position', 'texmode', 'on');\ndisp('Sensors', 'texmode', 'on'); " + } + System { + Name " " + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "80" + Block { + BlockType Inport + Name "B_Omega" + SID "863" + Position [1015, 678, 1045, 692] + ZOrder 265 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles" + SID "864" + Position [1720, 1043, 1750, 1057] + ZOrder 266 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_vo" + SID "865" + Position [1015, 613, 1045, 627] + ZOrder 267 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "E_ro" + SID "866" + Position [1720, 963, 1750, 977] + ZOrder 268 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_vo_dot" + SID "867" + Position [1015, 548, 1045, 562] + ZOrder 269 + Port "5" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_g" + SID "868" + Position [1015, 743, 1045, 757] + ZOrder 273 + Port "6" + IconDisplay "Port number" + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n" + SID "869" + Ports [4, 1] + Position [2025, 483, 2210, 782] + ZOrder 274 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 32 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '\\theta_{accel}', 'texmode', 'on');\nport_label('input', 2, '\\phi_{accel}'" + ", 'texmode', 'on');\nport_label('input', 3, 'd\\Theta_{IMU}/dt', 'texmode', 'on');\nport_label('input', 4, '\\The" + "ta_{IMU}', 'texmode', 'on');\nport_label('output', 1, '\\Theta_{IMU}', 'texmode', 'on');\ndisp('Complimentary Fil" + "ter', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "32" + Block { + BlockType Inport + Name "accel_pitch" + SID "869::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "accel_roll" + SID "869::29" + Position [20, 136, 40, 154] + ZOrder 20 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles_gyro" + SID "869::22" + Position [20, 171, 40, 189] + ZOrder 13 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "prev_euler_angles_IMU" + SID "869::28" + Position [20, 206, 40, 224] + ZOrder 19 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "869::20" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 11 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "869::19" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 9" + Ports [4, 2] + Position [180, 132, 230, 233] + ZOrder 10 + FunctionName "sf_sfun" + PortCounts "[4 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "euler_angles_IMU" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "869::21" + Position [460, 241, 480, 259] + ZOrder 12 + } + Block { + BlockType Outport + Name "euler_angles_IMU" + SID "869::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "accel_pitch" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "accel_roll" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + ZOrder 3 + SrcBlock "euler_angles_gyro" + SrcPort 1 + DstBlock " SFunction " + DstPort 3 + } + Line { + ZOrder 4 + SrcBlock "prev_euler_angles_IMU" + SrcPort 1 + DstBlock " SFunction " + DstPort 4 + } + Line { + Name "euler_angles_IMU" + ZOrder 5 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "euler_angles_IMU" + DstPort 1 + } + Line { + ZOrder 6 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 7 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n\n\n" + SID "870" + Ports [4, 2] + Position [1145, 520, 1340, 785] + ZOrder 272 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 33 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^{B}dv_o/dt', 'texmode', 'on')\nport_label('input', 2, '^{B}v_o', 'texmode'" + ", 'on')\nport_label('input', 3, '^{B}\\Omega', 'texmode', 'on')\nport_label('input', 4, '^{B}g', 'texmode', 'on')" + "\nport_label('output', 1, 'Accelerometer Reading', 'texmode', 'on')\nport_label('output', 2, 'Gyroscope Reading'," + " 'texmode', 'on')\ndisp('IMU', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n\n\n" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + Block { + BlockType Inport + Name "B_vo_dot" + SID "871" + Position [110, 173, 140, 187] + ZOrder 17 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_vo" + SID "872" + Position [110, 208, 140, 222] + ZOrder 25 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_Omega" + SID "873" + Position [110, 243, 140, 257] + ZOrder 26 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_g" + SID "874" + Position [110, 278, 140, 292] + ZOrder 27 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n" + SID "875" + Ports [5, 2] + Position [250, 165, 445, 335] + ZOrder 1 + LibraryVersion "1.32" + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 34 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^{B}dv_o/dt', 'texmode', 'on')\nport_label('input', 2, '^{B}v_o', 'texmode', 'on'" + ")\nport_label('input', 3, '^{B}\\Omega', 'texmode', 'on')\nport_label('input', 4, '^{B}g', 'texmode', 'on')\nport_la" + "bel('input', 5, 'r_{oc}', 'texmode', 'on')\nport_label('output', 1, 'Accelerometer Reading', 'texmode', 'on')\nport_" + "label('output', 2, 'Gyroscope Reading', 'texmode', 'on')\ndisp('Ideal IMU', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "31" + Block { + BlockType Inport + Name "B_vo_dot" + SID "875::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_vo" + SID "875::22" + Position [20, 136, 40, 154] + ZOrder 13 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_Omega" + SID "875::19" + Position [20, 171, 40, 189] + ZOrder 10 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "B_g" + SID "875::20" + Position [20, 206, 40, 224] + ZOrder 11 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "r_oc" + SID "875::23" + Position [20, 246, 40, 264] + ZOrder 14 + Port "5" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "875::25" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 16 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "875::24" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 10" + Ports [5, 3] + Position [180, 110, 230, 230] + ZOrder 15 + FunctionName "sf_sfun" + Parameters "g" + PortCounts "[5 3]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "accelReading" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "gyroReading" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "875::26" + Position [460, 241, 480, 259] + ZOrder 17 + } + Block { + BlockType Outport + Name "accelReading" + SID "875::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "gyroReading" + SID "875::21" + Position [460, 136, 480, 154] + ZOrder 12 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 57 + SrcBlock "B_vo_dot" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 58 + SrcBlock "B_vo" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + ZOrder 59 + SrcBlock "B_Omega" + SrcPort 1 + DstBlock " SFunction " + DstPort 3 + } + Line { + ZOrder 60 + SrcBlock "B_g" + SrcPort 1 + DstBlock " SFunction " + DstPort 4 + } + Line { + ZOrder 61 + SrcBlock "r_oc" + SrcPort 1 + DstBlock " SFunction " + DstPort 5 + } + Line { + Name "accelReading" + ZOrder 62 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "accelReading" + DstPort 1 + } + Line { + Name "gyroReading" + ZOrder 63 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 3 + DstBlock "gyroReading" + DstPort 1 + } + Line { + ZOrder 64 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 65 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType Ground + Name "Ground" + SID "876" + Position [550, 340, 570, 360] + ZOrder 23 + } + Block { + BlockType Ground + Name "Ground1" + SID "877" + Position [550, 145, 570, 165] + ZOrder 24 + } + Block { + BlockType Sum + Name "Sum" + SID "878" + Ports [2, 1] + Position [690, 285, 710, 305] + ZOrder 7 + ShowName off + IconShape "round" + Inputs "|++" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum1" + SID "879" + Ports [2, 1] + Position [690, 200, 710, 220] + ZOrder 8 + ShowName off + IconShape "round" + Inputs "++|" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum2" + SID "880" + Ports [2, 1] + Position [570, 285, 590, 305] + ZOrder 11 + ShowName off + IconShape "round" + Inputs "|++" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum3" + SID "881" + Ports [2, 1] + Position [570, 200, 590, 220] + ZOrder 12 + ShowName off + IconShape "round" + Inputs "++|" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType RandomNumber + Name "accelerometer_noise" + SID "882" + Position [630, 140, 660, 170] + ZOrder 2 + Mean "zeros(3,1)" + Variance "[ 3e-7 ; 3.3e-7 ; 7.2e-7 ] " + Seed "[0,1,2]" + SampleTime "6.1e-3" + } + Block { + BlockType Quantizer + Name "accelerometer_quantizer" + SID "883" + Position [770, 195, 800, 225] + ZOrder 9 + QuantizationInterval "2.4400e-04" + } + Block { + BlockType ZeroOrderHold + Name "accelerometer_sampling" + SID "884" + Position [495, 195, 530, 225] + ZOrder 15 + SampleTime "6.1e-3" + } + Block { + BlockType RandomNumber + Name "gyroscope_noise" + SID "885" + Position [630, 315, 660, 345] + ZOrder 6 + Mean "zeros(3,1)" + Variance "[ 2.2e-8 ; 1.1e-7 ; 2.4e-8 ]" + Seed "[0,1,2]" + SampleTime "6.1e-3" + } + Block { + BlockType Quantizer + Name "gyroscope_qunatizer" + SID "886" + Position [770, 280, 800, 310] + ZOrder 10 + QuantizationInterval "1.1e-3" + } + Block { + BlockType ZeroOrderHold + Name "gyroscope_sampling" + SID "887" + Position [495, 280, 530, 310] + ZOrder 16 + SampleTime "6.1e-3" + } + Block { + BlockType Constant + Name "r_oc" + SID "888" + Position [30, 307, 95, 333] + ZOrder 28 + Value "zeros(3,1)" + } + Block { + BlockType Outport + Name "accelerometer" + SID "889" + Position [885, 203, 915, 217] + ZOrder 29 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "gyroscope" + SID "890" + Position [885, 288, 915, 302] + ZOrder 21 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "gyroscope_qunatizer" + SrcPort 1 + DstBlock "gyroscope" + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "accelerometer_quantizer" + SrcPort 1 + DstBlock "accelerometer" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock "accelerometer_noise" + SrcPort 1 + Points [35, 0] + DstBlock "Sum1" + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock "Sum" + SrcPort 1 + DstBlock "gyroscope_qunatizer" + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock "Sum2" + SrcPort 1 + DstBlock "Sum" + DstPort 1 + } + Line { + ZOrder 6 + SrcBlock "Sum3" + SrcPort 1 + DstBlock "Sum1" + DstPort 2 + } + Line { + ZOrder 7 + SrcBlock "\n\n\n\n\n\n\n" + SrcPort 2 + DstBlock "gyroscope_sampling" + DstPort 1 + } + Line { + ZOrder 8 + SrcBlock "gyroscope_noise" + SrcPort 1 + Points [35, 0] + DstBlock "Sum" + DstPort 2 + } + Line { + ZOrder 9 + SrcBlock "\n\n\n\n\n\n\n" + SrcPort 1 + DstBlock "accelerometer_sampling" + DstPort 1 + } + Line { + ZOrder 10 + SrcBlock "Sum1" + SrcPort 1 + DstBlock "accelerometer_quantizer" + DstPort 1 + } + Line { + ZOrder 11 + SrcBlock "gyroscope_sampling" + SrcPort 1 + DstBlock "Sum2" + DstPort 1 + } + Line { + ZOrder 12 + SrcBlock "accelerometer_sampling" + SrcPort 1 + DstBlock "Sum3" + DstPort 2 + } + Line { + ZOrder 13 + SrcBlock "Ground" + SrcPort 1 + Points [5, 0] + DstBlock "Sum2" + DstPort 2 + } + Line { + ZOrder 14 + SrcBlock "Ground1" + SrcPort 1 + Points [5, 0] + DstBlock "Sum3" + DstPort 1 + } + Line { + ZOrder 15 + SrcBlock "B_vo_dot" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n" + DstPort 1 + } + Line { + ZOrder 16 + SrcBlock "B_vo" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n" + DstPort 2 + } + Line { + ZOrder 17 + SrcBlock "B_Omega" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n" + DstPort 3 + } + Line { + ZOrder 18 + SrcBlock "B_g" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n" + DstPort 4 + } + Line { + ZOrder 19 + SrcBlock "r_oc" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n" + DstPort 5 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SID "892" + Ports [2, 1] + Position [1470, 689, 1885, 811] + ZOrder 275 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 35 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Gyroscope Reading', 'texmode', 'on');\nport_label('input', 2, '\\Theta_{IMU" + "}', 'texmode', 'on');\nport_label('output', 1, 'd\\Theta_{IMU}/dt', 'texmode', 'on');\ndisp('A_{EB}', 'texmode', " + "'on');" + } + System { + Name "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "25" + Block { + BlockType Inport + Name "gyro_reading" + SID "892::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles_IMU" + SID "892::22" + Position [20, 136, 40, 154] + ZOrder 13 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "892::24" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 15 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "892::23" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 12" + Ports [2, 2] + Position [180, 100, 230, 160] + ZOrder 14 + FunctionName "sf_sfun" + PortCounts "[2 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "euler_rates_IMU" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "892::25" + Position [460, 241, 480, 259] + ZOrder 16 + } + Block { + BlockType Outport + Name "euler_rates_IMU" + SID "892::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "gyro_reading" + SrcPort 1 + Points [120, 0] + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "euler_angles_IMU" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "euler_rates_IMU" + ZOrder 3 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "euler_rates_IMU" + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n\n\n\n\n\n\n\n\n\n\n1" + SID "908" + Ports [2, 2] + Position [1480, 484, 1875, 631] + ZOrder 284 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + Object { + $PropName "MaskObject" + $ObjectID 36 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Accelerometer Reading', 'texmode', 'on');\nport_label('output', 1, '\\theta" + "_{accel}', 'texmode', 'on');\nport_label('output', 2, '\\phi_{accel}', 'texmode', 'on');\ndisp('Calculate Pitch a" + "nd Roll', 'texmode', 'on');" + } + System { + Name "\n\n\n\n\n\n\n\n\n\n\n\n1" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "26" + Block { + BlockType Inport + Name "accel_reading" + SID "908::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "accel_roll_prev" + SID "908::23" + Position [20, 136, 40, 154] + ZOrder 14 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "908::20" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 11 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "908::19" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 13" + Ports [2, 3] + Position [180, 105, 230, 185] + ZOrder 10 + FunctionName "sf_sfun" + PortCounts "[2 3]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "accel_pitch" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "accel_roll" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "908::21" + Position [460, 241, 480, 259] + ZOrder 12 + } + Block { + BlockType Outport + Name "accel_pitch" + SID "908::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "accel_roll" + SID "908::22" + Position [460, 136, 480, 154] + ZOrder 13 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 14 + SrcBlock "accel_reading" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + ZOrder 15 + SrcBlock "accel_roll_prev" + SrcPort 1 + DstBlock " SFunction " + DstPort 2 + } + Line { + Name "accel_pitch" + ZOrder 16 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "accel_pitch" + DstPort 1 + } + Line { + Name "accel_roll" + ZOrder 17 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 3 + DstBlock "accel_roll" + DstPort 1 + } + Line { + ZOrder 18 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 19 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "\n\n " + SID "989" + Ports [2, 2] + Position [1990, 946, 2230, 1039] + ZOrder 299 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 37 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, '^{E}r_o', 'texmode', 'on');\nport_label('input', 2, '\\psi', 'texmode', 'on" + "');\nport_label('output', 1, '^{E}r_o camera', 'texmode', 'on');\nport_label('output', 2, '\\psi camera', 'texmod" + "e', 'on');\ndisp('OptiTrack Camera System', 'texmode', 'on');" + } + System { + Name "\n\n " + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + Block { + BlockType Inport + Name "E_ro" + SID "990" + Position [295, 238, 325, 252] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "yaw" + SID "991" + Position [295, 338, 325, 352] + ZOrder 4 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType RandomNumber + Name "E_ro_noise" + SID "992" + Position [545, 175, 575, 205] + ZOrder 30 + Mean "zeros(3,1)" + Variance "[ 7.9664e-10 ; 1.1928e-10 ; 5.0636e-10 ] " + Seed "[0,1,2]" + SampleTime "6.1e-3" + } + Block { + BlockType Quantizer + Name "E_ro_quantizer" + SID "993" + Position [685, 230, 715, 260] + ZOrder 34 + QuantizationInterval "2.4400e-04" + } + Block { + BlockType ZeroOrderHold + Name "E_ro_sampling" + SID "994" + Position [410, 230, 445, 260] + ZOrder 38 + SampleTime "6.1e-3" + } + Block { + BlockType Ground + Name "Ground1" + SID "995" + Position [465, 180, 485, 200] + ZOrder 42 + } + Block { + BlockType Ground + Name "Ground2" + SID "996" + Position [465, 390, 485, 410] + ZOrder 56 + } + Block { + BlockType Sum + Name "Sum1" + SID "997" + Ports [2, 1] + Position [605, 235, 625, 255] + ZOrder 33 + ShowName off + IconShape "round" + Inputs "++|" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum3" + SID "998" + Ports [2, 1] + Position [485, 235, 505, 255] + ZOrder 37 + ShowName off + IconShape "round" + Inputs "++|" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum4" + SID "999" + Ports [2, 1] + Position [605, 335, 625, 355] + ZOrder 47 + ShowName off + IconShape "round" + Inputs "|++" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Sum + Name "Sum6" + SID "1000" + Ports [2, 1] + Position [485, 335, 505, 355] + ZOrder 51 + ShowName off + IconShape "round" + Inputs "|++" + InputSameDT off + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType RandomNumber + Name "yaw_noise" + SID "1001" + Position [545, 365, 575, 395] + ZOrder 46 + Variance "1.0783e-9" + SampleTime "6.1e-3" + } + Block { + BlockType Quantizer + Name "yaw_quantizer" + SID "1002" + Position [685, 330, 715, 360] + ZOrder 50 + QuantizationInterval "1.1e-3" + } + Block { + BlockType ZeroOrderHold + Name "yaw_sampling" + SID "1003" + Position [410, 330, 445, 360] + ZOrder 54 + SampleTime "6.1e-3" + } + Block { + BlockType Outport + Name "E_ro_camera" + SID "1004" + Position [800, 238, 830, 252] + ZOrder 43 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "yaw_camera" + SID "1005" + Position [800, 338, 830, 352] + ZOrder 55 + Port "2" + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "E_ro_quantizer" + SrcPort 1 + DstBlock "E_ro_camera" + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "E_ro_noise" + SrcPort 1 + Points [35, 0] + DstBlock "Sum1" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock "Sum3" + SrcPort 1 + DstBlock "Sum1" + DstPort 2 + } + Line { + ZOrder 4 + SrcBlock "Sum1" + SrcPort 1 + DstBlock "E_ro_quantizer" + DstPort 1 + } + Line { + ZOrder 5 + SrcBlock "E_ro_sampling" + SrcPort 1 + DstBlock "Sum3" + DstPort 2 + } + Line { + ZOrder 6 + SrcBlock "Ground1" + SrcPort 1 + Points [5, 0] + DstBlock "Sum3" + DstPort 1 + } + Line { + ZOrder 7 + SrcBlock "yaw_quantizer" + SrcPort 1 + DstBlock "yaw_camera" + DstPort 1 + } + Line { + ZOrder 8 + SrcBlock "Sum4" + SrcPort 1 + DstBlock "yaw_quantizer" + DstPort 1 + } + Line { + ZOrder 9 + SrcBlock "Sum6" + SrcPort 1 + DstBlock "Sum4" + DstPort 1 + } + Line { + ZOrder 10 + SrcBlock "yaw_noise" + SrcPort 1 + Points [35, 0] + DstBlock "Sum4" + DstPort 2 + } + Line { + ZOrder 11 + SrcBlock "yaw_sampling" + SrcPort 1 + DstBlock "Sum6" + DstPort 1 + } + Line { + ZOrder 12 + SrcBlock "Ground2" + SrcPort 1 + Points [5, 0] + DstBlock "Sum6" + DstPort 2 + } + Line { + ZOrder 13 + SrcBlock "yaw" + SrcPort 1 + DstBlock "yaw_sampling" + DstPort 1 + } + Line { + ZOrder 14 + SrcBlock "E_ro" + SrcPort 1 + DstBlock "E_ro_sampling" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "3D Graphical Simulation" + SID "911" + Ports [2] + Position [2005, 1075, 2155, 1135] + ZOrder 287 + Commented "on" + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 38 + $ClassName "Simulink.Mask" + Display "port_label('input',1,'r_{o}','texmode','on')\nport_label('input',2,'\\Theta','texmode','on')" + } + System { + Name "3D Graphical Simulation" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "60" + Block { + BlockType Inport + Name "Displacement" + SID "912" + Position [110, 218, 140, 232] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Euler Angles" + SID "913" + Position [125, 108, 155, 122] + ZOrder -2 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType BusCreator + Name "Bus\nCreator" + SID "914" + Ports [3, 1] + Position [600, 76, 610, 154] + ZOrder -3 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusCreator + Name "Bus\nCreator1" + SID "915" + Ports [3, 1] + Position [630, 191, 640, 269] + ZOrder -4 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusCreator + Name "Bus\nCreator2" + SID "916" + Ports [3, 1] + Position [385, 75, 390, 155] + ZOrder -5 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusSelector + Name "Bus\nSelector" + SID "917" + Ports [1, 3] + Position [500, 77, 505, 153] + ZOrder -6 + ShowName off + OutputSignals "phi,theta,psi" + Port { + PortNumber 1 + Name "<phi>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "<theta>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "<psi>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux" + SID "918" + Ports [1, 3] + Position [440, 183, 450, 267] + ZOrder -7 + BackgroundColor "black" + ShowName off + Outputs "3" + DisplayOption "bar" + } + Block { + BlockType Demux + Name "Demux1" + SID "919" + Ports [1, 3] + Position [290, 75, 295, 155] + ZOrder -8 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "phi" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "theta" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "psi" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Gain + Name "Gain" + SID "920" + Position [550, 240, 580, 270] + ZOrder -10 + Gain "-1" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Gain + Name "Gain1" + SID "921" + Position [670, 208, 710, 252] + ZOrder -11 + Gain "eye(3)*1" + Multiplication "Matrix(K*u)" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Gain + Name "Gain2" + SID "922" + Position [550, 190, 580, 220] + ZOrder -12 + Gain "-1" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType SubSystem + Name "MATLAB Function" + SID "923" + Ports [1, 1] + Position [655, 92, 725, 138] + ZOrder 5 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + System { + Name "MATLAB Function" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "21" + Block { + BlockType Inport + Name "u" + SID "923::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "923::20" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 11 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "923::19" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 11" + Ports [1, 2] + Position [180, 100, 230, 160] + ZOrder 10 + FunctionName "sf_sfun" + PortCounts "[1 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "y" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "923::21" + Position [460, 241, 480, 259] + ZOrder 12 + } + Block { + BlockType Outport + Name "y" + SID "923::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "u" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + Name "y" + ZOrder 2 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "y" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType RateTransition + Name "Rate Transition" + SID "924" + Position [755, 94, 795, 136] + ZOrder -13 + NamePlacement "alternate" + OutPortSampleTime "0.06" + } + Block { + BlockType RateTransition + Name "Rate Transition1" + SID "925" + Position [735, 210, 770, 250] + ZOrder -14 + OutPortSampleTime "0.06" + } + Block { + BlockType Reference + Name "VR Sink" + SID "926" + Ports [2] + Position [865, 76, 1055, 234] + ZOrder -15 + LibraryVersion "1.36" + SourceBlock "vrlib/VR Sink" + SourceType "Virtual Reality Sink" + InstantiateOnLoad on + SampleTime "-1" + ViewEnable on + RemoteChange off + RemoteView off + FieldsWritten "Helicopter.rotation.4.1.1.double#Helicopter.translation.3.1.1.double" + WorldFileName "quadrotor_world_ucart.wrl" + AutoView on + VideoDimensions "[]" + AllowVariableSize off + } + Line { + ZOrder 1 + SrcBlock "Displacement" + SrcPort 1 + DstBlock "Demux" + DstPort 1 + } + Line { + ZOrder 2 + SrcBlock "Bus\nCreator2" + SrcPort 1 + DstBlock "Bus\nSelector" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock "Demux" + SrcPort 1 + Points [40, 0; 0, 40; 120, 0] + DstBlock "Bus\nCreator1" + DstPort 3 + } + Line { + ZOrder 4 + SrcBlock "Gain" + SrcPort 1 + Points [5, 0; 0, -25] + DstBlock "Bus\nCreator1" + DstPort 2 + } + Line { + ZOrder 5 + SrcBlock "Gain2" + SrcPort 1 + DstBlock "Bus\nCreator1" + DstPort 1 + } + Line { + ZOrder 6 + SrcBlock "Rate Transition1" + SrcPort 1 + Points [35, 0; 0, -35] + DstBlock "VR Sink" + DstPort 2 + } + Line { + ZOrder 7 + SrcBlock "Rate Transition" + SrcPort 1 + DstBlock "VR Sink" + DstPort 1 + } + Line { + ZOrder 8 + SrcBlock "Demux" + SrcPort 3 + DstBlock "Gain" + DstPort 1 + } + Line { + ZOrder 9 + SrcBlock "Demux" + SrcPort 2 + Points [80, 0] + DstBlock "Gain2" + DstPort 1 + } + Line { + ZOrder 10 + SrcBlock "Bus\nCreator1" + SrcPort 1 + DstBlock "Gain1" + DstPort 1 + } + Line { + Name "<phi>" + ZOrder 11 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 1 + Points [0, -10; 45, 0; 0, 60] + DstBlock "Bus\nCreator" + DstPort 3 + } + Line { + Name "<psi>" + ZOrder 12 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 3 + Points [0, -10; 75, 0] + DstBlock "Bus\nCreator" + DstPort 2 + } + Line { + Name "<theta>" + ZOrder 13 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 2 + Points [30, 0; 0, -25] + DstBlock "Bus\nCreator" + DstPort 1 + } + Line { + ZOrder 14 + SrcBlock "Gain1" + SrcPort 1 + DstBlock "Rate Transition1" + DstPort 1 + } + Line { + Name "psi" + ZOrder 15 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 3 + DstBlock "Bus\nCreator2" + DstPort 3 + } + Line { + Name "theta" + ZOrder 16 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 2 + DstBlock "Bus\nCreator2" + DstPort 2 + } + Line { + Name "phi" + ZOrder 17 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 1 + DstBlock "Bus\nCreator2" + DstPort 1 + } + Line { + ZOrder 18 + SrcBlock "Euler Angles" + SrcPort 1 + DstBlock "Demux1" + DstPort 1 + } + Line { + ZOrder 19 + SrcBlock "Bus\nCreator" + SrcPort 1 + DstBlock "MATLAB Function" + DstPort 1 + } + Line { + ZOrder 20 + SrcBlock "MATLAB Function" + SrcPort 1 + DstBlock "Rate Transition" + DstPort 1 + } + } + } + Block { + BlockType SubSystem + Name "3D Graphical Simulation1" + SID "936" + Ports [2] + Position [2635, 815, 2785, 875] + ZOrder 290 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 39 + $ClassName "Simulink.Mask" + Display "port_label('input',1, '\\Theta','texmode','on')\nport_label('input',2,'r_{o}','texmode','on')" + } + System { + Name "3D Graphical Simulation1" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "80" + Block { + BlockType Inport + Name "Euler Angles\n" + SID "937" + Position [180, 108, 210, 122] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "Displacement" + SID "938" + Position [180, 218, 210, 232] + ZOrder -2 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType BusCreator + Name "Bus\nCreator" + SID "939" + Ports [3, 1] + Position [600, 76, 610, 154] + ZOrder -3 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusCreator + Name "Bus\nCreator1" + SID "940" + Ports [3, 1] + Position [630, 191, 640, 269] + ZOrder -4 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusCreator + Name "Bus\nCreator2" + SID "941" + Ports [3, 1] + Position [385, 75, 390, 155] + ZOrder -5 + ShowName off + Inputs "3" + DisplayOption "bar" + InheritFromInputs on + } + Block { + BlockType BusSelector + Name "Bus\nSelector" + SID "942" + Ports [1, 3] + Position [500, 77, 505, 153] + ZOrder -6 + ShowName off + OutputSignals "phi,theta,psi" + Port { + PortNumber 1 + Name "<phi>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "<theta>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "<psi>" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Demux + Name "Demux" + SID "943" + Ports [1, 3] + Position [440, 183, 450, 267] + ZOrder -7 + BackgroundColor "black" + ShowName off + Outputs "3" + DisplayOption "bar" + } + Block { + BlockType Demux + Name "Demux1" + SID "944" + Ports [1, 3] + Position [290, 75, 295, 155] + ZOrder -8 + ShowName off + Outputs "3" + DisplayOption "bar" + Port { + PortNumber 1 + Name "phi" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 2 + Name "theta" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + Port { + PortNumber 3 + Name "psi" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Gain + Name "Gain" + SID "945" + Position [550, 240, 580, 270] + ZOrder -10 + Gain "-1" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Gain + Name "Gain1" + SID "946" + Position [670, 208, 710, 252] + ZOrder -11 + Gain "eye(3)*1" + Multiplication "Matrix(K*u)" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType Gain + Name "Gain2" + SID "947" + Position [550, 190, 580, 220] + ZOrder -12 + Gain "-1" + ParamDataTypeStr "Inherit: Inherit via internal rule" + OutDataTypeStr "Inherit: Inherit via internal rule" + SaturateOnIntegerOverflow off + } + Block { + BlockType SubSystem + Name "MATLAB Function" + SID "948" + Ports [1, 1] + Position [655, 92, 725, 138] + ZOrder 5 + ErrorFcn "Stateflow.Translate.translate" + PermitHierarchicalResolution "ParametersOnly" + TreatAsAtomicUnit on + RequestExecContextInheritance off + SFBlockType "MATLAB Function" + Variant off + System { + Name "MATLAB Function" + Location [223, 338, 826, 833] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "100" + SIDHighWatermark "21" + Block { + BlockType Inport + Name "u" + SID "948::1" + Position [20, 101, 40, 119] + ZOrder -1 + IconDisplay "Port number" + } + Block { + BlockType Demux + Name " Demux " + SID "948::20" + Ports [1, 1] + Position [270, 230, 320, 270] + ZOrder 11 + Outputs "1" + } + Block { + BlockType S-Function + Name " SFunction " + SID "948::19" + Tag "Stateflow S-Function Quadcopter_Model_R2015_A 3" + Ports [1, 2] + Position [180, 100, 230, 160] + ZOrder 10 + FunctionName "sf_sfun" + PortCounts "[1 2]" + SFunctionDeploymentMode off + EnableBusSupport on + Port { + PortNumber 2 + Name "y" + RTWStorageClass "Auto" + DataLoggingNameMode "SignalName" + } + } + Block { + BlockType Terminator + Name " Terminator " + SID "948::21" + Position [460, 241, 480, 259] + ZOrder 12 + } + Block { + BlockType Outport + Name "y" + SID "948::5" + Position [460, 101, 480, 119] + ZOrder -5 + IconDisplay "Port number" + } + Line { + ZOrder 1 + SrcBlock "u" + SrcPort 1 + DstBlock " SFunction " + DstPort 1 + } + Line { + Name "y" + ZOrder 2 + Labels [0, 0] + SrcBlock " SFunction " + SrcPort 2 + DstBlock "y" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock " Demux " + SrcPort 1 + DstBlock " Terminator " + DstPort 1 + } + Line { + ZOrder 4 + SrcBlock " SFunction " + SrcPort 1 + DstBlock " Demux " + DstPort 1 + } + } + } + Block { + BlockType RateTransition + Name "Rate Transition" + SID "949" + Position [755, 94, 795, 136] + ZOrder -13 + NamePlacement "alternate" + OutPortSampleTime "0.06" + } + Block { + BlockType RateTransition + Name "Rate Transition1" + SID "950" + Position [735, 210, 770, 250] + ZOrder -14 + OutPortSampleTime "0.06" + } + Block { + BlockType Reference + Name "VR Sink" + SID "951" + Ports [2] + Position [865, 76, 1055, 234] + ZOrder -15 + LibraryVersion "1.36" + SourceBlock "vrlib/VR Sink" + SourceType "Virtual Reality Sink" + InstantiateOnLoad on + SampleTime "-1" + ViewEnable on + RemoteChange off + RemoteView off + FieldsWritten "Helicopter.rotation.4.1.1.double#Helicopter.translation.3.1.1.double" + WorldFileName "quadrotor_world_ucart.wrl" + AutoView on + VideoDimensions "[]" + AllowVariableSize off + } + Line { + ZOrder 2 + SrcBlock "Bus\nCreator2" + SrcPort 1 + DstBlock "Bus\nSelector" + DstPort 1 + } + Line { + ZOrder 3 + SrcBlock "Demux" + SrcPort 1 + Points [40, 0; 0, 40; 120, 0] + DstBlock "Bus\nCreator1" + DstPort 3 + } + Line { + ZOrder 4 + SrcBlock "Gain" + SrcPort 1 + Points [5, 0; 0, -25] + DstBlock "Bus\nCreator1" + DstPort 2 + } + Line { + ZOrder 5 + SrcBlock "Gain2" + SrcPort 1 + DstBlock "Bus\nCreator1" + DstPort 1 + } + Line { + ZOrder 6 + SrcBlock "Rate Transition1" + SrcPort 1 + Points [35, 0; 0, -35] + DstBlock "VR Sink" + DstPort 2 + } + Line { + ZOrder 7 + SrcBlock "Rate Transition" + SrcPort 1 + DstBlock "VR Sink" + DstPort 1 + } + Line { + ZOrder 8 + SrcBlock "Demux" + SrcPort 3 + DstBlock "Gain" + DstPort 1 + } + Line { + ZOrder 9 + SrcBlock "Demux" + SrcPort 2 + Points [80, 0] + DstBlock "Gain2" + DstPort 1 + } + Line { + ZOrder 10 + SrcBlock "Bus\nCreator1" + SrcPort 1 + DstBlock "Gain1" + DstPort 1 + } + Line { + Name "<phi>" + ZOrder 11 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 1 + Points [0, -10; 45, 0; 0, 60] + DstBlock "Bus\nCreator" + DstPort 3 + } + Line { + Name "<psi>" + ZOrder 12 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 3 + Points [0, -10; 75, 0] + DstBlock "Bus\nCreator" + DstPort 2 + } + Line { + Name "<theta>" + ZOrder 13 + Labels [0, 0] + SrcBlock "Bus\nSelector" + SrcPort 2 + Points [30, 0; 0, -25] + DstBlock "Bus\nCreator" + DstPort 1 + } + Line { + ZOrder 14 + SrcBlock "Gain1" + SrcPort 1 + DstBlock "Rate Transition1" + DstPort 1 + } + Line { + Name "psi" + ZOrder 15 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 3 + DstBlock "Bus\nCreator2" + DstPort 3 + } + Line { + Name "theta" + ZOrder 16 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 2 + DstBlock "Bus\nCreator2" + DstPort 2 + } + Line { + Name "phi" + ZOrder 17 + Labels [0, 0] + SrcBlock "Demux1" + SrcPort 1 + DstBlock "Bus\nCreator2" + DstPort 1 + } + Line { + ZOrder 19 + SrcBlock "Bus\nCreator" + SrcPort 1 + DstBlock "MATLAB Function" + DstPort 1 + } + Line { + ZOrder 20 + SrcBlock "MATLAB Function" + SrcPort 1 + DstBlock "Rate Transition" + DstPort 1 + } + Line { + ZOrder 21 + SrcBlock "Displacement" + SrcPort 1 + DstBlock "Demux" + DstPort 1 + } + Line { + ZOrder 22 + SrcBlock "Euler Angles\n" + SrcPort 1 + DstBlock "Demux1" + DstPort 1 + } + } + } + Block { + BlockType Delay + Name "Delay" + SID "910" + Ports [1, 1] + Position [2090, 843, 2125, 877] + ZOrder 286 + BlockMirror on + InputPortMap "u0" + DelayLength "1" + InitialCondition "0" + } + Block { + BlockType Delay + Name "Delay1" + SID "909" + Ports [1, 1] + Position [1660, 638, 1695, 672] + ZOrder 285 + BlockMirror on + InputPortMap "u0" + DelayLength "1" + InitialCondition "0" + } + Block { + BlockType Demux + Name "Demux" + SID "984" + Ports [1, 3] + Position [1810, 1023, 1815, 1077] + ZOrder 294 + ShowName off + Outputs "3" + DisplayOption "bar" + } + Block { + BlockType Demux + Name "Demux1" + SID "1006" + Ports [1, 2] + Position [2280, 605, 2285, 660] + ZOrder 300 + ShowName off + Outputs "2" + DisplayOption "bar" + } + Block { + BlockType Reference + Name "First-Order\nHold" + SID "953" + Ports [1, 1] + Position [2530, 780, 2565, 810] + ZOrder 292 + LibraryVersion "1.388" + DisableCoverage on + SourceBlock "simulink/Discrete/First-Order\nHold" + SourceType "First-Order Hold" + ContentPreviewEnabled off + Ts "6.1e-3" + } + Block { + BlockType Reference + Name "First-Order\nHold1" + SID "986" + Ports [1, 1] + Position [2530, 875, 2565, 905] + ZOrder 296 + LibraryVersion "1.388" + DisableCoverage on + SourceBlock "simulink/Discrete/First-Order\nHold" + SourceType "First-Order Hold" + ContentPreviewEnabled off + Ts "6.1e-3" + } + Block { + BlockType Mux + Name "Mux" + SID "1007" + Ports [3, 1] + Position [2455, 608, 2460, 682] + ZOrder 301 + ShowName off + Inputs "3" + DisplayOption "bar" + } + Block { + BlockType Scope + Name "Scope" + SID "894" + Ports [1] + Position [1385, 669, 1415, 701] + ZOrder 270 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData1 + YMin -10 + YMax 10 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [680 330 1240 750] + } + Block { + BlockType Scope + Name "Scope1" + SID "895" + Ports [1] + Position [1385, 599, 1415, 631] + ZOrder 271 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData2 + YMin -1.18227 + YMax 0.1338 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope3" + SID "897" + Ports [1] + Position [2255, 534, 2285, 566] + ZOrder 278 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData4 + YMin -1.66746 + YMax 0.20394 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat Array + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope6" + SID "898" + Ports [1] + Position [1955, 469, 1985, 501] + ZOrder 280 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData5 + YMin -0.10821 + YMax 0.91739 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1921 1039] + } + Block { + BlockType Scope + Name "Scope7" + SID "899" + Ports [1] + Position [1955, 544, 1985, 576] + ZOrder 281 + NumInputPorts "1" + Open off + TimeRange auto + TickLabels OneTimeTick + ShowLegends off + LimitDataPoints off + MaxDataPoints 5000 + SaveToWorkspace off + SaveName ScopeData6 + YMin -2.66218 + YMax 0.34207 + SampleInput off + SampleTime -1 + ZoomMode on + Grid on + DataFormat StructureWithTime + Decimation 1 + List { + ListType AxesTitles + axes1 "%<SignalLabel>" + } + List { + ListType ScopeGraphics + FigureColor "[0.156862745098039 0.156862745098039 0.156862745098039]" + AxesColor "[0 0 0]" + AxesTickColor "[0.686274509803922 0.686274509803922 0.686274509803922]" + LineColors "[1 1 0;1 0 1;0 1 1;1 0 0;0 1 0;0 0 1]" + LineStyles "-|-|-|-|-|-" + LineWidths "[0.5 0.5 0.5 0.5 0.5 0.5]" + MarkerStyles "none|none|none|none|none|none" + } + Location [1 76 1909 1039] + } + Block { + BlockType S-Function + Name "Soft Real Time" + SID "927" + Ports [] + Position [2033, 1185, 2120, 1216] + ZOrder 288 + ShowName off + Commented "on" + FunctionName "sfun_time" + Parameters "x" + SFunctionDeploymentMode off + EnableBusSupport off + Object { + $PropName "MaskObject" + $ObjectID 40 + $ClassName "Simulink.Mask" + Display "color('red')\ndisp('Soft Real Time')\n" + Object { + $PropName "Parameters" + $ObjectID 41 + $ClassName "Simulink.MaskParameter" + Type "edit" + Name "x" + Prompt "Time Scaling Factor" + Value "1" + } + } + } + Block { + BlockType Outport + Name "euler_angles_filtered" + SID "901" + Position [2540, 638, 2570, 652] + ZOrder 262 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "euler_rates" + SID "904" + Position [2005, 903, 2035, 917] + ZOrder 259 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "current_position" + SID "928" + Position [2335, 963, 2365, 977] + ZOrder 289 + Port "3" + IconDisplay "Port number" + } + Line { + ZOrder 170 + SrcBlock "\n\n\n\n\n\n\n\n\n\n" + SrcPort 1 + Points [23, 0] + Branch { + ZOrder 199 + Points [0, -70] + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n1" + DstPort 1 + } + Branch { + ZOrder 198 + Points [0, 25] + DstBlock "Scope1" + DstPort 1 + } + } + Line { + ZOrder 173 + SrcBlock "\n\n\n\n\n\n\n\n\n\n" + SrcPort 2 + Points [15, 0] + Branch { + ZOrder 172 + Points [0, -35] + DstBlock "Scope" + DstPort 1 + } + Branch { + ZOrder 171 + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 1 + } + } + Line { + ZOrder 174 + SrcBlock "B_vo_dot" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n\n\n\n" + DstPort 1 + } + Line { + ZOrder 175 + SrcBlock "B_vo" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n\n\n\n" + DstPort 2 + } + Line { + ZOrder 176 + SrcBlock "B_Omega" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n\n\n\n" + DstPort 3 + } + Line { + ZOrder 177 + SrcBlock "B_g" + SrcPort 1 + DstBlock "\n\n\n\n\n\n\n\n\n\n" + DstPort 4 + } + Line { + ZOrder 197 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n1" + SrcPort 2 + Points [17, 0] + Branch { + ZOrder 207 + Points [0, 60] + DstBlock "Delay1" + DstPort 1 + } + Branch { + ZOrder 202 + Points [31, 0] + Branch { + ZOrder 201 + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 2 + } + Branch { + ZOrder 180 + Points [0, -35] + DstBlock "Scope7" + DstPort 1 + } + } + } + Line { + ZOrder 195 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n1" + SrcPort 1 + Points [47, 0] + Branch { + ZOrder 205 + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 1 + } + Branch { + ZOrder 183 + Points [0, -35] + DstBlock "Scope6" + DstPort 1 + } + } + Line { + ZOrder 209 + SrcBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + SrcPort 1 + Points [58, 0] + Branch { + ZOrder 221 + Points [0, 160] + DstBlock "euler_rates" + DstPort 1 + } + Branch { + ZOrder 220 + Points [0, -80] + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 3 + } + } + Line { + ZOrder 208 + SrcBlock "Delay" + SrcPort 1 + Points [-102, 0] + Branch { + ZOrder 191 + Points [0, -115] + DstBlock "\n\n\n\n\n\n\n\n" + DstPort 4 + } + Branch { + ZOrder 190 + Points [-566, 0; 0, -80] + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + DstPort 2 + } + } + Line { + ZOrder 204 + SrcBlock "Delay1" + SrcPort 1 + Points [-199, 0; 0, -60] + DstBlock "\n\n\n\n\n\n\n\n\n\n\n\n1" + DstPort 2 + } + Line { + ZOrder 211 + SrcBlock "euler_angles" + SrcPort 1 + Points [23, 0] + Branch { + ZOrder 332 + Points [0, 70] + DstBlock "3D Graphical Simulation" + DstPort 2 + } + Branch { + ZOrder 293 + DstBlock "Demux" + DstPort 1 + } + } + Line { + ZOrder 189 + SrcBlock "\n\n\n\n\n\n\n\n" + SrcPort 1 + Points [16, 0] + Branch { + ZOrder 327 + DstBlock "Demux1" + DstPort 1 + } + Branch { + ZOrder 216 + Points [0, 225] + DstBlock "Delay" + DstPort 1 + } + Branch { + ZOrder 187 + Points [0, -85] + DstBlock "Scope3" + DstPort 1 + } + } + Line { + ZOrder 243 + SrcBlock "First-Order\nHold" + SrcPort 1 + Points [50, 0] + DstBlock "3D Graphical Simulation1" + DstPort 1 + } + Line { + ZOrder 212 + SrcBlock "E_ro" + SrcPort 1 + Points [196, 0] + Branch { + ZOrder 331 + Points [0, 120] + DstBlock "3D Graphical Simulation" + DstPort 1 + } + Branch { + ZOrder 304 + DstBlock "\n\n " + DstPort 1 + } + } + Line { + ZOrder 305 + SrcBlock "Demux" + SrcPort 3 + Points [23, 0; 0, -55] + DstBlock "\n\n " + DstPort 2 + } + Line { + ZOrder 290 + SrcBlock "First-Order\nHold1" + SrcPort 1 + Points [30, 0; 0, -30] + DstBlock "3D Graphical Simulation1" + DstPort 2 + } + Line { + ZOrder 333 + SrcBlock "Demux1" + SrcPort 1 + DstBlock "Mux" + DstPort 1 + } + Line { + ZOrder 334 + SrcBlock "Demux1" + SrcPort 2 + DstBlock "Mux" + DstPort 2 + } + Line { + ZOrder 335 + SrcBlock "\n\n " + SrcPort 2 + Points [195, 0; 0, -345] + DstBlock "Mux" + DstPort 3 + } + Line { + ZOrder 336 + SrcBlock "Mux" + SrcPort 1 + Points [21, 0] + Branch { + ZOrder 339 + Points [0, 150] + DstBlock "First-Order\nHold" + DstPort 1 + } + Branch { + ZOrder 338 + DstBlock "euler_angles_filtered" + DstPort 1 + } + } + Line { + ZOrder 306 + SrcBlock "\n\n " + SrcPort 1 + Points [70, 0] + Branch { + ZOrder 341 + Points [0, -80] + DstBlock "First-Order\nHold1" + DstPort 1 + } + Branch { + ZOrder 340 + DstBlock "current_position" + DstPort 1 + } + } + } + } + Block { + BlockType SubSystem + Name " \n" + SID "583" + Ports [4, 4] + Position [895, 478, 1075, 712] + ZOrder 65 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 42 + $ClassName "Simulink.Mask" + Display "port_label('input', 1, 'Setpoints', 'texmode', 'on');\nport_label('input', 2, '\\Theta_{filtered}', 'texmo" + "de', 'on');\nport_label('input', 3, 'd\\Theta_{gyro}/dt', 'texmode', 'on');\nport_label('input', 4, '^{E}r_o', 'texmo" + "de', 'on');\nport_label('output', 1, 'Rotor 1 Duty Cycle', 'texmode', 'on');\nport_label('output', 2, 'Rotor 2 Duty C" + "ycle', 'texmode', 'on');\nport_label('output', 3, 'Rotor 3 Duty Cycle', 'texmode', 'on');\nport_label('output', 4, 'R" + "otor 4 Duty Cycle', 'texmode', 'on');\ndisp('Control System', 'texmode', 'on');" + } + System { + Name " \n" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "125" + Block { + BlockType Inport + Name "setpoints" + SID "585" + Position [110, 348, 140, 362] + ZOrder 2 + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_angles_filtered" + SID "591" + Position [110, 403, 140, 417] + ZOrder 9 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "euler_rates" + SID "592" + Position [110, 448, 140, 462] + ZOrder 11 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Inport + Name "current_position" + SID "584" + Position [110, 493, 140, 507] + ZOrder -1 + Port "4" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "Rotor 0 Duty Cycle" + SID "597" + Position [480, 348, 510, 362] + ZOrder -2 + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "Rotor 1 Duty Cycle" + SID "598" + Position [480, 403, 510, 417] + ZOrder 6 + Port "2" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "Rotor 2 Duty Cycle" + SID "599" + Position [480, 448, 510, 462] + ZOrder 7 + Port "3" + IconDisplay "Port number" + } + Block { + BlockType Outport + Name "Rotor 3 Duty Cycle" + SID "600" + Position [480, 493, 510, 507] + ZOrder 8 + Port "4" + IconDisplay "Port number" + } + } + } + Block { + BlockType SubSystem + Name "Communication System" + SID "574" + Ports [0, 1] + Position [760, 482, 815, 528] + ZOrder 66 + RequestExecContextInheritance off + Variant off + Object { + $PropName "MaskObject" + $ObjectID 43 + $ClassName "Simulink.Mask" + Display "port_label('output', 1, 'Setpoints', 'texmode', 'on');" + } + System { + Name "Communication System" + Location [-8, -8, 1928, 1048] + Open off + ModelBrowserVisibility off + ModelBrowserWidth 200 + ScreenColor "white" + PaperOrientation "landscape" + PaperPositionMode "auto" + PaperType "usletter" + PaperUnits "inches" + TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] + TiledPageScale 1 + ShowPageBoundaries off + ZoomFactor "300" + Block { + BlockType Step + Name "Step" + SID "929" + Position [925, 390, 955, 420] + ZOrder 32 + Before "zeros(4,1)" + After "[0; 0; 0; 0]" + SampleTime "0" + } + Block { + BlockType Outport + Name "setpoints" + SID "577" + Position [1050, 398, 1080, 412] + ZOrder 6 + IconDisplay "Port number" + } + Line { + ZOrder 8 + SrcBlock "Step" + SrcPort 1 + DstBlock "setpoints" + DstPort 1 + } + } + } + Line { + ZOrder 172 + SrcBlock " \n" + SrcPort 1 + DstBlock "\n\n\n\n\n\n" + DstPort 1 + } + Line { + ZOrder 260 + SrcBlock " " + SrcPort 2 + Points [23, 0; 0, 147; -843, 0; 0, -117] + DstBlock " \n" + DstPort 3 + } + Line { + ZOrder 233 + SrcBlock " " + SrcPort 1 + Points [40, 0; 0, 246; -885, 0; 0, -196] + DstBlock " \n" + DstPort 2 + } + Line { + ZOrder 180 + SrcBlock "Communication System" + SrcPort 1 + DstBlock " \n" + DstPort 1 + } + Line { + ZOrder 186 + SrcBlock " \n" + SrcPort 2 + DstBlock "\n\n\n\n\n\n" + DstPort 2 + } + Line { + ZOrder 187 + SrcBlock " \n" + SrcPort 3 + DstBlock "\n\n\n\n\n\n" + DstPort 3 + } + Line { + ZOrder 188 + SrcBlock " \n" + SrcPort 4 + DstBlock "\n\n\n\n\n\n" + DstPort 4 + } + Line { + ZOrder 227 + SrcBlock "\n\n\n\n\n\n" + SrcPort 1 + DstBlock " " + DstPort 1 + } + Line { + ZOrder 229 + SrcBlock "\n\n\n\n\n\n" + SrcPort 2 + DstBlock " " + DstPort 2 + } + Line { + ZOrder 230 + SrcBlock "\n\n\n\n\n\n" + SrcPort 3 + DstBlock " " + DstPort 3 + } + Line { + ZOrder 228 + SrcBlock "\n\n\n\n\n\n" + SrcPort 4 + DstBlock " " + DstPort 4 + } + Line { + ZOrder 231 + SrcBlock "\n\n\n\n\n\n" + SrcPort 5 + DstBlock " " + DstPort 5 + } + Line { + ZOrder 232 + SrcBlock "\n\n\n\n\n\n" + SrcPort 6 + DstBlock " " + DstPort 6 + } + Line { + ZOrder 261 + SrcBlock " " + SrcPort 3 + Points [9, 0; 0, 51; -804, 0; 0, -41] + DstBlock " \n" + DstPort 4 + } + } +} +#Finite State Machines +# +# Stateflow 80000010 +# +# +Stateflow { + machine { + id 1 + name "Quadcopter_Model_R2015_A" + created "27-Oct-2016 22:17:19" + isLibrary 0 + sfVersion 80000006 + firstTarget 139 + } + chart { + id 2 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 3 0 0] + viewObj 2 + ssIdHighWaterMark 7 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 1 + disableImplicitCasting 1 + eml { + name "gravity" + } + firstData 4 + firstTransition 8 + firstJunction 7 + } + state { + id 3 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 2 + treeNode [2 0 0 0] + superState SUBCHART + subviewer 2 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function E_Fg = gravity( m, g)\n\nE_Fg = [0; 0; m*g];\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 4 + ssIdNumber 5 + name "E_Fg" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [2 0 5] + } + data { + id 5 + ssIdNumber 6 + name "m" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 1 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [2 4 6] + } + data { + id 6 + ssIdNumber 7 + name "g" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [2 5 0] + } + junction { + id 7 + position [23.5747 49.5747 7] + chart 2 + subviewer 2 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [2 0 0] + } + transition { + id 8 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 7 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 2 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 2 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [2 0 0] + } + instance { + id 9 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n" + chart 2 + } + chart { + id 10 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 11 0 0] + viewObj 10 + ssIdHighWaterMark 11 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 2 + disableImplicitCasting 1 + eml { + name "linear_body_earth_conversion" + } + firstData 12 + firstTransition 16 + firstJunction 15 + } + state { + id 11 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 10 + treeNode [10 0 0 0] + superState SUBCHART + subviewer 10 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function E_ro = linear_body_earth_conversion(B_vo, euler_angles)\n\neuler_rates = zeros(3,1);\nE" + "_ro = zeros(3,1);\n\nphi = euler_angles(1);\ntheta = euler_angles(2);\npsi = euler_angles(3);\n\nLeb = [cos(thet" + "a)*cos(psi), sin(phi)*sin(theta)*cos(psi)-cos(phi)*sin(psi), cos(phi)*sin(theta)*cos(psi)+sin(phi)*sin(psi); ..." + "\n cos(theta)*sin(psi), sin(phi)*sin(theta)*sin(psi)+cos(phi)*cos(psi), cos(phi)*sin(theta)*sin(psi)-sin(p" + "hi)*cos(psi); ...\n -sin(theta) , sin(phi)*cos(theta) , c" + "os(phi)*cos(theta) ];\n\nE_ro = Leb * B_vo;" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 12 + ssIdNumber 7 + name "B_vo" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [10 0 13] + } + data { + id 13 + ssIdNumber 11 + name "euler_angles" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [10 12 14] + } + data { + id 14 + ssIdNumber 9 + name "E_ro" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [10 13 0] + } + junction { + id 15 + position [23.5747 49.5747 7] + chart 10 + subviewer 10 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [10 0 0] + } + transition { + id 16 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 15 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 10 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 10 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [10 0 0] + } + instance { + id 17 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n" + chart 10 + } + chart { + id 18 + machine 1 + name " /3D Graphical Simulation1/MATLAB Function" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 19 0 0] + viewObj 18 + ssIdHighWaterMark 5 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 3 + disableImplicitCasting 1 + eml { + name "eigenaxis_ucart" + } + firstData 20 + firstTransition 23 + firstJunction 22 + } + state { + id 19 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 18 + treeNode [18 0 0 0] + superState SUBCHART + subviewer 18 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function y = eigenaxis_ucart(u)\n\n\nif abs(u(1))< 0.0001\n u(1) = 0.0001;\nend\n\nif abs(u(2)" + ")< 0.0001\n u(2) = 0.0001;\nend\n\nif abs(u(3))< 0.0001\n u(3) = 0.0001;\nend\n\nu = [ -u(1); -u(2); u(3) " + "];% [Pitch, Yaw, Roll] \n\nC11 = cos(u(2))*cos(u(3));\nC12 = cos(u(2))*sin(u(3));\nC13 = -sin(u(2));\nC21 = sin(" + "u(1))*sin(u(2))*cos(u(3))-cos(u(1))*sin(u(3));\nC22 = sin(u(1))*sin(u(2))*sin(u(3))+cos(u(1))*cos(u(3));\nC23 = " + "sin(u(1))*cos(u(2));\nC31 = cos(u(1))*sin(u(2))*cos(u(3))+sin(u(1))*sin(u(3));\nC32 = cos(u(1))*sin(u(2))*sin(u(" + "3))-sin(u(1))*cos(u(3));\nC33 = cos(u(1))*cos(u(2));\n \ntheta = acos(0.5*(C11+C22+C33-1));\n\ne = [C23-C32; " + "C31-C13; C12-C21]/(2*sin(theta));\n \ny = [e; theta];\n\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 20 + ssIdNumber 4 + name "u" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [18 0 21] + } + data { + id 21 + ssIdNumber 5 + name "y" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [18 20 0] + } + junction { + id 22 + position [23.5747 49.5747 7] + chart 18 + subviewer 18 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [18 0 0] + } + transition { + id 23 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 22 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 18 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 18 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [18 0 0] + } + instance { + id 24 + machine 1 + name " /3D Graphical Simulation1/MATLAB Function" + chart 18 + } + chart { + id 25 + machine 1 + name "\n\n\n\n\n\n/\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 26 0 0] + viewObj 25 + ssIdHighWaterMark 18 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 4 + disableImplicitCasting 1 + eml { + name "ESC" + } + firstData 27 + firstTransition 36 + firstJunction 35 + } + state { + id 26 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 25 + treeNode [25 0 0 0] + superState SUBCHART + subviewer 25 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function Vb_eff = ESC(rotor_0_duty_cycle, rotor_1_duty_cycle, rotor_2_duty_cycle, rotor_3_duty_" + "cycle, Pmin, Pmax, Vb)\n\n% Define u_Pi for each of the rotors\nu_P0 = (rotor_0_duty_cycle/100 - Pmin) / (Pmax -" + " Pmin);\nu_P1 = (rotor_1_duty_cycle/100 - Pmin) / (Pmax - Pmin);\nu_P2 = (rotor_2_duty_cycle/100 - Pmin) / (Pmax" + " - Pmin);\nu_P3 = (rotor_3_duty_cycle/100 - Pmin) / (Pmax - Pmin);\n\n% Determine the effective battery voltage " + "from each ESC\nVb_eff_0 = u_P0 * Vb;\nVb_eff_1 = u_P1 * Vb;\nVb_eff_2 = u_P2 * Vb;\nVb_eff_3 = u_P3 * Vb;\n\nVb_" + "eff = [Vb_eff_0, Vb_eff_1, Vb_eff_2, Vb_eff_3];\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 27 + ssIdNumber 4 + name "rotor_0_duty_cycle" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 0 28] + } + data { + id 28 + ssIdNumber 5 + name "Vb_eff" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [25 27 29] + } + data { + id 29 + ssIdNumber 6 + name "rotor_1_duty_cycle" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 28 30] + } + data { + id 30 + ssIdNumber 7 + name "rotor_2_duty_cycle" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 29 31] + } + data { + id 31 + ssIdNumber 8 + name "rotor_3_duty_cycle" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 30 32] + } + data { + id 32 + ssIdNumber 16 + name "Pmin" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 1 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 31 33] + } + data { + id 33 + ssIdNumber 17 + name "Pmax" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 32 34] + } + data { + id 34 + ssIdNumber 18 + name "Vb" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 2 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [25 33 0] + } + junction { + id 35 + position [23.5747 49.5747 7] + chart 25 + subviewer 25 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [25 0 0] + } + transition { + id 36 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 35 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 25 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 25 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [25 0 0] + } + instance { + id 37 + machine 1 + name "\n\n\n\n\n\n/\n\n" + chart 25 + } + chart { + id 38 + machine 1 + name "\n\n\n\n\n\n/\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 39 0 0] + viewObj 38 + ssIdHighWaterMark 14 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 5 + disableImplicitCasting 1 + eml { + name "motor" + } + firstData 40 + firstTransition 50 + firstJunction 49 + } + state { + id 39 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 38 + treeNode [38 0 0 0] + superState SUBCHART + subviewer 38 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function angular_acceleration = motor(Vb_eff, angular_velocity, Rm, Kv, Kq, Kd, If, Jreq)\n\n% D" + "efine each motors effective battery voltage\nVb_eff_0 = Vb_eff(1);\nVb_eff_1 = Vb_eff(2);\nVb_eff_2 = Vb_eff(3);" + "\nVb_eff_3 = Vb_eff(4);\n\n% Determine the angular velocity of each rotor from feedback\nw_0 = angular_velocity(" + "1);\nw_1 = angular_velocity(2);\nw_2 = angular_velocity(3);\nw_3 = angular_velocity(4);\n\n% Determine angular a" + "cceleration of each rotor\nw_0_dot = 1/(Jreq*Rm*Kq) * Vb_eff_0 - 1/(Jreq*Rm*Kq*Kv) * w_0 - 1/(Jreq*Kq)*If - (Kd/" + "Jreq) * w_0^2;\nw_1_dot = 1/(Jreq*Rm*Kq) * Vb_eff_1 - 1/(Jreq*Rm*Kq*Kv) * w_1 - 1/(Jreq*Kq)*If - (Kd/Jreq) * w_1" + "^2;\nw_2_dot = 1/(Jreq*Rm*Kq) * Vb_eff_2 - 1/(Jreq*Rm*Kq*Kv) * w_2 - 1/(Jreq*Kq)*If - (Kd/Jreq) * w_2^2;\nw_3_do" + "t = 1/(Jreq*Rm*Kq) * Vb_eff_3 - 1/(Jreq*Rm*Kq*Kv) * w_3 - 1/(Jreq*Kq)*If - (Kd/Jreq) * w_3^2;\n\nangular_acceler" + "ation = [w_0_dot, w_1_dot, w_2_dot, w_3_dot]; " + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 40 + ssIdNumber 4 + name "Vb_eff" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 0 41] + } + data { + id 41 + ssIdNumber 8 + name "angular_velocity" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 40 42] + } + data { + id 42 + ssIdNumber 7 + name "angular_acceleration" + scope OUTPUT_DATA + machine 1 + props { + array { + size "1,4" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [38 41 43] + } + data { + id 43 + ssIdNumber 9 + name "Rm" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 5 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 42 44] + } + data { + id 44 + ssIdNumber 10 + name "Kv" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 4 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 43 45] + } + data { + id 45 + ssIdNumber 11 + name "Kq" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 3 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 44 46] + } + data { + id 46 + ssIdNumber 12 + name "Kd" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 2 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 45 47] + } + data { + id 47 + ssIdNumber 13 + name "If" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 46 48] + } + data { + id 48 + ssIdNumber 14 + name "Jreq" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 1 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [38 47 0] + } + junction { + id 49 + position [23.5747 49.5747 7] + chart 38 + subviewer 38 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [38 0 0] + } + transition { + id 50 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 49 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 38 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 38 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [38 0 0] + } + instance { + id 51 + machine 1 + name "\n\n\n\n\n\n/\n" + chart 38 + } + chart { + id 52 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 53 0 0] + viewObj 52 + ssIdHighWaterMark 30 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 6 + disableImplicitCasting 1 + eml { + name "rotor" + } + firstData 54 + firstTransition 72 + firstJunction 71 + } + state { + id 53 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 52 + treeNode [52 0 0 0] + superState SUBCHART + subviewer 52 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function [B_omega_dot, B_vo_dot]= rotor(angular_acceleration, angular_velocity, B_Fg, B_omega, B_" + "vo, m, Kt, Kd, rhx, rhy, rhz, Jreq, Jxx, Jyy, Jzz)\n\nB_vo_dot = zeros(3,1);\nB_omega_dot = zeros(3,1);\n\n% Cre" + "ate J vector\nJ = [Jxx, 0 , 0 ; ...\n 0 , Jyy, 0 ; ...\n 0 , 0 , Jzz;];\n\n% Create r_hi vector\nr" + "h_0 = [-rhx; rhy; rhz];\nrh_1 = [rhx; rhy; rhz];\nrh_2 = [-rhx; -rhy; rhz];\nrh_3 = [rhx; -rhy; rhz];\n\n% Defin" + "e vector from body frame origin to center of mass\nbr_oc = [0; 0; 0];\n\n% Define 3x3 Identity Matrix\nI = eye(3" + ");\n\n% Create gamma vectors\ngamma_Ti = [0; 0; -1];\ngamma_omega_03 = [0; 0; -1]; %Rotors 0 and 3 use this gam" + "ma_omega vector\ngamma_omega_12 = [0; 0; 1]; %Rotors 1 and 2 use this gamma_omega vector\n\n% Define angular vel" + "ocities for each rotor\nw_0 = angular_velocity(1);\nw_1 = angular_velocity(2);\nw_2 = angular_velocity(3);\nw_3 " + "= angular_velocity(4);\n\n% Define angular acceleration for each rotor\nw_0_dot = angular_acceleration(1);\nw_1_" + "dot = angular_acceleration(2);\nw_2_dot = angular_acceleration(3);\nw_3_dot = angular_acceleration(4);\n\n% Defi" + "ne the rotor force in the z-direction from each rotor\nB_Fr_0 = Kt * w_0 * w_0 * gamma_Ti;\nB_Fr_1 = Kt * w_1 * " + "w_1 * gamma_Ti;\nB_Fr_2 = Kt * w_2 * w_2 * gamma_Ti;\nB_Fr_3 = Kt * w_3 * w_3 * gamma_Ti;\n\n% Sum up the rotor " + "forces in the z-direction from each vector to get the\n% total body force in the z-direction\nB_Fr = B_Fr_0 + B_" + "Fr_1 + B_Fr_2 + B_Fr_3;\n\n% Define the in-plane drag and induced torque produced by each rotor\n B_Q_d0 = -1 * " + "Kd * w_0 * w_0 * gamma_omega_03;\n B_Q_d1 = -1 * Kd * w_1 * w_1 * gamma_omega_12;\n B_Q_d2 = -1 * Kd * w_2 * w_2" + " * gamma_omega_12;\n B_Q_d3 = -1 * Kd * w_3 * w_3 * gamma_omega_03;\n\n% Sum up the total in-plane drag and indu" + "ced torque to get the total\n% in-plane drag and induced torque on the body\nB_Q_d = B_Q_d0 + B_Q_d1 + B_Q_d2 + " + "B_Q_d3;\n\n% Define the force lever arm torque created from the force produced by each\n% rotor in the z-directi" + "on\nB_Q_F0 = cross( rh_0, B_Fr_0 );\nB_Q_F1 = cross( rh_1, B_Fr_1 );\nB_Q_F2 = cross( rh_2, B_Fr_2 );\nB_Q_F3 = " + "cross( rh_3, B_Fr_3 );\n\nB_Q_F = B_Q_F0 + B_Q_F1 + B_Q_F2 + B_Q_F3;\n\n%Define the change in angular momentum t" + "orque produced by each rotor \nB_Q_L0 = -1 * Jreq * ( cross(B_omega, w_0 * gamma_omega_03) + w_0_dot * gamma_ome" + "ga_03 );\nB_Q_L1 = -1 * Jreq * ( cross(B_omega, w_1 * gamma_omega_12) + w_1_dot * gamma_omega_12 ); \nB_Q_L2 = -" + "1 * Jreq * ( cross(B_omega, w_2 * gamma_omega_12) + w_2_dot * gamma_omega_12 ); \nB_Q_L3 = -1 * Jreq * ( cross(B" + "_omega, w_3 * gamma_omega_03) + w_3_dot * gamma_omega_03 );\n\n% Sum up the total change in angular momentum tor" + "que produced by each rotor\nB_Q_L = B_Q_L0 + B_Q_L1 + B_Q_L2 + B_Q_L3;\n\n% Define the total rotor system torque" + " as the sum of the in-plane drag and\n% induced torque, force lever arm torque, and change in angular momentum\n" + "% torques\nB_Q = B_Q_d + B_Q_F + B_Q_L;\n\n% Define the body forces in the z-direction from each vector to get t" + "he\n% total body force in the z-direction\nB_F = B_Fr + B_Fg; \n\n% Define the body frame linear velocities\nB_v" + "o_dot = (m*I)^(-1) * ( B_F - cross( B_omega, m*(B_vo + cross(B_omega, br_oc)) ) );\n\n% Define the body frame an" + "gular velocities\nB_omega_dot = J ^(-1) * ( B_Q - cross(B_omega, J * B_omega) - cross(br_oc, B_F) );\n\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 54 + ssIdNumber 6 + name "B_omega_dot" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [52 0 55] + } + data { + id 55 + ssIdNumber 10 + name "angular_acceleration" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 54 56] + } + data { + id 56 + ssIdNumber 11 + name "angular_velocity" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 55 57] + } + data { + id 57 + ssIdNumber 30 + name "B_Fg" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 56 58] + } + data { + id 58 + ssIdNumber 8 + name "B_omega" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 57 59] + } + data { + id 59 + ssIdNumber 5 + name "B_vo_dot" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [52 58 60] + } + data { + id 60 + ssIdNumber 7 + name "B_vo" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 59 61] + } + data { + id 61 + ssIdNumber 12 + name "m" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 6 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 60 62] + } + data { + id 62 + ssIdNumber 14 + name "Kt" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 5 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 61 63] + } + data { + id 63 + ssIdNumber 13 + name "Kd" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 4 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 62 64] + } + data { + id 64 + ssIdNumber 15 + name "rhx" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 7 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 63 65] + } + data { + id 65 + ssIdNumber 16 + name "rhy" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 8 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 64 66] + } + data { + id 66 + ssIdNumber 17 + name "rhz" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 9 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 65 67] + } + data { + id 67 + ssIdNumber 18 + name "Jreq" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 66 68] + } + data { + id 68 + ssIdNumber 19 + name "Jxx" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 1 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 67 69] + } + data { + id 69 + ssIdNumber 20 + name "Jyy" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 2 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 68 70] + } + data { + id 70 + ssIdNumber 21 + name "Jzz" + scope PARAMETER_DATA + paramIndexForInitFromWorkspace 3 + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [52 69 0] + } + junction { + id 71 + position [23.5747 49.5747 7] + chart 52 + subviewer 52 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [52 0 0] + } + transition { + id 72 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 71 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 52 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 52 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [52 0 0] + } + instance { + id 73 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n" + chart 52 + } + chart { + id 74 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 75 0 0] + viewObj 74 + ssIdHighWaterMark 6 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 7 + disableImplicitCasting 1 + eml { + name "angular_body_earth_conversion" + } + firstData 76 + firstTransition 80 + firstJunction 79 + } + state { + id 75 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 74 + treeNode [74 0 0 0] + superState SUBCHART + subviewer 74 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function euler_rates = angular_body_earth_conversion(B_omega, euler_angles)\n\neuler_rates = zero" + "s(3,1);\n\nphi = euler_angles(1);\ntheta = euler_angles(2);\n\nAeb = [1, sin(phi)*tan(theta), cos(phi)*tan(theta" + "); ...\n 0, cos(phi) , -sin(phi) ; ...\n 0, sin(phi)/cos(theta), cos(phi)/cos(th" + "eta)];\n\n \neuler_rates = Aeb * B_omega;\n " + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 76 + ssIdNumber 4 + name "B_omega" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [74 0 77] + } + data { + id 77 + ssIdNumber 5 + name "euler_rates" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [74 76 78] + } + data { + id 78 + ssIdNumber 6 + name "euler_angles" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [74 77 0] + } + junction { + id 79 + position [23.5747 49.5747 7] + chart 74 + subviewer 74 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [74 0 0] + } + transition { + id 80 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 79 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 74 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 74 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [74 0 0] + } + instance { + id 81 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + chart 74 + } + chart { + id 82 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 83 0 0] + viewObj 82 + ssIdHighWaterMark 13 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 8 + disableImplicitCasting 1 + eml { + name "linear_earth_body_conversion" + } + firstData 84 + firstTransition 90 + firstJunction 89 + } + state { + id 83 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 82 + treeNode [82 0 0 0] + superState SUBCHART + subviewer 82 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function [B_Fg, B_g] = linear_earth_body_conversion(E_Fg, euler_angles, m)\n\nphi = euler_angles" + "(1);\ntheta = euler_angles(2);\npsi = euler_angles(3);\n\nLbe = [ cos(theta)*cos(psi) ," + " cos(theta)*sin(psi) , -sin(theta) ; ...\n sin(phi)*sin(theta)*cos(psi)-c" + "os(phi)*sin(psi), sin(phi)*sin(theta)*sin(psi)+cos(phi)*cos(psi), sin(phi)*cos(theta); ...\n cos(phi)*sin(" + "theta)*cos(psi)+sin(phi)*sin(psi), cos(phi)*sin(theta)*sin(psi)-sin(phi)*cos(psi), cos(phi)*cos(theta)];\n\nB_Fg" + " = Lbe * E_Fg;\n\nB_g = B_Fg/m;" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 84 + ssIdNumber 7 + name "E_Fg" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [82 0 85] + } + data { + id 85 + ssIdNumber 11 + name "euler_angles" + scope INPUT_DATA + machine 1 + props { + array { + size "3" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [82 84 86] + } + data { + id 86 + ssIdNumber 9 + name "B_Fg" + scope OUTPUT_DATA + machine 1 + props { + array { + size "3" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [82 85 87] + } + data { + id 87 + ssIdNumber 12 + name "B_g" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [82 86 88] + } + data { + id 88 + ssIdNumber 13 + name "m" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [82 87 0] + } + junction { + id 89 + position [23.5747 49.5747 7] + chart 82 + subviewer 82 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [82 0 0] + } + transition { + id 90 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 89 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 82 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 82 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [82 0 0] + } + instance { + id 91 + machine 1 + name "\n\n\n\n\n\n/\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + chart 82 + } + chart { + id 92 + machine 1 + name " /\n\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 93 0 0] + viewObj 92 + ssIdHighWaterMark 14 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 9 + disableImplicitCasting 1 + eml { + name "complimentaryFilter" + } + firstData 94 + firstTransition 100 + firstJunction 99 + } + state { + id 93 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 92 + treeNode [92 0 0 0] + superState SUBCHART + subviewer 92 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function euler_angles_IMU = complimentaryFilter(accel_pitch, accel_roll, euler_angles_gyro, prev" + "_euler_angles_IMU)\n\nLOOP_TIME = 6.1*10^-3;\n\nprev_phi = prev_euler_angles_IMU(1);\nprev_theta = prev_euler_an" + "gles_IMU(2);\n\nphi_dot_gyro = euler_angles_gyro(1);\ntheta_dot_gyro = euler_angles_gyro(2);\n\nphi = 0.98 * (pr" + "ev_phi + phi_dot_gyro * LOOP_TIME ) + 0.02 * accel_roll;\ntheta = 0.98 * (prev_theta + theta_dot_gyro * LOOP_TIM" + "E) + 0.02 * accel_pitch;\n\neuler_angles_IMU = [phi; theta];\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 94 + ssIdNumber 4 + name "accel_pitch" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [92 0 95] + } + data { + id 95 + ssIdNumber 13 + name "accel_roll" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [92 94 96] + } + data { + id 96 + ssIdNumber 5 + name "euler_angles_IMU" + scope OUTPUT_DATA + machine 1 + props { + array { + size "[2,1]" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [92 95 97] + } + data { + id 97 + ssIdNumber 6 + name "euler_angles_gyro" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [92 96 98] + } + data { + id 98 + ssIdNumber 12 + name "prev_euler_angles_IMU" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [92 97 0] + } + junction { + id 99 + position [23.5747 49.5747 7] + chart 92 + subviewer 92 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [92 0 0] + } + transition { + id 100 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 99 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 92 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 92 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [92 0 0] + } + instance { + id 101 + machine 1 + name " /\n\n\n\n\n\n\n\n" + chart 92 + } + chart { + id 102 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n/\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 103 0 0] + viewObj 102 + ssIdHighWaterMark 15 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 10 + disableImplicitCasting 1 + eml { + name "idealIMU" + } + firstData 104 + firstTransition 113 + firstJunction 112 + } + state { + id 103 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 102 + treeNode [102 0 0 0] + superState SUBCHART + subviewer 102 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function [accelReading,gyroReading] = idealIMU(B_vo_dot, B_vo, B_Omega, B_g, r_oc, g)\n%#codegen\n" + "\na = B_vo_dot + cross(B_Omega,B_vo) ; % body frame acceleration \n\naccelReading = (a - B_g)/g ; % acceleromete" + "r reading (ideal)\n\ngyroReading = B_Omega ; % gyroscope reading (ideal) \n\nend\n\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 104 + ssIdNumber 4 + name "B_vo_dot" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 0 105] + } + data { + id 105 + ssIdNumber 9 + name "B_vo" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 104 106] + } + data { + id 106 + ssIdNumber 5 + name "accelReading" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [102 105 107] + } + data { + id 107 + ssIdNumber 6 + name "B_Omega" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 106 108] + } + data { + id 108 + ssIdNumber 7 + name "B_g" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 107 109] + } + data { + id 109 + ssIdNumber 8 + name "gyroReading" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [102 108 110] + } + data { + id 110 + ssIdNumber 10 + name "r_oc" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 109 111] + } + data { + id 111 + ssIdNumber 12 + name "g" + scope PARAMETER_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [102 110 0] + } + junction { + id 112 + position [23.5747 49.5747 7] + chart 102 + subviewer 102 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [102 0 0] + } + transition { + id 113 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 112 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 102 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 102 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [102 0 0] + } + instance { + id 114 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n/\n\n\n\n\n\n\n" + chart 102 + } + chart { + id 115 + machine 1 + name " /3D Graphical Simulation/MATLAB Function" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 116 0 0] + viewObj 115 + ssIdHighWaterMark 5 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 11 + disableImplicitCasting 1 + eml { + name "eigenaxis_ucart" + } + firstData 117 + firstTransition 120 + firstJunction 119 + } + state { + id 116 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 115 + treeNode [115 0 0 0] + superState SUBCHART + subviewer 115 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function y = eigenaxis_ucart(u)\n\n\nif abs(u(1))< 0.0001\n u(1) = 0.0001;\nend\n\nif abs(u(2)" + ")< 0.0001\n u(2) = 0.0001;\nend\n\nif abs(u(3))< 0.0001\n u(3) = 0.0001;\nend\n\nu = [ -u(1); -u(2); u(3) " + "];% [Pitch, Yaw, Roll] \n\nC11 = cos(u(2))*cos(u(3));\nC12 = cos(u(2))*sin(u(3));\nC13 = -sin(u(2));\nC21 = sin(" + "u(1))*sin(u(2))*cos(u(3))-cos(u(1))*sin(u(3));\nC22 = sin(u(1))*sin(u(2))*sin(u(3))+cos(u(1))*cos(u(3));\nC23 = " + "sin(u(1))*cos(u(2));\nC31 = cos(u(1))*sin(u(2))*cos(u(3))+sin(u(1))*sin(u(3));\nC32 = cos(u(1))*sin(u(2))*sin(u(" + "3))-sin(u(1))*cos(u(3));\nC33 = cos(u(1))*cos(u(2));\n \ntheta = acos(0.5*(C11+C22+C33-1));\n\ne = [C23-C32; " + "C31-C13; C12-C21]/(2*sin(theta));\n \ny = [e; theta];\n\n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 117 + ssIdNumber 4 + name "u" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [115 0 118] + } + data { + id 118 + ssIdNumber 5 + name "y" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [115 117 0] + } + junction { + id 119 + position [23.5747 49.5747 7] + chart 115 + subviewer 115 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [115 0 0] + } + transition { + id 120 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 119 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 115 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 115 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [115 0 0] + } + instance { + id 121 + machine 1 + name " /3D Graphical Simulation/MATLAB Function" + chart 115 + } + chart { + id 122 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 123 0 0] + viewObj 122 + ssIdHighWaterMark 6 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 12 + disableImplicitCasting 1 + eml { + name "angular_body_earth_conversion" + } + firstData 124 + firstTransition 128 + firstJunction 127 + } + state { + id 123 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 122 + treeNode [122 0 0 0] + superState SUBCHART + subviewer 122 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function euler_rates_IMU = angular_body_earth_conversion(gyro_reading, euler_angles_IMU)\n\nphi =" + " euler_angles_IMU(1);\ntheta = euler_angles_IMU(2);\n\nAeb = [1, sin(phi)*tan(theta), cos(phi)*tan(theta); ...\n" + " 0, cos(phi) , -sin(phi) ; ...\n 0, sin(phi)/cos(theta), cos(phi)/cos(theta)];\n" + "\n \neuler_rates_IMU = Aeb * gyro_reading;\n " + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 124 + ssIdNumber 4 + name "gyro_reading" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [122 0 125] + } + data { + id 125 + ssIdNumber 5 + name "euler_rates_IMU" + scope OUTPUT_DATA + machine 1 + props { + array { + size "[3,1]" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [122 124 126] + } + data { + id 126 + ssIdNumber 6 + name "euler_angles_IMU" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [122 125 0] + } + junction { + id 127 + position [23.5747 49.5747 7] + chart 122 + subviewer 122 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [122 0 0] + } + transition { + id 128 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 127 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 122 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 122 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [122 0 0] + } + instance { + id 129 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + chart 122 + } + chart { + id 130 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n\n\n1" + windowPosition [422 539.941 189 413] + viewLimits [0 156.75 0 153.75] + screen [1 1 3600 1200 1.180555555555556] + treeNode [0 131 0 0] + viewObj 130 + ssIdHighWaterMark 10 + decomposition CLUSTER_CHART + type EML_CHART + chartFileNumber 13 + disableImplicitCasting 1 + eml { + name "getPitchAndRoll" + } + firstData 132 + firstTransition 137 + firstJunction 136 + } + state { + id 131 + labelString "eML_blk_kernel()" + position [18 64.5 118 66] + fontSize 12 + chart 130 + treeNode [130 0 0 0] + superState SUBCHART + subviewer 130 + ssIdNumber 1 + type FUNC_STATE + decomposition CLUSTER_STATE + eml { + isEML 1 + script "function [accel_pitch, accel_roll] = getPitchAndRoll(accel_reading, accel_roll_prev)\n\nmag = nor" + "m(accel_reading);\n\nx_accel = accel_reading(1)/mag;\ny_accel = accel_reading(2)/mag;\nz_accel = accel_reading(3" + ")/mag;\n\naccel_pitch = atan(x_accel/sqrt(y_accel^2 + z_accel^2));\n%unwrapped_pitch = unwrap([accel_pitch_prev " + "accel_pitch]);\n%accel_pitch = unwrapped_pitch(2);\n\naccel_roll = atan2( -y_accel,(sign(-z_accel)*sqrt(z_accel^" + "2 + (1/100)*x_accel^2)) );\nunwrapped_roll = unwrap([accel_roll_prev accel_roll]);\naccel_roll = unwrapped_roll(" + "2); \n" + editorLayout "100 M4x1[10 5 700 500]" + } + } + data { + id 132 + ssIdNumber 4 + name "accel_reading" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [130 0 133] + } + data { + id 133 + ssIdNumber 5 + name "accel_pitch" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [130 132 134] + } + data { + id 134 + ssIdNumber 6 + name "accel_roll" + scope OUTPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_NO + } + dataType "Inherit: Same as Simulink" + linkNode [130 133 135] + } + data { + id 135 + ssIdNumber 7 + name "accel_roll_prev" + scope INPUT_DATA + machine 1 + props { + array { + size "-1" + } + type { + method SF_INHERITED_TYPE + primitive SF_DOUBLE_TYPE + isSigned 1 + wordLength "16" + } + complexity SF_COMPLEX_INHERITED + frame SF_FRAME_INHERITED + } + dataType "Inherit: Same as Simulink" + linkNode [130 134 0] + } + junction { + id 136 + position [23.5747 49.5747 7] + chart 130 + subviewer 130 + ssIdNumber 3 + type CONNECTIVE_JUNCTION + linkNode [130 0 0] + } + transition { + id 137 + labelString "{eML_blk_kernel();}" + labelPosition [28.125 13.875 102.544 14.964] + fontSize 12 + src { + intersection [0 0 1 0 23.5747 14.625 0 0] + } + dst { + id 136 + intersection [1 0 -1 0 23.5747 42.5747 0 0] + } + midPoint [23.5747 24.9468] + chart 130 + dataLimits [21.175 25.975 14.625 42.575] + subviewer 130 + drawStyle SMART + slide { + sticky BOTH_STICK + } + executionOrder 1 + ssIdNumber 2 + linkNode [130 0 0] + } + instance { + id 138 + machine 1 + name " /\n\n\n\n\n\n\n\n\n\n\n\n1" + chart 130 + } + target { + id 139 + machine 1 + name "sfun" + description "Default Simulink S-Function Target." + linkNode [1 0 0] + } +} diff --git a/controls/model/Quadcopter_Model_R2016_A.slx b/controls/model/Quadcopter_Model_R2016_A.slx index e56ae611672d6f2cf70f76ef4d71b90fd7275d25..7f461495c2c37f501f258aed80ec8233b134740b 100644 Binary files a/controls/model/Quadcopter_Model_R2016_A.slx and b/controls/model/Quadcopter_Model_R2016_A.slx differ diff --git a/controls/model/Quadcopter_Model_R2016_B.slx b/controls/model/Quadcopter_Model_R2016_B.slx index 4812672f099ed6c33607593fffb21a57fe1099b1..4a522c3598e05d090a69937f4321bbae2bff06ee 100644 Binary files a/controls/model/Quadcopter_Model_R2016_B.slx and b/controls/model/Quadcopter_Model_R2016_B.slx differ diff --git a/controls/parameterIdentification/ModelingParameters.docx b/controls/parameterIdentification/ModelingParameters.docx index 0dcc977533f1c133a95ff775eac36f0a635f071b..fcf758acb355225ec99b41114ae2bcb501574ee1 100644 Binary files a/controls/parameterIdentification/ModelingParameters.docx and b/controls/parameterIdentification/ModelingParameters.docx differ diff --git a/groundStation/Makefile b/groundStation/Makefile index 150ff66c078daf3590ce61a865175dd30411c969..b199aef1a4adda78d5c3b95b7355ab6667254efa 100644 --- a/groundStation/Makefile +++ b/groundStation/Makefile @@ -23,7 +23,7 @@ CLIBINARY=Cli CLISRCDIR=src/cli CLISOURCES := $(wildcard $(CLISRCDIR)/*.c) CLIOBJECTS = $(CLISOURCES:$(CLISRCDIR)/%.c=$(OBJDIR)/%.o) -SYMLINKS=monitor setpid +SYMLINKS=monitor setpid getpid # Frontend-common stuff FESRCDIR=src/frontend diff --git a/groundStation/README.md b/groundStation/README.md index a54b1f43611542c3792549e51f1509bc187a5428..9e1936b247276395ca5673d696d071f102d1b8cc 100644 --- a/groundStation/README.md +++ b/groundStation/README.md @@ -40,6 +40,12 @@ running the `monitor` program will effectively run `cli monitor`. The names of the binaries is subject to change. +For more in depth usage explainations, use the --help flag. +'./Cli --help' + +For help with the specific cli command you are running, use the --help flag once again. +'./Cli setpid --help' + ### Example In one terminal or screen, run the backend: diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c index 4cb35a5e7a5d9d8d282ef57cf319fabad4b9291f..f521cf732807359df10b4e607111c360d9f26a0d 100644 --- a/groundStation/src/backend/backend.c +++ b/groundStation/src/backend/backend.c @@ -17,6 +17,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <sys/select.h> +#include <sys/stat.h> #include <bluetooth/bluetooth.h> #include <bluetooth/rfcomm.h> #include <pthread.h> @@ -69,7 +70,7 @@ static int remove_client(int fd); /* Receive data from client */ static void client_recv(int fd); /* Receive data from quad */ -static void quad_recv(const char * buf, size_t len); +static void quad_recv(); /* Checks to see if socket has disconnected. Returns 1 on disconnect, else returns 0 */ static int wasDisconnected(int fd); @@ -103,7 +104,7 @@ fd_set rfds_master; int max_fd = 0; pthread_mutex_t quadResponseMutex, cliInputMutex ; -char *respBuf, *commandBuf; +unsigned char *commandBuf; int newQuadResponse = 0, newCliInput = 0; // Structures to be used throughout @@ -114,6 +115,7 @@ modular_structs_t structs; // in the future. static void cb(struct ucart_vrpn_TrackerData * td) { static int count = 0; + if(!(count % 10)) { sendVrpnPacket(td); //updateLogFile(td); @@ -138,6 +140,7 @@ int main(int argc, char **argv) unlink(backend_socket_path); /* Create socket */ + mode_t old_umask = umask(0111); backendSocket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); if (backendSocket < 0) { err(-1, "socket"); @@ -151,6 +154,7 @@ int main(int argc, char **argv) if (bind(backendSocket, (struct sockaddr *) &sa, sizeof(sa))) { err(-1, "bind"); } + umask(old_umask); /* Listen */ if (listen(backendSocket, 16)) { @@ -177,7 +181,6 @@ int main(int argc, char **argv) if ((zyboSocket = connectToZybo()) < 0) { perror("Error connecting to Quad..."); - free(respBuf); free(commandBuf); exit(1); } @@ -217,8 +220,6 @@ int main(int argc, char **argv) .tv_usec = 0 }; - respBuf = calloc(CMD_MAX_LENGTH, sizeof(unsigned char)); - sleep(3); while(keepRunning) { fd_set rfds; @@ -237,38 +238,8 @@ int main(int argc, char **argv) * Ignore stdin from the backend */ } else if (fd == zyboSocket) { - //printf("recieving from quad\n"); - /** - * Read the response from the control loop - */ - int available; - ioctl(fd, FIONREAD, &available); - if (available < 12) { - //printf("only %d available\n", available); - continue; - } - - //printf("recieving more than 12\n"); - int respLen = readQuad(respBuf, CMD_MAX_LENGTH); - if(respLen <= 0) { - perror("ERROR reading from quad...\n"); - } - /* Temp debug */ - printf("Quad sent: %s\n", respBuf); - - int id = getInt((unsigned char *)respBuf, 7); - findTimeDiff(id); - - //quad_recv(respBuf, respLen); - // if(respLen == 11) { - // int id = getInt((unsigned char *)respBuf, 7); - // findTimeDiff(id); - // printf("respLen = %d : id = %d'\n", respLen, id); - // for(int i = 0; i <= respLen -1; ++i) - // printf("%x ", (unsigned char)respBuf[i]); - // printf("'\n"); - // } - memset(respBuf, 0, respLen); + printf("recieving from quad\n"); + quad_recv(); } else if (fd == backendSocket) { int new_fd = 0; new_fd = accept(backendSocket, NULL, NULL); @@ -354,16 +325,16 @@ void sendVrpnPacket(struct ucart_vrpn_TrackerData *info) { //memcpy(&packet[7], &info, sizeof(struct ucart_vrpn_TrackerData)); memset(&packet[7], 0, 4); - memcpy(&packet[11], &info[4], 4); - memcpy(&packet[15], &info[0], 4); - memcpy(&packet[19], &info[8], 4); - memcpy(&packet[23], &info[16], 4); - memcpy(&packet[27], &info[12], 4); - memcpy(&packet[31], &info[20], 4); + memcpy(&packet[11], &(info->y), 4); + memcpy(&packet[15], &(info->x), 4); + memcpy(&packet[19], &(info->z), 4); + memcpy(&packet[23], &(info->pitch), 4); + memcpy(&packet[27], &(info->roll), 4); + memcpy(&packet[31], &(info->yaw), 4); char checksum = 0; int i; - for(i=0; i < pSize - 1; i++) + for(i=0; i < pSize - 1; i++) checksum ^= packet[i]; packet[pSize - 1] = checksum; //PACKET_END_BYTE; @@ -501,7 +472,6 @@ static ssize_t writeQuad(const char * buf, size_t count) { if (pthread_mutex_lock(&quadSocketMutex)) { err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__); } - //setsockopt(zyboSocket, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int)); retval = write(zyboSocket, buf, count); if (pthread_mutex_unlock(&quadSocketMutex)) { err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__); @@ -516,9 +486,6 @@ static ssize_t readQuad(char * buf, size_t count) { err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__); } retval = read(zyboSocket, buf, count); - //int result = setsockopt(zyboSocket, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int)); - //printf("result = %d\n", result); - if (pthread_mutex_unlock(&quadSocketMutex)) { err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__); } @@ -704,41 +671,78 @@ static void client_recv(int fd) { } } -static void quad_recv(const char * buf, size_t len) { +static void quad_recv() { /* Check to see which command we are receiving. If it is one that needs to be passed on onto the clients, do so. */ - char packet[len]; int validPacket; unsigned char *data; metadata_t metadata; + static unsigned char respBuf[2048]; + static size_t respBufLen; + + /** + * Read the response from the control loop + */ + int respLen = readQuad((char *) respBuf + respBufLen, + CMD_MAX_LENGTH); + if(respLen <= 0) { + perror("ERROR reading from quad...\n"); + return; + } + respBufLen += respLen; + + if (respBufLen < 8) { + /* not long enough yet */ + printf("too short!!\n"); + return; + } - memcpy(packet, buf, len); - // Validate the message is correctly formatted - validPacket = parse_packet((unsigned char *) packet, &data, &metadata); - if(validPacket != 0) { - warnx("Could not recognize packet from quad.\n"); + validPacket = parse_packet((unsigned char *) respBuf, &data, &metadata); + if (validPacket == -1) { + warnx("Doesn't have start byte."); + /* nuke packet */ + respBufLen = 0; return; } - int datalen = (packet[6] << 8) | (packet[5]); - char * cmdText = MessageTypes[(int)metadata.msg_type].subtypes[(int)metadata.msg_subtype].cmdText; - float value = getFloat((unsigned char *)packet, 7); - printf("Quad : %s, %lf\n", cmdText, value); - /* - Assuming the quad sends the correct info.. This hasn't been tested yet due to a lack of - quad software. We can check how to format by the cmdText and pass to every client. - */ - char buffer[1048]; - sprintf(buffer, "%s %lf\n", cmdText, value); - - for(int fd = 0; fd <= max_fd; ++fd) { - if (get_client_index(fd) > -1) { - write(fd, buffer, datalen + 8); + /* Get datalen */ + size_t datalen = metadata.data_len; + if (datalen > CMD_MAX_LENGTH - 8) { + /* Very invalid packet. Nuke that shit */ + respBufLen = 0; + return; + } + + if (respBufLen < datalen + 8) { + /* Packet not yet fully read */ + return; + } + + if (validPacket == 0) { + /* At least enough data read to check checksum, and it was good!*/ + char * cmdText = MessageTypes[(int)metadata.msg_type].subtypes[(int)metadata.msg_subtype].cmdText; + float value = getFloat((unsigned char *)respBuf, 7); + //printf("Quad : %s, %lf\n", cmdText, value); + /* + Assuming the quad sends the correct info.. This hasn't been tested yet due to a lack of + quad software. We can check how to format by the cmdText and pass to every client. + */ + char buffer[1048]; + sprintf(buffer, "%s %lf\n", cmdText, value); + + for(int fd = 0; fd <= max_fd; ++fd) { + if (get_client_index(fd) > -1) { + write(fd, buffer, datalen + 8); + } } + } else { + warnx("Checksum mismatch!"); } + memmove(respBuf, respBuf + datalen + 8, respBufLen - (datalen + 8)); + respBufLen -= datalen + 8; } static int wasDisconnected(int fd) { diff --git a/groundStation/src/backend/communication.c b/groundStation/src/backend/communication.c index 2dacd03f90afb8ed35b99a56f34ca785225e3350..19ea73ae4cf7c8f7f8a35bf8b316bf28e19e7903 100644 --- a/groundStation/src/backend/communication.c +++ b/groundStation/src/backend/communication.c @@ -236,8 +236,10 @@ int parse_packet(unsigned char * packet, unsigned char ** data, metadata_t * met } // compare checksum - if(packet_checksum != calculated_checksum) + if(packet_checksum != calculated_checksum) { fprintf(stderr, "Checksums did not match (Parse Packet): 0x%02x\t0x%02x\n", packet_checksum, calculated_checksum); + return -2; + } return 0; } diff --git a/groundStation/src/cli/cli.c b/groundStation/src/cli/cli.c index 958b33ee649700a3b1b9a0b9d119db0d55e67de0..acec4dbc6352ca971b84289eb24cfc918da98bbd 100644 --- a/groundStation/src/cli/cli.c +++ b/groundStation/src/cli/cli.c @@ -28,21 +28,21 @@ int main(int argc, char **argv) // Verify the user has entered enough information to continue if (argc < 2 && !useSymlink) { printf("Incorrect usage :\n"); - printf("\n\tUsage : ./Cli command [options] \n"); - printf("\tFor a list of available commands run ./Cli --help\n\n"); - printf("\tFor a list of available options for a command run ./Cli command --help\n"); + printf("Usage Syntax: \n\t./Cli command [options...]\n\n"); + printf("For a list of available 'command' names\n\t./Cli --help\n\n"); + printf("For a list of available options for a 'command'\n\t./Cli command --help\n"); return -1; } - // Determine if the user called for help on the cli - needCliHelp = (strncmp("--help", argv[1], strlen(argv[1])) == 0); - + if (!useSymlink) { + // Determine if the user called for help on the cli + needCliHelp = (strncmp("--help", argv[1], strlen(argv[1])) == 0); + } // If the user runs './Cli help' , provide the user with a list of commands available. if (needCliHelp) { - printf("Usage : ./Cli command [options]\n"); - printf("For a list of available options for a command run ./Cli command --help\n\n"); - printf("Available commands include the following\n"); + printf("Usage Syntax: \n\t./Cli command [options...]\n\n"); + printf("Available 'command' names include the following\n"); for(int i = 0; i < MAX_COMMANDS; ++i) { printf("\t '%s'\n",commandNames[i]); } @@ -66,8 +66,6 @@ int main(int argc, char **argv) return -1; } - printf("Parsed Command : %s\n", commandNames[cmdID]); - // Determine if the user called for help on the command if (!useSymlink && argc > 2) { if (strncmp("--help", argv[2], strlen(argv[2])) == 0) { diff --git a/groundStation/src/cli/cli_getpid.c b/groundStation/src/cli/cli_getpid.c index bb887ca24242fb05f4a22710becf248cdb6f8f62..c57d42a52227bbb39d2fbceb40c182ab58a723ec 100644 --- a/groundStation/src/cli/cli_getpid.c +++ b/groundStation/src/cli/cli_getpid.c @@ -9,6 +9,7 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) { static int getRoll = 0, getPitch = 0, getYaw = 0, getAll = 0; static int getRollV = 0, getPitchV = 0, getYawV = 0; static int getHeight = 0, getLat = 0, getLong = 0; + static int needHelp = 0; struct frontend_pid_data pid_data; static struct option long_options[] = { /* These options don’t set a flag. We distinguish them by their indices. */ @@ -21,6 +22,7 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) { {"height", no_argument, &getHeight, 1}, {"lat", no_argument, &getLat, 1}, {"long", no_argument, &getLong, 1}, + {"help", no_argument, &needHelp, 1}, {0, 0, 0, 0} }; @@ -40,6 +42,26 @@ int cli_getpid(struct backend_conn * conn, int argc, char **argv) { } } + if (needHelp) { + printf("Getpid gets the p, i , or d constant values of any single controller\n"); + printf("Usage Syntax : \n\t./Cli getpid controller [options...]\n"); + printf("Symlink Usage Syntax : \n\t./getpid controller [options...]\n\n"); + printf("Available 'controllers' include the following\n"); + printf("\t[--pitch] : Pitch\n\t[--roll] : Roll\n\t[--yaw] : Yaw\n"); + printf("\t[--pitchv] : Pitch Velocity\n\t[--rollv] : Roll Velocity\n\t[--yawv] : Yaw Velocity\n"); + printf("\t[--height] : Z\n\t[--lat] : X\n\t[--long] : Y\n\n"); + printf("Available 'controller' options include the following\n"); + printf("\t[-p] 'val' : Gets the p constant of the 'controller\n"); + printf("\t[-i] 'val' : Gets the i constant of the 'controller'\n"); + printf("\t[-d] 'val' : Gets the d constant of the 'controller'\n"); + return 0; + } + + if (argc < 2) { + printf("Incorrect Usage, run './cli getpid --help' for correct usage.\n"); + return 1; + } + int result; if(getAll) { pid_data.controller = PID_ROLL; diff --git a/groundStation/src/cli/cli_monitor.c b/groundStation/src/cli/cli_monitor.c index 5964cb78ace27953b0b9d2a80de6038f210c5718..2703b62ee49144794c0b80f1671df727eb0281c0 100644 --- a/groundStation/src/cli/cli_monitor.c +++ b/groundStation/src/cli/cli_monitor.c @@ -13,8 +13,6 @@ int cli_monitor(struct backend_conn * conn, int argc, char **argv) { int c, result; int countFlag = 0; - /* getopt_long stores the option index here. */ - int option_index = 0; int count, rate = 10; int forever = 0; static int needHelp = 0; @@ -27,6 +25,9 @@ int cli_monitor(struct backend_conn * conn, int argc, char **argv) { while (1) { + /* getopt_long stores the option index here. */ + int option_index = 0; + // If you change this VVV please also update the help message c = getopt_long(argc, argv, "fc:r:", long_options, &option_index); @@ -48,9 +49,15 @@ int cli_monitor(struct backend_conn * conn, int argc, char **argv) { break; } } - + if (needHelp) { - printf("helping you\n"); + printf("Monitor provides real time information about the quad. Including positional data as well as controller constants\n\n"); + printf("Usage Syntax : \n\t./Cli monitor [options...]\n"); + printf("Symlink Usage Syntax : \n\t./monitor [options...]\n\n"); + printf("Available options include the following\n"); + printf("\t[-f] : Run monitor continuously until you kill the program. (ctrl-C)\n"); + printf("\t[-c] 'count' : Sets the number of times the monitor will refresh\n"); + printf("\t[-r] 'rate' : Sets the 'rate' at which the monitor will refresh per second\n"); return 0; } diff --git a/groundStation/src/cli/cli_setpid.c b/groundStation/src/cli/cli_setpid.c index 2fdc16fdb43e6e42ea5eea16153d98eeb5978302..f9c54c063e043a59b490855912d4d5fbb5d35c73 100644 --- a/groundStation/src/cli/cli_setpid.c +++ b/groundStation/src/cli/cli_setpid.c @@ -13,6 +13,7 @@ int cli_setpid(struct backend_conn * conn, int argc, char **argv) { struct frontend_pid_data pid_data; static int mask; static float pval = 0, ival = 0, dval = 0; + static int needHelp = 0; static struct option long_options[] = { /* These options don’t set a flag. We distinguish them by their indices. */ {"roll", no_argument, &setRoll, 1}, @@ -24,6 +25,7 @@ int cli_setpid(struct backend_conn * conn, int argc, char **argv) { {"height", no_argument, &setHeight, 1}, {"lat", no_argument, &setLat, 1}, {"long", no_argument, &setLong, 1}, + {"help", no_argument, &needHelp, 1}, {0, 0, 0, 0} }; @@ -56,7 +58,27 @@ int cli_setpid(struct backend_conn * conn, int argc, char **argv) { } } - if(setRoll) { + if (needHelp) { + printf("Setpid sets the p, i , or d constant values of any single controller\n"); + printf("Usage Syntax : \n\t./Cli setpid controller [options...]\n"); + printf("Symlink Usage Syntax : \n\t./setpid controller [options...]\n\n"); + printf("Available 'controllers' include the following\n"); + printf("\t[--pitch] : Pitch\n\t[--roll] : Roll\n\t[--yaw] : Yaw\n"); + printf("\t[--pitchv] : Pitch Velocity\n\t[--rollv] : Roll Velocity\n\t[--yawv] : Yaw Velocity\n"); + printf("\t[--height] : Z\n\t[--lat] : X\n\t[--long] : Y\n\n"); + printf("Available 'controller' options include the following\n"); + printf("\t[-p] 'val' : Sets the p constant of the 'controller' to 'val'\n"); + printf("\t[-i] 'val' : Sets the i constant of the 'controller' to 'val'\n"); + printf("\t[-d] 'val' : Sets the d constant of the 'controller' to 'val'\n"); + return 0; + } + + if (argc < 2) { + printf("Incorrect Usage, run './cli setpid --help' for correct usage.\n"); + return 1; + } + + if (setRoll) { pid_data.controller = PID_ROLL; } else if (setYaw) { pid_data.controller = PID_YAW; diff --git a/website/content/height_stabilization.md b/website/content/height_stabilization.md new file mode 100644 index 0000000000000000000000000000000000000000..dc28ec032ab293bcd7577f5bd2f72b27f1d88da3 --- /dev/null +++ b/website/content/height_stabilization.md @@ -0,0 +1,13 @@ +Title: Height Stabilization (movie) +Date: 2016-12-04 +Authors: Brendan +Category: Highlights +image: + +The following test flight demonstrates altitude stabilization. Once the pilot puts the quadcopter into autonomous mode, the quadcopter uses its internal control algorithm to maintain its altitude. The pilot still must provide x and y-axis stabilization through the remote control. + +<figure> +<video controls> +<source src="/videos/height_stabilization.mp4"> +</video> +</figure> diff --git a/website/content/videos/height_stabilization.mp4 b/website/content/videos/height_stabilization.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..dc9016fa28c9921f5ffd8ff873093b7052c1a61a Binary files /dev/null and b/website/content/videos/height_stabilization.mp4 differ diff --git a/website/pelicanconf.py b/website/pelicanconf.py index 367a5554cd4c7dcb60396583f2f55003d01d1da2..c981948e70b5af66d8902d2232e6f2e02673dfdd 100644 --- a/website/pelicanconf.py +++ b/website/pelicanconf.py @@ -40,7 +40,7 @@ DEFAULT_PAGINATION = False THEME = 'themes/notmyidea' # Static Content -STATIC_PATHS = ['images', 'files'] +STATIC_PATHS = ['images', 'files', 'videos'] # Page Order PAGE_ORDER_BY = 'sortorder' diff --git a/website/themes/notmyidea/static/css/main.css b/website/themes/notmyidea/static/css/main.css index 3e39c1259cdba1310dd5d3120396f0e01e1abaa6..08af1d6658ca25465a5918c1547fe3b5341d0b84 100644 --- a/website/themes/notmyidea/static/css/main.css +++ b/website/themes/notmyidea/static/css/main.css @@ -383,7 +383,7 @@ img.left, figure.left {float: left; margin: 0 2em 2em 0;} } li:last-child .hentry, #content > .hentry {border: 0; margin: 0;} #content > .hentry {padding: 1em 0;} -.hentry img{ display: none; } +.hentry img, .hentry video{ display: none; } .entry-title {font-size: 3em; /*! margin-bottom: 10px; */ /*! margin-top: 0; */} .entry-title a:link, .entry-title a:visited {text-decoration: none; color: #333;} .entry-title a:visited {background-color: #fff;} @@ -495,6 +495,10 @@ figure { margin: 1em; } +video { + width: 100%; +} + @media screen and (max-width:500px) { #banner nav li { diff --git a/wifi_bridge/SerialEchoConsole/.gitignore b/wifi_bridge/SerialEchoConsole/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..79db921b2212a94427cd0dfa379c4732539019e6 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/.gitignore @@ -0,0 +1,275 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates +*.vcxproj.filters + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/ diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole.sln b/wifi_bridge/SerialEchoConsole/SerialEchoConsole.sln new file mode 100644 index 0000000000000000000000000000000000000000..dbf812ac273e8d8cc639c1714cdaef2a10bc3b44 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SerialEchoConsole", "SerialEchoConsole\SerialEchoConsole.vcxproj", "{C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Debug|x64.ActiveCfg = Debug|x64 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Debug|x64.Build.0 = Debug|x64 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Debug|x86.ActiveCfg = Debug|Win32 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Debug|x86.Build.0 = Debug|Win32 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Release|x64.ActiveCfg = Release|x64 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Release|x64.Build.0 = Release|x64 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Release|x86.ActiveCfg = Release|Win32 + {C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.cpp b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5b16a1c01534c79ac6cbd67b8f334d9708dda1cb --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.cpp @@ -0,0 +1,191 @@ +#include "stdafx.h" +#include "Packet.hpp" + +#include <algorithm> +#include <iostream> +#include <sstream> +#include <chrono> + +using namespace std; + +Packet::Packet() { + isValid = false; +} + +Packet::Packet(uint8_t _type, uint8_t _subtype, uint16_t _id, + const vector<unsigned char>& _payload) + : type{ _type } + , subtype{ _subtype } + , id{ _id } + , payload{ _payload } + , isValid{ true } { + + checksum = 0xBE; + + checksum ^= type; + checksum ^= subtype; + checksum ^= (id >> 8); + checksum ^= (id & 0xFF); + checksum ^= (payload.size() >> 8) & 0xFF; + checksum ^= (payload.size() & 0xFF); + + for (auto& byte : payload) { + checksum ^= byte; + } +} + +Packet::operator bool() const { + return isValid; +} + + +string Packet::toString() const { + stringstream ss; + ss << "[ID]\t" + to_string(id) + + "\n[Type]\t" + to_string(type) + + "\n[Subtype]\t" + to_string(subtype) + + "\n[Length]\t" + to_string(payload.size()) + + "\n[Payload]\t{ "; + + + for (auto& byte : payload) { + ss << std::hex << (int)byte << " "; + } + + ss << "}"; + + return ss.str(); +} + +vector<unsigned char> Packet::toVector() const { + vector<unsigned char> buf({ 0xBE, type, subtype, static_cast<uint8_t>(id & 0xFF), static_cast<uint8_t>(id >> 8) }); + + buf.insert(buf.end(), payload.begin(), payload.end()); + buf.push_back(checksum); + + return buf; +} + +vector<Packet> parsePacket(const vector<unsigned char>& bytes) { + static vector<unsigned char> savedBytes; + static uint16_t id = 0; + static bool first = true; + static chrono::high_resolution_clock::time_point lastTime; + + if (bytes.size() == 0) + return vector<Packet>(); + + /* + auto now = chrono::high_resolution_clock::now(); + + if (first) { + first = false; + } + else { + auto durationMs = chrono::duration_cast<chrono::microseconds>(now - lastTime); + double us = chrono::duration<double, micro>(durationMs).count(); + + double baudrate = 10000000. * bytes.size() / us; + + if (baudrate > (640. / 0.005)) { + cout << us << endl; + cout << "[Warning] High baud rate: " << baudrate << endl; + } + } + + lastTime = now; + */ + + if (bytes.size() > 64) + cout << '|'; + + vector<Packet> foundPackets; + + savedBytes.insert(savedBytes.end(), bytes.begin(), bytes.end()); + + Packet p; + while ((p = findPacket(savedBytes))) { + foundPackets.push_back(p); + + if (p.id != id) { + cout << "[Warning] Unexpected packet ID (received " << p.id << ", expected " << id << "):\n" << p.toString() << endl; + } + + id = p.id + 1; + } + + return foundPackets; +} + +Packet findPacket(vector<unsigned char>& bytes) { + static bool largePacket = false; + Packet found; + static chrono::high_resolution_clock::time_point lastTime = chrono::high_resolution_clock::now(); + static double timeFilter = 50.; + + if (bytes.size() == 0) + return found; + + //Find start byte + unsigned int i; + for (i = 0; i < bytes.size() && bytes[i] != 0xBE; ++i); + + if (i == bytes.size()) { + //No start byte + cout << "Removing junk data (" << i << " bytes)" << endl; + + bytes.clear(); + return found; + } + + //Remove junk data + if (i != 0) { + std::cout << "Removing junk data (" << i << " bytes)" << std::endl; + bytes.erase(bytes.begin(), bytes.begin() + i); + } + + if (bytes.size() >= 7) { + uint16_t length = bytes[5] | (bytes[6] << 8); + + if (length > 100 && !largePacket) { + largePacket = true; + + cout << "[Warning] Receiving large packet (size " << length << ")" << endl; + } + + if (bytes.size() >= (8 + length)) { + //We have a full packet! + vector<unsigned char> payload(bytes.begin() + 7, bytes.begin() + 7 + length); + + found = Packet(bytes[1], bytes[2], bytes[3] | (bytes[4] << 8), payload); + + if (found.checksum != bytes[7 + length]) { + cout << "[Error] Invalid checksum:\n" << found.toString(); + found.isValid = false; + } + + //Remove the packet data + bytes.erase(bytes.begin(), bytes.begin() + 8 + length); + + //Clear the large packet flag + largePacket = false; + + auto now = chrono::high_resolution_clock::now(); + + auto ms = chrono::duration_cast<chrono::milliseconds>(now - lastTime); + double duration = chrono::duration<double, milli>(ms).count(); + + double baud = 10000. * (8 + length) / duration; + + if (duration > (2 * timeFilter)) { + cout << "[Warning] Jitter: Average duration " << (int)timeFilter << "ms, this one " << (int)duration << "ms" << endl; + } + + timeFilter = timeFilter*0.5 + duration*0.5; + + lastTime = now; + } + } + + return found; +} \ No newline at end of file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.hpp b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e20be54435447db332fd15348aa34fcd43e52ddc --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/Packet.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include <vector> +#include <string> +#include <stdint.h> + +struct Packet +{ + Packet(); + Packet(uint8_t type, uint8_t subtype, uint16_t id, + const std::vector<unsigned char>& payload); + + operator bool() const; + + std::string toString() const; + + std::vector<unsigned char> toVector() const; + + uint8_t type, subtype; + uint16_t id; + //uint16_t length; + std::vector<unsigned char> payload; + uint8_t checksum; + bool isValid; +}; + +std::vector<Packet> parsePacket(const std::vector<unsigned char>&); + +Packet findPacket(std::vector<unsigned char>&); \ No newline at end of file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/ReadMe.txt b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/ReadMe.txt new file mode 100644 index 0000000000000000000000000000000000000000..2a242cc3739a53f906a5f6d33c56f4a54e5cc51c --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : SerialEchoConsole Project Overview +======================================================================== + +AppWizard has created this SerialEchoConsole application for you. + +This file contains a summary of what you will find in each of the files that +make up your SerialEchoConsole application. + + +SerialEchoConsole.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +SerialEchoConsole.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +SerialEchoConsole.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named SerialEchoConsole.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.cpp b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b67d3d3286cb76ec46beb8abfb6fd264ac6666e2 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.cpp @@ -0,0 +1,130 @@ +#include "stdafx.h" +#include "SerialPort.h" +#include "Packet.hpp" +#include <conio.h> +#include <thread> + +#include <iostream> +#include <iomanip> +#include <string> +#include <chrono> + +#define SEND_SIZE 512 +#define DELAY 10 + + +void printHex(std::vector<unsigned char> data) { + for (int i = 0; i < SEND_SIZE; i++) { + std::cout << std::setw(2) << std::hex << (int)data[i] << ":"; + } +} + + +int n_matches = 0; + +int main(int argc, char* argv[]) { + if (argc != 3) { + std::cout << "[Error] Usage: " << argv[0] + << " [Comm Port] [baud]" << std::endl; + return -1; + } + + /* + std::vector<unsigned char> testData({ 0x00, 0xBE, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xFF, 0xFF }); + + while (true) { + for (auto& byte : testData) { + auto packets = parsePacket({ byte }); + for (auto& packet : packets) { + //std::cout << "[Info] Found packet with type " << (int)packet.type + //<< " and length " << (int)packet.payload.size() << std::endl; + std::cout << "Found packet:\n" << packet.toString() << "\n" << std::endl; + } + } + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + */ + + int port = std::stoi(std::string(argv[1])), + baud = std::stoi(std::string(argv[2])); + + //Create SerialPort object + SerialPort serial(port, baud); + + //Connect to serial device + try { + serial.Connect(); + } + catch (const std::exception& e) { + std::cout << "[Error] trying to connect: " << e.what() << std::endl; + + return -1; + } + + while (serial.IsConnected()) { + auto packets = parsePacket(serial.Read()); + + for (auto& packet : packets) { + std::cout << '.'; + //std::cout << "Found packet:\n" << packet.toString() << "\n" << std::endl; + } + } + + + /* + std::vector<unsigned char> send_data; + for (int i = 0; i < SEND_SIZE; i++) { + send_data.push_back(i % 256); + } + + std::vector<unsigned char> recvd_data; + + std::chrono::milliseconds last_sent = std::chrono::milliseconds(0); + while (serial.IsConnected()) { + std::chrono::milliseconds now_time = std::chrono::duration_cast< std::chrono::milliseconds >( + std::chrono::system_clock::now().time_since_epoch()); + if ((now_time - last_sent) > std::chrono::milliseconds(DELAY)) { + serial.Send(send_data); + last_sent = now_time; + } + + auto read = serial.Read(); + recvd_data.insert(recvd_data.end(), read.begin(), read.end()); + + if (recvd_data.size() >= SEND_SIZE) { + bool matches = true; + for (int i = 0; i < SEND_SIZE; i++) { + if (recvd_data[i] != send_data[i]) { + matches = false; + } + } + if (!matches) { + std::cout << "Mismatch on receive" << std::endl; + std::cout << "Successfully matched " << n_matches << std::endl; + + std::cout << "Expected "; + printHex(send_data); + std::cout << std::endl; + std::cout << "Received "; + printHex(recvd_data); + std::cout << std::endl; + } + else { + std::cout << "Matches" << std::endl; + n_matches++; + } + recvd_data = { recvd_data.begin() + SEND_SIZE, recvd_data.end() }; + } + + if (kbhit()) { + exit(0); + //unsigned char c = (unsigned char)getch(); + //serial.Send({ c }); + //std::cout << "Sent " << c << std::endl; + } + } + + */ + return 0; +} + diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.vcxproj b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..bf0e089fcb2f834689fd4e0cdf95b2ba76dd871b --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialEchoConsole.vcxproj @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{C2ACDB47-A077-43EB-AA59-DD7E33DEAEE2}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>SerialEchoConsole</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>NotSet</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>NotSet</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="Packet.hpp" /> + <ClInclude Include="SerialPort.h" /> + <ClInclude Include="stdafx.h" /> + <ClInclude Include="targetver.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="Packet.cpp" /> + <ClCompile Include="SerialEchoConsole.cpp" /> + <ClCompile Include="SerialPort.cpp" /> + <ClCompile Include="stdafx.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.cpp b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d074b393468488da3084add486dc5a8bdea925d --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.cpp @@ -0,0 +1,119 @@ +#include "stdafx.h" +#include "SerialPort.h" + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +SerialPort::SerialPort(unsigned char id, unsigned int baud) { + comHandle = INVALID_HANDLE_VALUE; + connected = false; + + this->port = id; + this->baud = baud; + + //Connect(); +} + +void SerialPort::Connect() { + DCB dcb; + COMMTIMEOUTS timeouts; + + std::string portName = "\\\\.\\COM" + std::to_string(port); + + if (connected || (comHandle != INVALID_HANDLE_VALUE)) + throw Exception("SerialPort already connected."); + + comHandle = CreateFile(portName.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + + if (comHandle == INVALID_HANDLE_VALUE) + throw Exception("Unable to open COM port."); + + GetCommState(comHandle, &dcb); + + dcb.BaudRate = baud; + dcb.fBinary = 1; + dcb.Parity = NOPARITY; + dcb.StopBits = TWOSTOPBITS; + dcb.ByteSize = 8; + + if (!SetCommState(comHandle, &dcb)) { + Disconnect(); + + throw Exception("Unable to set COM port parameters."); + } + + timeouts.ReadIntervalTimeout = MAXDWORD; + timeouts.ReadTotalTimeoutMultiplier = MAXDWORD; + timeouts.ReadTotalTimeoutConstant = 1; + timeouts.WriteTotalTimeoutConstant = 1; + timeouts.WriteTotalTimeoutMultiplier = 1; + + if (!SetCommTimeouts(comHandle, &timeouts)) { + Disconnect(); + + throw Exception("Unable to set COM port timeouts."); + } + + connected = true; +} + +void SerialPort::Disconnect() { + if (!connected) + return; + + CloseHandle(comHandle); + + comHandle = INVALID_HANDLE_VALUE; + connected = false; +} + +bool SerialPort::IsConnected() { + return connected; +} + +void SerialPort::Send(std::vector<unsigned char> data) { + DWORD nWritten; + unsigned int totalSent = 0, attempts = 0; + + if (!IsConnected()) + throw Exception("SerialPort not connected."); + + while (totalSent < data.size()) { + bool failed = false; + if (!WriteFile(comHandle, (LPCVOID)(data.data() + totalSent), data.size() - totalSent, &nWritten, NULL)) + failed = true; + + if (attempts++ > 10) + failed = true; + + if (failed) { + Disconnect(); + throw Exception("Unable to send data."); + } + totalSent += nWritten; + } +} + +std::vector<unsigned char> SerialPort::Read() { + if (!IsConnected()) + throw Exception("SerialPort not connected."); + + DWORD nRead; + unsigned char buffer[32]; + + if (!ReadFile(comHandle, (LPVOID)buffer, 32, &nRead, NULL)) { + Disconnect(); + throw Exception("Unable to receive data."); + } + + std::vector<unsigned char> data; + data.assign(buffer, buffer + nRead); + + return data; +} + +SerialPort::~SerialPort() { + if (IsConnected()) + Disconnect(); +} \ No newline at end of file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.h b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.h new file mode 100644 index 0000000000000000000000000000000000000000..a37be9ec935c52c1983e588494180df327bea858 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/SerialPort.h @@ -0,0 +1,43 @@ +#pragma once + +#include <vector> +#include <string> +#include <Windows.h> +#include <exception> + +class SerialPort { +public: + static const int ERROR_SETTING_COMM_SETTINGS = -1; + static const int ERROR_SETTING_COMM_TIMEOUTS = -2; + static const int ERROR_OPENING_COMM_PORT = -3; + static const int ERROR_SENDING_COMM = -4; + static const int ERROR_PORT_NOT_READY = -5; + static const int ERROR_GENERIC_WRITE_FAIL = -6; + static const int ERROR_GENERIC_READ_FAIL = -7; + static const int ERROR_GIVEN_NULL_POINTER = -8; + + class Exception : std::exception { + public: + Exception(std::string message) { _msg = std::string("SerialPort Exception: " + message); } + + virtual const char *what() { return _msg.c_str(); } + private: + std::string _msg; + }; + + SerialPort(unsigned char id, unsigned int baud); + + void Connect(); + void Disconnect(); + + bool IsConnected(); + + void Send(std::vector<unsigned char> data); + std::vector<unsigned char> Read(); + + ~SerialPort(); +private: + HANDLE comHandle; + unsigned int baud, port; + bool connected; +}; \ No newline at end of file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.cpp b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f4e074442d8dec619646b8ddfb40217891de4aec --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// SerialEchoConsole.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.h b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.h new file mode 100644 index 0000000000000000000000000000000000000000..47a0d0252b148bbb77eca0042cbf79e4e65f4fc8 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include <stdio.h> +#include <tchar.h> + + + +// TODO: reference additional headers your program requires here diff --git a/wifi_bridge/SerialEchoConsole/SerialEchoConsole/targetver.h b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/targetver.h new file mode 100644 index 0000000000000000000000000000000000000000..90e767bfce745c059344fcd374185b064f09dcf7 --- /dev/null +++ b/wifi_bridge/SerialEchoConsole/SerialEchoConsole/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include <SDKDDKVer.h> diff --git a/WiFiTelnetToSerial_test/WiFiTelnetToSerial_test.ino b/wifi_bridge/simple_bridge/simple_bridge.ino similarity index 100% rename from WiFiTelnetToSerial_test/WiFiTelnetToSerial_test.ino rename to wifi_bridge/simple_bridge/simple_bridge.ino diff --git a/WiFiTelnetToSerial_test/tcp_corrup_test.py b/wifi_bridge/simple_bridge/tcp_corrup_test.py similarity index 100% rename from WiFiTelnetToSerial_test/tcp_corrup_test.py rename to wifi_bridge/simple_bridge/tcp_corrup_test.py diff --git a/wifi_dropin/circ_buffer.c b/wifi_bridge/wifi_dropin_old/circ_buffer.c similarity index 100% rename from wifi_dropin/circ_buffer.c rename to wifi_bridge/wifi_dropin_old/circ_buffer.c diff --git a/wifi_dropin/circ_buffer.h b/wifi_bridge/wifi_dropin_old/circ_buffer.h similarity index 100% rename from wifi_dropin/circ_buffer.h rename to wifi_bridge/wifi_dropin_old/circ_buffer.h diff --git a/wifi_bridge/wifi_dropin_old/wifi_dropin_before_debug_changes.ino b/wifi_bridge/wifi_dropin_old/wifi_dropin_before_debug_changes.ino new file mode 100644 index 0000000000000000000000000000000000000000..dfc4493dd30198cf0763e75dbe3f7301fa9c2cc9 --- /dev/null +++ b/wifi_bridge/wifi_dropin_old/wifi_dropin_before_debug_changes.ino @@ -0,0 +1,178 @@ +extern "C" { +#include "user_interface.h" +#include "circ_buffer.h" +} +#include <ESP8266WiFi.h> +#include <algorithm> + +char ssid[] = "uCart_AP"; // Network name of hosted network +char pass[] = "password"; +IPAddress client_ip; + +unsigned int tcp_port = 8080; +// Server object for listening for requests +WiFiServer server(tcp_port); +// Reusable client object to communicate with the connected client +WiFiClient client; + + +// Maximum number of bytes to read at a time +const int BUF_SIZE = 1024; +byte* tcp_in_buffer = new byte[BUF_SIZE]; +//byte tcp_in_buffer[BUF_SIZE]; +//byte serial_in_buf[BUF_SIZE]; +byte* serial_in_buf = new byte[BUF_SIZE]; +//byte dummy_data[400]; +byte* dummy_data = new byte[BUF_SIZE]; +const int SEND_BUF_SIZE = 1024; + +void setup() { + // Set baud rate for UART + Serial.begin(115200); + Serial.setTimeout(2000); + Serial.setRxBufferSize(1024); + //Serial.print("Serial TX buffer size: "); + Serial.println(Serial.availableForWrite()); + + pinMode(0, OUTPUT); + pinMode(2, OUTPUT); + digitalWrite(2, LOW); + +/* + WiFiEventHandler client_disconnected_handler = WiFi.onSoftAPModeStationDisconnected( + [](const WiFiEventSoftAPModeStationDisconnected& event) { + //Serial.println("disconnected"); + }); +*/ + + // Configure chip to be access point + WiFi.mode(WIFI_AP); + + // Wait for Access point to be created + while (!WiFi.softAP(ssid)) { + delay(500); // Wait half a second before re-trying + } + + waitForStation(); + + // Begin TCP on a particular port + server.begin(); + server.setNoDelay(true); + +} + +void waitForStation() { + // Wait for a client to connect + struct station_info* connected_stns = NULL; + while (connected_stns = wifi_softap_get_station_info(), !connected_stns) { + delay(500); + } + client_ip = IPAddress(IP2STR(&connected_stns->ip)); + wifi_softap_free_station_info(); +} + +int led_on = 0; +int loop_count = 0; +void loop() { + if (!(loop_count % 5000)) { + digitalWrite(0, led_on ? HIGH : LOW); + led_on = !led_on; + } + loop_count++; + // Assume only one client will connect at a time. If a new request has arrived, + // that means the old client has expired, and the new one should be used + WiFiClient new_client = server.available(); + + if (new_client) { + // Read and forward any unread data + tcpToSerial(); + // Close existing client + client.stop(); + // Make new client the active one + client = new_client; + // Disable Nagle algorithm to decrease latency + //client.setNoDelay(true); + } + + if (client.connected() && client.available()) { + // Send any unsent data + //sendTCPBacklog(); + tcpToSerial(); + } + + // Try reading Serial data + int to_read = std::min(Serial.available(), BUF_SIZE); + to_read = 0; + if (to_read) { + Serial.readBytes(serial_in_buf, to_read); + sendTCP(serial_in_buf, to_read); + to_read = std::min(Serial.available(), BUF_SIZE); + } + +} + +void tcpToSerial() { + if (client.available()) { + // Don't read more than Serial can write at once, to prevent blocking + ssize_t n_to_read = std::min(client.available(), BUF_SIZE);//, Serial.availableForWrite()); + if (n_to_read > 0) { + client.read(tcp_in_buffer, n_to_read); + sendTCP(tcp_in_buffer, n_to_read); + } + //sendSerial(tcp_in_buffer, n_to_read); + } +} + +int write_cnt = 0; +int write_led_on = 0; +void sendTCP(byte data[], size_t n_bytes) { + size_t to_write = n_bytes; + //to_write = 400; + size_t total_written = 0; + while (client.connected() && to_write) { + //if (!(write_cnt % 2)) { + // digitalWrite(2, write_led_on ? HIGH : LOW); + // write_led_on = !led_on; + //} + //write_cnt++; + + //sendTCPBacklog(); + size_t written = client.write((const uint8_t*) data + total_written, to_write); + //size_t written = client.write((const uint8_t*) dummy_data + total_written, to_write); + delay(1); + if (written != to_write) { + Serial.println(written); + } + if (written == 0) { + digitalWrite(2, HIGH); + } + total_written += written; + to_write = to_write - written; + to_write = 0; + } + digitalWrite(2, LOW); +} + +void sendTCPBacklog() { + struct data_chunk needs_sent = getChunk(); + if (needs_sent.length) { + size_t written = client.write((const uint8_t*) needs_sent.data, needs_sent.length); + markConsumed(written); + } +} + +//void sendUDP(byte data[], int n_bytes) { +// udp.beginPacket(address, localPort); +// udp.write(data, n_bytes); +// udp.endPacket(); +//} + +void sendSerial(byte data[], int n_bytes) { + int to_write = n_bytes; + while (to_write) { + int written = Serial.write(data, to_write); + to_write -= written; + } +} + + diff --git a/wifi_dropin/wifi_dropin.ino b/wifi_bridge/wifi_dropin_old/wifi_dropin_old.ino similarity index 100% rename from wifi_dropin/wifi_dropin.ino rename to wifi_bridge/wifi_dropin_old/wifi_dropin_old.ino