aboutsummaryrefslogtreecommitdiff
path: root/src/rate.h
blob: b75b06451be66d8ee05a747594358dd1b3a41120 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef INCLUDED_RATE_H
#define INCLUDED_RATE_H

#include "motion_planner.h"

struct work_motion_stats {
  double dt;

  double active_time;              /* s */
  double active_length;            /* mm */
  uint32_t active_segment_count;
  uint32_t sample_count;

  /*
   * Отклонение скорости на рабочих участках.
   *
   * Ошибка считается как:
   *   e(t) = sample.v - segment.v_nominal
   */
  double speed_error_max_abs;       /* mm/s */
  double speed_error_mean_abs;      /* mm/s */
  double speed_error_rms;           /* mm/s */

  double speed_error_abs_integral;  /* mm, т.к. integral |e| dt */
  double speed_error_sq_integral;   /* mm^2/s, т.к. integral e^2 dt */

  /*
   * Общий рывок на рабочих участках.
   *
   * Используется sample.j_abs, то есть модуль полного векторного рывка,
   * а не только тангенциальный j_t.
   */
  double jerk_abs_integral;         /* mm/s^2, т.к. integral |j| dt */
  double jerk_abs_mean;             /* mm/s^3 */
  double jerk_abs_max;              /* mm/s^3 */
};

struct work_motion_stats measure_work_motion_stats (const struct path *, const struct motion_plan *, double dt);

#endif // INCLUDED_RATE_H