diff --git a/.gitmodules b/.gitmodules index 17b64a2..20484a6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ -[submodule "apps/tvs_io"] - path = apps/tvs_io +[submodule "apps/tvsio"] + path = apps/tvsio url = git@github.com:nasa/tvsio.git branch = master diff --git a/README.md b/README.md index 1ffd766..41fb250 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This is a sample Core Flight Software (cFS) project to demonstrate how [Trick Va This project includes two very basic Trick simulations and one basic CFS app. One trick sim is a 'temperature' data producer the other is a consumer. The CFS app, called temp_mon, will monitor the 'temperature' data and send a reset command to reset the data counter. TVS-IO app connects to the Trick Variable Server of each sim, reading and writing values as defined by the \*.tvm files. TVS-IO is the messenger that allows the two trick sims to talk to the temp_mon CFS app. -TVS-IO is included as a submodule at [`apps/tvs_io`](apps) +TVS-IO is included as a submodule at [`apps/tvsio`](apps) ## Building ### CFS[^1] diff --git a/apps/inc/TempStructDef.h b/apps/inc/TempStructDef.h index 03d9a50..59090f9 100644 --- a/apps/inc/TempStructDef.h +++ b/apps/inc/TempStructDef.h @@ -8,12 +8,13 @@ typedef struct { char cfsHeader[16]; float temperature; + double speed; } Struct_Temp; typedef struct { - char commandHeader[CFE_SB_CMD_HDR_SIZE]; + char commandHeader[CFE_SB_CMD_HDR_SIZE]; // 16 bytes uint8 reset_flag; } Temp_Cmd; diff --git a/apps/inc/rpodvsmStructDef.h b/apps/inc/rpodvsmStructDef.h index 99a0663..e73db22 100644 --- a/apps/inc/rpodvsmStructDef.h +++ b/apps/inc/rpodvsmStructDef.h @@ -16,6 +16,7 @@ typedef struct { char commandHeader[CFE_SB_CMD_HDR_SIZE]; float temperature; + float speed; } RPOD_TEMP_CMD; diff --git a/apps/inc/tvm_files/rpodvsm_cmd.tvm b/apps/inc/tvm_files/rpodvsm_cmd.tvm index 2557c44..bf881e6 100644 --- a/apps/inc/tvm_files/rpodvsm_cmd.tvm +++ b/apps/inc/tvm_files/rpodvsm_cmd.tvm @@ -2,7 +2,8 @@ "cfsStructureType":"RPOD_TEMP_CMD", "cfsStructureFileName":"rpodvsmStructDef.h", "members": [ - {"trickVar":"rendezvous.temp_in.temp", "trickType":"double", "cfsVar":"temperature", "cfsType":"float"} + {"trickVar":"rendezvous.temp_in.temp", "trickType":"double", "cfsVar":"temperature", "cfsType":"float"}, + {"trickVar":"rendezvous.temp_in.speed", "trickType":"double", "cfsVar":"speed", "cfsType":"double"} ], "messageId":"0xBABF", "commandCode":24, diff --git a/apps/inc/tvm_files/temp_tlm.tvm b/apps/inc/tvm_files/temp_tlm.tvm index 1ba0810..ebfc335 100644 --- a/apps/inc/tvm_files/temp_tlm.tvm +++ b/apps/inc/tvm_files/temp_tlm.tvm @@ -2,7 +2,8 @@ "cfsStructureType":"Struct_Temp", "cfsStructureFileName":"TempStructDef.h", "members": [ - {"trickVar":"dyn.temperature.temp", "trickType":"double", "cfsVar":"temperature", "cfsType":"float"} + {"trickVar":"dyn.temperature.temp", "trickType":"double", "cfsVar":"temperature", "cfsType":"float"}, + {"trickVar":"dyn.temperature.speed", "trickType":"double", "cfsVar":"speed", "cfsType":"double"} ], "messageId":"0x01DD", "flowDirection":1 diff --git a/apps/temp_mon/fsw/src/temp_mon_app.c b/apps/temp_mon/fsw/src/temp_mon_app.c index 2db2be0..6339ccd 100644 --- a/apps/temp_mon/fsw/src/temp_mon_app.c +++ b/apps/temp_mon/fsw/src/temp_mon_app.c @@ -86,7 +86,7 @@ void TEMP_MON_AppMain( void ) case STRUCT_TEMP_MID: temp_tlm = (Struct_Temp*) pMsg; if ( temp_tlm == NULL) continue; - OS_printf( "\e[32m***** TEMP_MON *****\e[39m Received MID 0x%04X, Temp %.2f\n",msgId,temp_tlm->temperature ); + OS_printf( "\e[32m***** TEMP_MON *****\e[39m Received MID 0x%04X, Temp %.2f, Speed %.2lf\n",msgId,temp_tlm->temperature,temp_tlm->speed ); //Send reset command to tvsio to send to the sim if ( temp_tlm->temperature > 10 && g_TEMP_MON_AppData.tempOutMsg.reset_flag == 0 ) { @@ -101,6 +101,7 @@ void TEMP_MON_AppMain( void ) } g_TEMP_MON_AppData.rpodTempMsg.temperature = temp_tlm->temperature; + g_TEMP_MON_AppData.rpodTempMsg.speed = (float)(-1 * temp_tlm->speed); iStatus = CFE_SB_SendMsg((CFE_SB_MsgPtr_t)&g_TEMP_MON_AppData.rpodTempMsg); OS_printf( "\e[32m***** TEMP_MON *****\e[39m Sending RPOD Temp CMD MID, status = %d\n",iStatus); diff --git a/apps/tvs_io b/apps/tvsio similarity index 100% rename from apps/tvs_io rename to apps/tvsio diff --git a/trick_sims/SIM_range/models/range/include/range.h b/trick_sims/SIM_range/models/range/include/range.h index 342c2ad..003df59 100644 --- a/trick_sims/SIM_range/models/range/include/range.h +++ b/trick_sims/SIM_range/models/range/include/range.h @@ -14,6 +14,7 @@ typedef struct { typedef struct { double temp; /* degF Temperature */ + double speed; /* m/s */ } TEMP ; diff --git a/trick_sims/SIM_range/models/range/src/range_init.c b/trick_sims/SIM_range/models/range/src/range_init.c index be1e0be..77e36bf 100644 --- a/trick_sims/SIM_range/models/range/src/range_init.c +++ b/trick_sims/SIM_range/models/range/src/range_init.c @@ -11,6 +11,7 @@ int range_init( CONTROL* C, TEMP* T) { C->range = 0.0; C->range_rate = 0.0; - T->temp = 0.0; + T->temp = 0.0; + T->speed = 0.0; return 0 ; } \ No newline at end of file diff --git a/trick_sims/SIM_range/models/range/src/range_process.c b/trick_sims/SIM_range/models/range/src/range_process.c index 2aecef7..da373ba 100644 --- a/trick_sims/SIM_range/models/range/src/range_process.c +++ b/trick_sims/SIM_range/models/range/src/range_process.c @@ -19,5 +19,6 @@ int range_process( CONTROL* C ) { int temp_process( TEMP* T ) { printf( "Received temp: %5.2f\n", T->temp ); + printf( "Received speed: %5.2f\n", T->speed ); return 0; } \ No newline at end of file diff --git a/trick_sims/SIM_temp/models/temp/include/temperature.h b/trick_sims/SIM_temp/models/temp/include/temperature.h index 0130a43..0c6a892 100644 --- a/trick_sims/SIM_temp/models/temp/include/temperature.h +++ b/trick_sims/SIM_temp/models/temp/include/temperature.h @@ -7,6 +7,7 @@ PURPOSE: (Do stuff) typedef struct { double temp; /* degF Temperature */ + double speed; /* m/s */ unsigned int reset_flag; } TEMP ; diff --git a/trick_sims/SIM_temp/models/temp/src/temp_init.c b/trick_sims/SIM_temp/models/temp/src/temp_init.c index 0f327d8..c8c5cec 100644 --- a/trick_sims/SIM_temp/models/temp/src/temp_init.c +++ b/trick_sims/SIM_temp/models/temp/src/temp_init.c @@ -9,6 +9,7 @@ PURPOSE: (Set the initial data values) int temp_init( TEMP* T) { T->temp = 0.0; + T->speed = 0.0; T->reset_flag = 0; return 0 ; } \ No newline at end of file diff --git a/trick_sims/SIM_temp/models/temp/src/temp_process.c b/trick_sims/SIM_temp/models/temp/src/temp_process.c index 4b4b615..18d73e9 100644 --- a/trick_sims/SIM_temp/models/temp/src/temp_process.c +++ b/trick_sims/SIM_temp/models/temp/src/temp_process.c @@ -9,8 +9,15 @@ int temp_process( TEMP* T ) { T->temp += 0.1; if (T->temp > 100) { T->temp = 0.0; - fprintf(stderr,"temp check\n"); + fprintf(stderr, "temp check\n"); } + + T->speed += 0.5; + if (T->speed > 30) { + T->speed = 0.0; + fprintf(stderr, "speed check\n"); + } + if (T->reset_flag) { fprintf(stderr,"temp reset\n"); T->temp = 0.0; @@ -21,4 +28,5 @@ int temp_process( TEMP* T ) { void temp_display( TEMP* T ) { printf("Temp: %.1f\n", T->temp ); + printf("Speed: %.1f\n", T->speed ); } \ No newline at end of file diff --git a/tvsio_defs/targets.cmake b/tvsio_defs/targets.cmake index 6ef63e8..2b1ad21 100644 --- a/tvsio_defs/targets.cmake +++ b/tvsio_defs/targets.cmake @@ -55,7 +55,7 @@ SET(TGT1_SYSTEM i686-pc-linux-gnu) SET(TGT1_APPLIST sch sbn - tvs_io + tvsio temp_mon) SET(TGT1_FILELIST cfe_es_startup.scr