Rleg  2
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Macros | Functions
ui.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UI_NCURSES_MODE   2
 
#define UI_MODULE_ENABLED   1
 
#define UI_DEBUG_MODE   0
 
#define SUCCESS   1
 
#define FAILURE   -1
 

Functions

int ui_init (void)
 Initialize UI. More...
 
int ui_close (void)
 Close UI. More...
 
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. More...
 
int ui_imu_data (IMU_DATA_STRUCT *pimu_data)
 Print IMU data. More...
 
int ui_eff_data (EFF_DATA_STRUCT *peff_data)
 
int ui_enc_data (ENC_DATA_STRUCT *enc_data)
 Print ENCODER data. More...
 
int ui_mra_data (MRA_DATA_STRUCT *pmra_data)
 Print MRA data. More...
 
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. More...
 
int ui_menu ()
 Print the menu. More...
 

Macro Definition Documentation

#define FAILURE   -1

Definition at line 11 of file ui.h.

#define SUCCESS   1

Definition at line 10 of file ui.h.

#define UI_DEBUG_MODE   0

Definition at line 8 of file ui.h.

#define UI_MODULE_ENABLED   1

Definition at line 7 of file ui.h.

#define UI_NCURSES_MODE   2

Definition at line 5 of file ui.h.

Referenced by periodic_task_2(), and threads_linux_periodic_task_2().

Function Documentation

int ui_eff_data ( EFF_DATA_STRUCT peff_data)

Definition at line 163 of file ui.c.

References EFF_DATA_STRUCT::F, EFF_DATA_STRUCT::M, SUCCESS, DATA_XYZ::x, DATA_XYZ::y, and DATA_XYZ::z.

Referenced by ui_update().

164 {
165  mvprintw(2,0,"Fx (bits): %d",peff_data->F.x);
166  //mvprintw(2,40,"Fx (N): %lf",peff_data->??);
167  mvprintw(3,0,"Fy (bits): %d",peff_data->F.y);
168  //mvprintw(3,40,"Fx (N): %lf",peff_data->??);
169  mvprintw(4,0,"Fz (bits): %d",peff_data->F.z);
170  //mvprintw(4,40,"Fx (N): %lf",peff_data->??);
171  mvprintw(5,0,"Mx (bits): %d",peff_data->M.x);
172  //mvprintw(5,40,"Mx (Nm): %lf",peff_data->??);
173  mvprintw(6,0,"My (bits): %d",peff_data->M.y);
174  //mvprintw(6,40,"My (Nm): %lf",peff_data->??);
175  mvprintw(7,0,"Mz (bits): %d",peff_data->M.z);
176  //mvprintw(7,40,"Mz (Nm): %lf",peff_data->??);
177 
178  return SUCCESS;
179 }
short int y
Definition: communication.h:77
#define SUCCESS
Definition: calibration.h:6
short int z
Definition: communication.h:78
short int x
Definition: communication.h:76

Here is the caller graph for this function:

int ui_enc_data ( ENC_DATA_STRUCT enc_data)

Print ENCODER data.

Definition at line 181 of file ui.c.

References ENC_DATA_STRUCT::calib, ENC_DATA_STRUCT::position, ENC_DATA_STRUCT::calibrate::position, and SUCCESS.

Referenced by ui_update().

182 {
183  mvprintw(2,0,"Position (raw): %lf",enc_data->position);
184  mvprintw(3,0,"Position (degree): %lf",enc_data->calib.position);
185  return SUCCESS;
186 }
#define SUCCESS
Definition: calibration.h:6
struct ENC_DATA_STRUCT::calibrate calib
unsigned short int position
unsigned short int position

Here is the caller graph for this function:

int ui_menu ( )

Print the menu.

Definition at line 264 of file ui.c.

References SUCCESS.

Referenced by ui_update().

264  {
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");
272 
273  return SUCCESS;
274 }
#define SUCCESS
Definition: calibration.h:6

Here is the caller graph for this function:

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.

Definition at line 197 of file ui.c.

