2019-10-27 18:23:03 +01:00
|
|
|
#ifndef TRAPQ_H
|
|
|
|
#define TRAPQ_H
|
|
|
|
|
2019-10-27 23:50:53 +01:00
|
|
|
#include "list.h" // list_node
|
|
|
|
|
2019-10-27 18:23:03 +01:00
|
|
|
struct coord {
|
2019-11-02 03:53:00 +01:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
double x, y, z;
|
|
|
|
};
|
|
|
|
double axis[3];
|
|
|
|
};
|
2019-10-27 18:23:03 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct move {
|
|
|
|
double print_time, move_t;
|
2019-11-05 21:42:19 +01:00
|
|
|
double start_v, half_accel;
|
2019-10-27 18:23:03 +01:00
|
|
|
struct coord start_pos, axes_r;
|
2019-10-27 23:50:53 +01:00
|
|
|
|
|
|
|
struct list_node node;
|
2019-10-27 18:23:03 +01:00
|
|
|
};
|
|
|
|
|
2019-10-27 23:50:53 +01:00
|
|
|
struct trapq {
|
2021-07-19 17:32:16 +02:00
|
|
|
struct list_head moves, history;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pull_move {
|
|
|
|
double print_time, move_t;
|
|
|
|
double start_v, accel;
|
|
|
|
double start_x, start_y, start_z;
|
|
|
|
double x_r, y_r, z_r;
|
2019-10-27 23:50:53 +01:00
|
|
|
};
|
|
|
|
|
2019-10-29 17:44:39 +01:00
|
|
|
struct move *move_alloc(void);
|
|
|
|
void trapq_append(struct trapq *tq, double print_time
|
|
|
|
, double accel_t, double cruise_t, double decel_t
|
|
|
|
, double start_pos_x, double start_pos_y, double start_pos_z
|
2019-11-06 14:41:50 +01:00
|
|
|
, double axes_r_x, double axes_r_y, double axes_r_z
|
2019-10-29 17:44:39 +01:00
|
|
|
, double start_v, double cruise_v, double accel);
|
|
|
|
double move_get_distance(struct move *m, double move_time);
|
|
|
|
struct coord move_get_coord(struct move *m, double move_time);
|
2019-10-27 23:50:53 +01:00
|
|
|
struct trapq *trapq_alloc(void);
|
|
|
|
void trapq_free(struct trapq *tq);
|
2019-11-01 23:32:06 +01:00
|
|
|
void trapq_check_sentinels(struct trapq *tq);
|
2019-10-27 23:50:53 +01:00
|
|
|
void trapq_add_move(struct trapq *tq, struct move *m);
|
2021-07-19 17:12:58 +02:00
|
|
|
void trapq_finalize_moves(struct trapq *tq, double print_time);
|
2021-07-23 18:46:14 +02:00
|
|
|
void trapq_set_position(struct trapq *tq, double print_time
|
|
|
|
, double pos_x, double pos_y, double pos_z);
|
2021-07-19 17:32:16 +02:00
|
|
|
int trapq_extract_old(struct trapq *tq, struct pull_move *p, int max
|
|
|
|
, double start_time, double end_time);
|
2019-10-27 23:50:53 +01:00
|
|
|
|
2019-10-27 18:23:03 +01:00
|
|
|
#endif // trapq.h
|