2022_Ateam_MOTORprogramをscrp_slaveでメインマイコンからコントローラー状況を読み取れるように改良。 また、モータに0以外のpwmが送られている場合に基盤付属のledが点灯するようにした。
Dependencies: SBDBT arrc_mbed BNO055
TARGETco.cpp
- Committer:
- kazumayamanaka
- Date:
- 2022-01-19
- Revision:
- 0:a1238c4cd105
- Child:
- 1:ea880e226e5a
File content as of revision 0:a1238c4cd105:
#include "TARGETco.hpp" void TARGETco::pass_val(double XPOWER,double YPOWER,double THETA){ Xpower = XPOWER; Ypower = YPOWER; theta = THETA; cal_angular(); } void TARGETco::pass_target(double TARGET){ for(int i = 0;i < 4;i ++){ target[i] = TARGET; } } void TARGETco::cal_angular(){ Xvelocity = Xpower * cos(theta) - Ypower * sin(theta); Yvelocity = Xpower * sin(theta) + Ypower * cos(theta); target[0] = -Xvelocity; target[1] = -Yvelocity; target[2] = Xvelocity; target[3] = Yvelocity; } double TARGETco::obt_target1(){ return target[0]; } double TARGETco::obt_target2(){ return target[1]; } double TARGETco::obt_target3(){ return target[2]; } double TARGETco::obt_target4(){ return target[3]; }