You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 line
1.4KB

  1. #ifndef CONTROLLER_H
  2. #define CONTROLLER_H
  3. #include "event.h"
  4. #include "gb_math.h"
  5. #include "stepper.h"
  6. #include "path.h"
  7. #include "angle.h"
  8. #define VEL_DIV 1024
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. enum {
  13. CONTROLLER_OK = 0,
  14. CONTROLLER_ERR = -1,
  15. CONTROLLER_NO_PATH = -2,
  16. CONTROLLER_STATISFIED = -3,
  17. };
  18. typedef struct {
  19. stepper_t *stepper_a;
  20. stepper_t *stepper_b;
  21. uint32_t time_step;
  22. path_t *path;
  23. thread_flags_t flags;
  24. } controller_t;
  25. /**
  26. * @brief Initialize controller
  27. *
  28. * @param[out] control struct describing the controller
  29. */
  30. int controller_init(controller_t *control);
  31. /**
  32. * @brief execute main loop of the controller
  33. *
  34. * @param[in] control struct describing the controller
  35. */
  36. int controller_loop(controller_t *control);
  37. //void controller_update(event_t *event);
  38. //int controller_setpoint(controller_t *control, gbVec2 *point);
  39. //
  40. //void controller_inverse_kinematics(controller_t *control, gbVec2 *point, float *angle1, float *angle2);
  41. //
  42. //void controller_current_position(controller_t *control, gbVec2 *point);
  43. //
  44. //int controller_calculate_velocity(controller_t *control);
  45. //
  46. //int controller_sub_setpoint(controller_t *control, gbVec2 *setpoint, float distance);
  47. /**
  48. * @brief home both stepper motors
  49. *
  50. * @param[in] control struct describing the controller
  51. */
  52. int controller_home(controller_t *control);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif /* CONTROLLER_H */