Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
132 changes: 132 additions & 0 deletions adcs-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
};

Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
179 changes: 179 additions & 0 deletions adcs_datalogger.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<EVENT>
NAME=adcs-sensor-reader-util
PROC_NAME=adcs-sensor-reader-util
NUM=1
START_TIME=P+1
SCHED_TIME=30
DURATION=0
</EVENT>

<SUBPROCESS>
NAME=adcs-sensor-reader-util
PROC_PATH=/usr/bin/adcs-sensor-reader-util
POWER=1
POWER_PROC=./.none
PARAM=-T

<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=accel_x
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=accel_y
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=accel_z
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=gyro_x
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=gyro_y
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=gyro_z
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=mb_mag_x
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=mb_mag_y
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=mb_mag_z
LOCATION=motherboard
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nz_mag_x
LOCATION=-z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nz_mag_y
LOCATION=-z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nz_mag_z
LOCATION=-z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=pz_mag_x
LOCATION=+z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=pz_mag_y
LOCATION=+z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=pz_mag_z
LOCATION=+z
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=ny_mag_x
LOCATION=-y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=ny_mag_y
LOCATION=-y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=ny_mag_z
LOCATION=-y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=py_mag_x
LOCATION=+y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=py_mag_y
LOCATION=+y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=py_mag_z
LOCATION=+y
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nx_mag_x
LOCATION=-x
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nx_mag_y
LOCATION=-x
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=nx_mag_z
LOCATION=-x
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=px_mag_x
LOCATION=+x
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=px_mag_y
LOCATION=+x
GROUPS=software
</SENSOR>
<SENSOR>
NAME=adcs-sensor-reader
SENSOR_KEY=px_mag_z
LOCATION=+x
GROUPS=software
</SENSOR>
</SUBPROCESS>