References IMU_DATA_STRUCT::acc, IMU_DATA_STRUCT::calibrated::acc, ENC_DATA_STRUCT::calib, IMU_DATA_STRUCT::calib, IMU_DATA_STRUCT::calib_temp, DATALOGGER_NOT_RUNNING, datalogger_status(), get_time(), IMU_DATA_STRUCT::gyr, IMU_DATA_STRUCT::calibrated::gyr, IMU_DATA_STRUCT::mag, IMU_DATA_STRUCT::calibrated::mag, ENC_DATA_STRUCT::position, ENC_DATA_STRUCT::calibrate::position, SUCCESS, t0, IMU_DATA_STRUCT::temp, MRA_DATA_STRUCT::v_ctl, MRA_DATA_STRUCT::v_ctl_read, DATA_XYZ::x, DATA_XYZ_DOUBLE::x, DATA_XYZ::y, DATA_XYZ_DOUBLE::y, DATA_XYZ::z, and DATA_XYZ_DOUBLE::z.

Referenced by ui_update().

198 {
199  float error_rate = 0.0;
200  double t = 0.0;
201  double Ts = 0.0;
202  double mean_exec_time = 0.0;
203  double t0 = 0.0;
204 
205  get_time(&t, &Ts, &mean_exec_time, &t0);
206 
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);
209 
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);
213 
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);
217 
218  mvprintw(12, 0, "Temp (bits): %d", pimu_data->temp);
219  mvprintw(12,40, "Temp (ÂșC): %lf", pimu_data->calib_temp);
220 
221  mvprintw(13,0, "Encoder (bits):\t%d",enc_data->position);
222  mvprintw(13,40, "Encoder (degree):\t%d",enc_data->calib.position);
223  //mvprintw(15,0,"Fx (bits): %d",peff_data->F.x);
224 
225  //mvprintw(2,40,"Fx (N): %lf",peff_data->??);
226  //mvprintw(15,0,"Fy (bits): %d",peff_data->F.y);
227  //mvprintw(3,40,"Fx (N): %lf",peff_data->??);
228  //mvprintw(16,0,"Fz (bits): %d",peff_data->F.z);
229  //mvprintw(4,40,"Fx (N): %lf",peff_data->??);
230  //mvprintw(17,0,"Mx (bits): %d",peff_data->M.x);
231  //mvprintw(5,40,"Mx (Nm): %lf",peff_data->??);
232  //mvprintw(18,0,"My (bits): %d",peff_data->M.y);
233  //mvprintw(6,40,"My (Nm): %lf",peff_data->??);
234  //mvprintw(19,0,"Mz (bits): %d",peff_data->M.z);
235  //mvprintw(7,40,"Mz (Nm): %lf",peff_data->??);
236 
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);
239 
240  mvprintw(18, 0, "Runtime: %4.2lf", t);
241 
243  {
244  mvprintw(18, 40, "Datalogger stopped");
245  }
246  else
247  {
248  mvprintw(18, 40, "Datalogger runtime: %4.2lf", (t-t0));
249  }
250 /*
251  if(calibration_get_status() == CALIBRATION_NOT_RUNNING)
252  {
253  mvprintw(15, 0, "Calibration stopped");
254  }
255  else
256  {
257  mvprintw(15, 0, "Calibration running");
258  }
259 */
260 
261  return SUCCESS;
262 }
int t0
Definition: main.c:40
short int y
Definition: communication.h:77
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:
Definition: main.c:167
DATA_XYZ mag
Magnetormeter Vector.
Definition: communication.h:96
short int v_ctl_read
Voltage level read from the actuator.
DATA_XYZ acc
Accel Vector.
Definition: communication.h:94
#define SUCCESS
Definition: calibration.h:6
struct ENC_DATA_STRUCT::calibrate calib
#define DATALOGGER_NOT_RUNNING
Definition: datalogger.h:29
short int z
Definition: communication.h:78
unsigned short int position
unsigned short int position
struct IMU_DATA_STRUCT::calibrated calib
DATA_XYZ gyr
Gyrometer Vector.
Definition: communication.h:95
short int x
Definition: communication.h:76
short int v_ctl
Voltage level for control output.
int datalogger_status(void)
Definition: datalogger.c:571
int total
Definition: main.c:35

Here is the call graph for this function:

Here is the caller graph for this function: