NumRootInports 0\r
NumRootOutports 0\r
ParameterArgumentNames ""\r
- ComputedModelVersion "1.2"\r
+ ComputedModelVersion "1.3"\r
NumModelReferences 0\r
NumTestPointedSignals 0\r
}\r
ModifiedByFormat "%<Auto>"\r
LastModifiedBy "Andrei"\r
ModifiedDateFormat "%<Auto>"\r
- LastModifiedDate "Fri Apr 04 17:18:21 2008"\r
- ModelVersionFormat "1.%<AutoIncrement:2>"\r
+ LastModifiedDate "Mon Apr 07 00:09:43 2008"\r
+ ModelVersionFormat "1.%<AutoIncrement:3>"\r
ConfigurationManager "None"\r
LinearizationMsg "none"\r
Profile off\r
}\r
System {\r
Name "mcl_test"\r
- Location [562, 164, 1142, 457]\r
+ Location [621, 375, 1201, 668]\r
Open on\r
ModelBrowserVisibility off\r
ModelBrowserWidth 200\r
Name "Constant"\r
Position [80, 95, 110, 125]\r
Value "[1 1 1]"\r
- SampleTime "0.1"\r
+ SampleTime "0.5"\r
}\r
Block {\r
BlockType Constant\r
Name "Constant1"\r
Position [80, 175, 110, 205]\r
- Value "[0 0 0 ]"\r
- SampleTime "0.33"\r
+ Value "[0 0 0]"\r
+ SampleTime "2"\r
}\r
Block {\r
BlockType "S-Function"\r
Ports [1]\r
Position [435, 134, 465, 166]\r
Floating off\r
- Location [188, 390, 512, 629]\r
- Open off\r
+ Location [303, 265, 1051, 605]\r
+ Open on\r
NumInputPorts "1"\r
List {\r
ListType AxesTitles\r
SampleTime "0"\r
}\r
Line {\r
- SrcBlock "Constant"\r
+ SrcBlock "S-Function"\r
SrcPort 1\r
- Points [35, 0; 0, 30]\r
- DstBlock "S-Function"\r
+ DstBlock "Scope"\r
DstPort 1\r
}\r
Line {\r
SrcBlock "Constant1"\r
SrcPort 1\r
- Points [35, 0; 0, -35]\r
+ Points [60, 0; 0, -35]\r
DstBlock "S-Function"\r
DstPort 2\r
}\r
Line {\r
- SrcBlock "S-Function"\r
+ SrcBlock "Constant"\r
SrcPort 1\r
- DstBlock "Scope"\r
+ Points [60, 0; 0, 30]\r
+ DstBlock "S-Function"\r
DstPort 1\r
}\r
}\r
#ifdef __cplusplus
-extern "C" { /* use the C fcn-call standard for all functions */
-#endif
-/* defined within this scope */
+extern "C" { // use the C fcn-call standard for all functions
+#endif // defined within this scope
#define S_FUNCTION_LEVEL 2
#define S_FUNCTION_NAME sf_mcl
#define INPUT_MOVE 0
#define INPUT_MEASURE 1
+#define OUTPUT_EST_POS 0
#define PARAM_PART_COUNT_IDX 0
#define PART_COUNT_PARAM(S) (ssGetSFcnParam(S,PARAM_PART_COUNT_IDX))
-#define OUTPUT_EST_POS 0
+
#define SAMPLETIME_MOVE 0
#define SAMPLETIME_MEASURE 1
ssSetNumSampleTimes(S, PORT_BASED_SAMPLE_TIMES);
ssSetNumRWork(S, 0);
ssSetNumIWork(S, 0);
- ssSetNumPWork(S, 1); /* reserve element in the pointers vector */
+ ssSetNumPWork(S, 1); // reserve element in the pointers vector
ssSetNumModes(S, 0);
ssSetNumNonsampledZCs(S, 0);
pwork[0] = (void*)st;
}
#endif /* MDL_START */
+
#define MDL_UPDATE
/* Function: mdlUpdate ======================================================
* Abstract:
ssPrintf("Update %d %g\n", tid, ssGetT(S));
}
+
+
/* Function: mdlOutputs =======================================================
* Abstract:
* In this function, you compute the outputs of your S-function
int moveTid = ssGetInputPortSampleTimeIndex(S,INPUT_MOVE);
int measureTid = ssGetInputPortSampleTimeIndex(S,INPUT_MEASURE);
+ InputRealPtrsType iPtrsMove = ssGetInputPortRealSignalPtrs(S, INPUT_MOVE);
+ InputRealPtrsType iPtrsMeasure = ssGetInputPortRealSignalPtrs(S, INPUT_MEASURE);
+
+
ssPrintf("Output %d %g\n", tid, ssGetT(S));
-
+ ssPrintf("=============================================\n");
if (ssIsSampleHit(S, moveTid, tid)) {
+
+ st->x = st->x + *iPtrsMove[0];
+ st->y = st->y + *iPtrsMove[1];
+ st->ang = st->ang + *iPtrsMove[2];
+ pos[0] = st->x;
+ pos[1] = st->y;
+ pos[2] = st->ang;
+ ssPrintf("x=%g, y=%g, ang=%g\n",pos[0], pos[1], pos[2]);
ssPrintf("move \n");
if (moveTid == measureTid ||
ssIsSpecialSampleHit(S, measureTid, moveTid, tid)) {
ssPrintf("both \n");
-
+
}
}
if (ssIsSampleHit(S, measureTid, tid)) {
- ssPrintf("measure \n");
- if (moveTid == measureTid ||
+
+ st->x = *iPtrsMeasure[0];
+ st->y = *iPtrsMeasure[1];
+ st->ang = *iPtrsMeasure[2];
+ pos[0] = st->x;
+ pos[1] = st->y;
+ pos[2] = st->ang;
+ ssPrintf("xMeas=%g, yMeas=%g, angMeas=%g\n",pos[0], pos[1], pos[2]);
+ ssPrintf("measure \n");
+ if (moveTid == measureTid ||
ssIsSpecialSampleHit(S, measureTid, moveTid, tid)) {
ssPrintf("both \n");
}
}
- pos[0] = st->x;
- pos[1] = st->y;
- pos[2] = st->ang;
- UNUSED_ARG(tid);
+
+
+ /* pos[0] = st->x;
+ pos[1] = st->y;
+ pos[2] = st->ang;*/
+ UNUSED_ARG(tid);
+
}
/* Function: mdlTerminate =====================================================
static void mdlTerminate(SimStruct *S)
{
free(ssGetPWork(S)[0]);
-} /* function */
+} // function
/*======================================================*
* See sfuntmpl.doc for the optional S-function methods *
*======================================================*/