diff --git a/Makefile b/Makefile index 66fdbc9..21bf829 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ OBJS=$(SRC:.c=.o) EXECUTABLE=adcs-sensor-reader CMDS=adcs-sensor-reader-util INSTALL_DEST=$(BIN_PATH) -CMD_FILE=adcs-sensor-reader.cmd.cfg +CMD_FILE=adcs.cmd.cfg all: $(EXECUTABLE) $(CMDS) diff --git a/README.md b/README.md index c838898..8a1724f 100644 --- a/README.md +++ b/README.md @@ -18,10 +18,11 @@ using `make TARGET=arm`. ### Usage -You can run this process by running the executable, `./adcs`. +You can run this process by running the executable, `./adcs-sensor-reader`. After starting the process, you can call it with the adcs util program. -Give `./adcs-util -S` and `./adcs-util -T` a try! +Give `./adcs-sesor-reader-util -S` and `./adcs-sensor-reader-util -T` a try! +The command `./adcs-sensor-reader-util -dl` will print a datalogger sensor config file. If the process is running on an different computer, like an Intrepid board, you can supply the process IP with the `-h` flag. diff --git a/adcs-util.c b/adcs-util.c index 8fc370d..f95281d 100644 --- a/adcs-util.c +++ b/adcs-util.c @@ -21,10 +21,20 @@ #define WAIT_MS (2 * 1000) +#ifdef BR_TELEM_PATH +#define DFL_TELEM_PATH BR_TELEM_PATH +#else +#define DFL_TELEM_PATH "/usr/bin/adcs-sensor-reader-util" +#endif + struct MulticallInfo; static int adcs_status(int, char**, struct MulticallInfo *); static int adcs_telemetry(int, char**, struct MulticallInfo *); +static int adcs_datalogger(int, char**, struct MulticallInfo *); +static int adcs_sensor_metadata(int, char **, struct MulticallInfo *); +static int adcs_json_telem(int, char **, struct MulticallInfo *); + // struct holding all possible function calls // running the executable with the - flags will call that function @@ -39,6 +49,14 @@ struct MulticallInfo { "Display the current status of the adcs process -S" }, { &adcs_telemetry, "adcs-telemetry", "-T", "Display the current KVP telemetry of the adcs process -T" }, + { &adcs_datalogger, "adcs-datalogger", "-dl", + "Print a list of sensors supported by the -telemetry app in a format suitable for datalogger"}, + { &adcs_sensor_metadata, "adcs-sensor-metadata", "-meta", + "Print a list of sensors supported by the -telemetry app in a format suitable for use with the ground-based telemetry database"}, + { &adcs_json_telem, "adcs-json-telem", "-json", + "Print an JSON telemetry dictionary"}, + + { NULL, NULL, NULL, NULL } }; @@ -123,6 +141,120 @@ static int adcs_status(int argc, char **argv, struct MulticallInfo * self) return 0; } +static struct TELMEventInfo events[] = { + { 0, 0, NULL, NULL } +}; + + +struct TELMTelemetryInfo telemetryPoints[] = { + { "accel_x", "motherboard", "software", "G", 1, 0, + "Accelerometer X", + "X Accelerration in Gs" }, + { "accel_y", "motherboard", "software", "G", 1, 0, + "Accelerometer Y", + "Y Accelerration in Gs" }, + { "accel_z", "motherboard", "software", "G", 1, 0, + "Accelerometer Z", + "Z Accelerration in Gs" }, + + { "gyro_x", "motherboard", "software", "d/s", 1, 0, + "Gyroscope X", + "X Gyro in d/s" }, + { "gyro_y", "motherboard", "software", "d/s", 1, 0, + "Gyroscope X", + "X Gyro in d/s" }, + { "gyro_z", "motherboard", "software", "d/s", 1, 0, + "Gyroscope Z", + "Z Gyro in d/s" }, + + { "mb_mag_x", "motherboard", "software", "nT", 1, 0, + "Motherboard Magnetometer X", + "Motherboard X magnetism in nTs" }, + { "mb_mag_y", "motherboard", "software", "nT", 1, 0, + "Motherboard Magnetometer Y", + "Motherboard Y magnetism in nTs" }, + { "mb_mag_z", "motherboard", "software", "nT", 1, 0, + "Motherboard Magnetometer Z", + "Motherboard Z magnetism in nTs" }, + + { "nz_mag_x", "-z", "software", "nT", 1, 0, + "Negative Z magnetometer X", + "Negative Z magnetism in nTs" }, + { "nz_mag_y", "-z", "software", "nT", 1, 0, + "Negative Z magnetometer Y", + "Negative Z Y magnetism in nTs" }, + { "nz_mag_z", "-z", "software", "nT", 1, 0, + "Negative Z magnetometer Z", + "Negative Z Z magnetism in nTs" }, + + { "pz_mag_x", "+z", "software", "nT", 1, 0, + "Positive Z magnetometer X", + "Positive Z magnetism in nTs" }, + { "pz_mag_y", "+z", "software", "nT", 1, 0, + "Positive Z magnetometer Y", + "Positive Z Y magnetism in nTs" }, + { "pz_mag_z", "+z", "software", "nT", 1, 0, + "Positive Z magnetometer Z", + "Positive Z Z magnetism in nTs" }, + + { "ny_mag_x", "-y", "software", "nT", 1, 0, + "Negative Y magnetometer X", + "Negative Y magnetism in nTs" }, + { "ny_mag_y", "-y", "software", "nT", 1, 0, + "Negative Y magnetometer Y", + "Negative Y Y magnetism in nTs" }, + { "ny_mag_z", "-y", "software", "nT", 1, 0, + "Negative Y magnetometer Z", + "Negative Y Z magnetism in nTs" }, + + { "py_mag_x", "+y", "software", "nT", 1, 0, + "Positive Y magnetometer X", + "Positive Y magnetism in nTs" }, + { "py_mag_y", "+y", "software", "nT", 1, 0, + "Positive Y magnetometer Y", + "Positive Y Y magnetism in nTs" }, + { "py_mag_z", "+y", "software", "nT", 1, 0, + "Positive Y magnetometer Z", + "Positive Y Z magnetism in nTs" }, + + { "nx_mag_x", "-x", "software", "nT", 1, 0, + "Negative X magnetometer X", + "Negative X magnetism in nTs" }, + { "nx_mag_y", "-x", "software", "nT", 1, 0, + "Negative X magnetometer Y", + "Negative X Y magnetism in nTs" }, + { "nx_mag_z", "-x", "software", "nT", 1, 0, + "Negative X magnetometer Z", + "Negative X Z magnetism in nTs" }, + + { "px_mag_x", "+x", "software", "nT", 1, 0, + "Positive X magnetometer X", + "Positive X magnetism in nTs" }, + { "px_mag_y", "+x", "software", "nT", 1, 0, + "Positive X magnetometer Y", + "Positive X Y magnetism in nTs" }, + { "px_mag_z", "+x", "software", "nT", 1, 0, + "Positive X magnetometer Z", + "Positive X Z magnetism in nTs" }, + + { NULL, NULL }, +}; + +static int adcs_datalogger(int argc, char **argv, struct MulticallInfo * self) +{ + return TELM_print_datalogger_info(telemetryPoints, "adcs-sensor-reader", DFL_TELEM_PATH, argc, argv); +} + +static int adcs_sensor_metadata(int argc, char **argv, struct MulticallInfo * self) +{ + return TELM_print_sensor_metadata(telemetryPoints, events); +} +static int adcs_json_telem(int argc, char **argv, struct MulticallInfo * self) +{ + return TELM_print_json_telem_dict(telemetryPoints, events, argc, argv); +} + + /* get telemetry from ADCS process * @param argc number of command line arguments * @param argv char array of command line arguments diff --git a/adcs-sensor-reader.cmd.cfg b/adcs.cmd.cfg similarity index 100% rename from adcs-sensor-reader.cmd.cfg rename to adcs.cmd.cfg diff --git a/adcs_datalogger.cfg b/adcs_datalogger.cfg new file mode 100644 index 0000000..fa88948 --- /dev/null +++ b/adcs_datalogger.cfg @@ -0,0 +1,179 @@ + + NAME=adcs-sensor-reader-util + PROC_NAME=adcs-sensor-reader-util + NUM=1 + START_TIME=P+1 + SCHED_TIME=30 + DURATION=0 + + + + NAME=adcs-sensor-reader-util + PROC_PATH=/usr/bin/adcs-sensor-reader-util + POWER=1 + POWER_PROC=./.none + PARAM=-T + + + NAME=adcs-sensor-reader + SENSOR_KEY=accel_x + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=accel_y + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=accel_z + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=gyro_x + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=gyro_y + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=gyro_z + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=mb_mag_x + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=mb_mag_y + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=mb_mag_z + LOCATION=motherboard + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nz_mag_x + LOCATION=-z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nz_mag_y + LOCATION=-z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nz_mag_z + LOCATION=-z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=pz_mag_x + LOCATION=+z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=pz_mag_y + LOCATION=+z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=pz_mag_z + LOCATION=+z + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=ny_mag_x + LOCATION=-y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=ny_mag_y + LOCATION=-y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=ny_mag_z + LOCATION=-y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=py_mag_x + LOCATION=+y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=py_mag_y + LOCATION=+y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=py_mag_z + LOCATION=+y + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nx_mag_x + LOCATION=-x + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nx_mag_y + LOCATION=-x + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=nx_mag_z + LOCATION=-x + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=px_mag_x + LOCATION=+x + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=px_mag_y + LOCATION=+x + GROUPS=software + + + NAME=adcs-sensor-reader + SENSOR_KEY=px_mag_z + LOCATION=+x + GROUPS=software + + \ No newline at end of file