31 scrollok(stdscr,
TRUE);
45 printw(
"Cleaning up...\n");
55 unsigned char user_char = 0;
57 static enum {UI_OVERVIEW = 0, UI_IMU, UI_EFF, UI_MRA , UI_ENC} ui_state;
63 mvaddstr(0,15,
"RLEG Data");
111 ui_state = UI_OVERVIEW;
137 mvprintw(2, 0,
"Accelerometer X (raw): %d", pimu_data->
acc.
x);
138 mvprintw(2, 40,
"Accelerometer X (g): %lf", pimu_data->
calib.
acc.
x);
139 mvprintw(3, 0,
"Accelerometer Y (raw): %d", pimu_data->
acc.
y);
140 mvprintw(3, 40,
"Accelerometer Y (g): %lf", pimu_data->
calib.
acc.
y);
141 mvprintw(4, 0,
"Accelerometer Z (raw): %d", pimu_data->
acc.
z);
142 mvprintw(4, 40,
"Accelerometer Z (g): %lf", pimu_data->
calib.
acc.
z);
143 mvprintw(5, 0,
"Gyrometer X (raw): %d", pimu_data->
gyr.
x);
144 mvprintw(5, 40,
"Gyrometer X (rad/sec): %lf", pimu_data->
calib.
gyr.
x);
145 mvprintw(6, 0,
"Gyrometer Y (raw): %d", pimu_data->
gyr.
y);
146 mvprintw(6, 40,
"Gyrometer Y (rad/sec): %lf", pimu_data->
calib.
gyr.
y);
147 mvprintw(7, 0,
"Gyrometer Z (raw): %d", pimu_data->
gyr.
z);
148 mvprintw(7, 40,
"Gyrometer Z (rad/sec): %lf", pimu_data->
calib.
gyr.
z);
149 mvprintw(8, 0,
"Magnetometer X (raw): %d", pimu_data->
mag.
x);
150 mvprintw(8, 40,
"Magnetometer X (B): %lf", pimu_data->
calib.
mag.
x);
151 mvprintw(9, 0,
"Magnetometer Y (raw): %d", pimu_data->
mag.
y);
152 mvprintw(9, 40,
"Magnetometer Y (B): %lf", pimu_data->
calib.
mag.
y);
153 mvprintw(10,0,
"Magnetometer Z (raw): %d", pimu_data->
mag.
z);
154 mvprintw(10,40,
"Magnetometer Z (B): %lf", pimu_data->
calib.
mag.
z);
165 mvprintw(2,0,
"Fx (bits): %d",peff_data->
F.
x);
167 mvprintw(3,0,
"Fy (bits): %d",peff_data->
F.
y);
169 mvprintw(4,0,
"Fz (bits): %d",peff_data->
F.
z);
171 mvprintw(5,0,
"Mx (bits): %d",peff_data->
M.
x);
173 mvprintw(6,0,
"My (bits): %d",peff_data->
M.
y);
175 mvprintw(7,0,
"Mz (bits): %d",peff_data->
M.
z);
183 mvprintw(2,0,
"Position (raw): %lf",enc_data->
position);
184 mvprintw(3,0,
"Position (degree): %lf",enc_data->
calib.
position);
190 mvprintw(2,0,
"V_ctl (bits): %d",pmra_data->
v_ctl);
191 mvprintw(3,0,
"V_ctl_read (bits): %d",pmra_data->
v_ctl_read);
199 float error_rate = 0.0;
202 double mean_exec_time = 0.0;
205 get_time(&t, &Ts, &mean_exec_time, &t0);
207 error_rate = (float)(((
float)failures/(
float)total)*100.0);
208 mvprintw(2, 0,
"Communication Statistics: Total = %d Failures = %d Error Rate = %3.3f",total, failures, error_rate);
210 mvprintw(4, 0,
"IMU Accelerometer (bits):\tX:%4d\tY:%4d\tZ:%4d", pimu_data->
acc.
x, pimu_data->
acc.
y, pimu_data->
acc.
z);
211 mvprintw(5, 0,
"IMU Gyrometer (bits):\t\tX:%4d\tY:%4d\tZ:%4d", pimu_data->
gyr.
x, pimu_data->
gyr.
y, pimu_data->
gyr.
z);
212 mvprintw(6, 0,
"IMU Magnetometer (bits):\tX:%4d\tY:%4d\tZ:%4d", pimu_data->
mag.
x, pimu_data->
mag.
y, pimu_data->
mag.
z);
214 mvprintw(8, 0,
"IMU Accelerometer (g):\t\tX:%8.5lf\tY:%8.5lf\tZ:%8.5lf", pimu_data->
calib.
acc.
x, pimu_data->
calib.
acc.
y, pimu_data->
calib.
acc.
z);
215 mvprintw(9, 0,
"IMU Gyrometer (rad/s):\t\tX:%8.5lf\tY:%8.5lf\tZ:%8.5lf", pimu_data->
calib.
gyr.
x, pimu_data->
calib.
gyr.
y, pimu_data->
calib.
gyr.
z);
216 mvprintw(10, 0,
"IMU Magnetometer (B):\t\tX:%8.5lf\tY:%8.5lf\tZ:%8.5lf", pimu_data->
calib.
mag.
x, pimu_data->
calib.
mag.
y, pimu_data->
calib.
mag.
z);
218 mvprintw(12, 0,
"Temp (bits): %d", pimu_data->
temp);
219 mvprintw(12,40,
"Temp (ÂșC): %lf", pimu_data->
calib_temp);
221 mvprintw(13,0,
"Encoder (bits):\t%d",enc_data->
position);
222 mvprintw(13,40,
"Encoder (degree):\t%d",enc_data->
calib.
position);
237 mvprintw(15, 0,
"Voltage Control Written (bits):\t%4d", pmra_data->
v_ctl);
238 mvprintw(16, 0,
"Voltage Control Read (bits):\t%4d", pmra_data->
v_ctl_read);
240 mvprintw(18, 0,
"Runtime: %4.2lf", t);
244 mvprintw(18, 40,
"Datalogger stopped");
248 mvprintw(18, 40,
"Datalogger runtime: %4.2lf", (t-t0));
265 mvprintw(20, 0,
"I: IMU");
266 mvprintw(20, 20,
"F: Efforts");
267 mvprintw(20, 40,
"M: Magneto-rheological Actuator");
268 mvprintw(21, 0,
"E: Encoder");
269 mvprintw(21, 20,
"O: Overview");
270 mvprintw(21, 40,
"D: Datalogger Start/Stop");
271 mvprintw(22, 0,
"Q: Quit\n");
int ui_eff_data(EFF_DATA_STRUCT *peff_data)
int ui_close(void)
Close UI.
int ui_mra_data(MRA_DATA_STRUCT *pmra_data)
Print MRA data.
int datalogger_start(void)
#define DATALOGGER_RUNNING
int get_time(double *time_control_task_s, double *Ts_control_task_s, double *mean_time_control_task_s, double *t0_control_task_s)
Review of this function:
unsigned int telemetry_mode
DATA_XYZ mag
Magnetormeter Vector.
int ui_enc_data(ENC_DATA_STRUCT *enc_data)
Print ENCODER data.
void exit_program(void)
Internal function to end program.
short int v_ctl_read
Voltage level read from the actuator.
DATA_XYZ acc
Accel Vector.
struct ENC_DATA_STRUCT::calibrate calib
int ui_overview_data(int total, int failures, IMU_DATA_STRUCT *pimu_data, EFF_DATA_STRUCT *peff_data, MRA_DATA_STRUCT *pmra_data, ENC_DATA_STRUCT *enc_data)
Print ALL sensors data.
#define DATALOGGER_NOT_RUNNING
unsigned short int position
int ui_menu()
Print the menu.
unsigned short int position
struct IMU_DATA_STRUCT::calibrated calib
int ui_imu_data(IMU_DATA_STRUCT *pimu_data)
Print IMU data.
int ui_init(void)
Initialize UI.
DATA_XYZ gyr
Gyrometer Vector.
int ui_update(IMU_DATA_STRUCT *pimu_data, EFF_DATA_STRUCT *peff_data, MRA_DATA_STRUCT *pmra_data, ENC_DATA_STRUCT *enc_data, int total, int failure)
Update Screen with new data of sensors.
short int v_ctl
Voltage level for control output.
int datalogger_status(void)
int datalogger_stop(void)