COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
State of health messages

This is a tutorial to show you how to use State of Health messages in the COSMOS Agents.

After you have setup the agent server (ex. Cosmos::Agent::Agent) you can add your personalized state of health (SOH) information using the function Cosmos::Agent::set_sohstring :

1 // Set SOH String
2 char sohstring[2000] = "{\"node_loc_utc\","
3  "\"node_loc_pos_eci\","
4  "\"node_loc_att_icrf\"}" ;
5 agent_set_sohstring(cdata, sohstring);

then inside the agent main loop you can add the dynamic information that you want

1 // Start executing the agent
2 while(agent_running(cdata))
3 {
4  pos_eci.utc = currentmjd(0);
5  cdata->node.loc.pos.eci = pos_eci;
6 }

to check the data flow you can now use the agent program

$ agent dump beat

this will show you the state of health information comming with the heartbeat as the following example:

{"agent_utc":57245.1587221274}{"agent_node":"telem"}{"agent_proc":"add_soh"}{"agent_addr":"192.168.56.1"}{"agent_port":61686}{"agent_bsz":59996}{"node_utcoffset":0}{"node_loc_utc":0}{"node_loc_pos_eci":{"utc":57245.158722127439,"pos":[4,5,6],"vel":[0.10000000000000001,0,0],"acc":[,4.9406564584124654e-323,1.8041870288084286e-307]}}{"node_loc_att_icrf":{"utc":0,"pos":{"d":{"x":0,"y":0,"z":0},"w":0},"vel":[0,0,0],"acc":[0,0,0]}}

We've put together a small agent example to demostrate the principle. Go to cosmos-source/core/examples/agents/add_state_of_health and open the agent_add_soh.pro in Qt creator.