あーちゃん制御
Dependencies: FastPWM cal_PID mbed nucleo_rotary_encoder
Diff: omuni/omuni.hpp
- Revision:
- 0:4346c5764e83
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omuni/omuni.hpp Mon Sep 25 08:16:54 2017 +0000 @@ -0,0 +1,36 @@ +#ifndef _omuni_ +#define _omuni_ + +#include "speed_control.hpp" + +#define THETA_ADDJUST 0.69f + +class Omuni +{ +private: + I2C *i2c; + speed_control *o[3]; + Timer time, t; + float tvx, tvy, tomega; + float vx, vy, omega, theta; + float R, d; + int addr[3]; + float v[3]; + bool f; +public: + Omuni(I2C *i, TIM_TypeDef *timer_type0, TIM_TypeDef *timer_type1, TIM_TypeDef *timer_type2, size_t pulse_per_revol, float _cy_ms, const int a[3], float _R, float _d); + void set_pid(int n, float _kp, float _ki, float _kd); + void set_speed(float vx, float vy); + void set_speed(float vx, float vy, float omega); + void set_speed(float _vx, float _vy, float _omega, bool _f); + void renew_theta(); + bool renew_speed(); + void _set_speed(); + void drive(); + void reset_theta(); + float get_theta(); + float get_vx(); + float get_vy(); +}; + +#endif