Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 2017NHKpin_config FEP omni_wheel PID R1307 ikarashiMDC
bot/wheel_unit/wheel_unit.cpp@41:ae6f844facb1, 2017-10-21 (annotated)
- Committer:
- takeuchi
- Date:
- Sat Oct 21 14:54:16 2017 +0900
- Revision:
- 41:ae6f844facb1
- Parent:
- 24:593910fa1397
- Child:
- 53:701d5c4571e3
add noHMC drive func
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
uchitake |
9:39be1525dfe0 | 1 | #include "wheel_unit.h" |
uchitake |
9:39be1525dfe0 | 2 | |
uchitake |
9:39be1525dfe0 | 3 | WheelUnit::WheelUnit(DigitalOut* RS485Controller, Serial* RS485) : |
uchitake |
24:593910fa1397 | 4 | omni(4), |
uchitake |
9:39be1525dfe0 | 5 | wheels({ |
UCHITAKE |
11:a8385ca0a275 | 6 | ikarashiMDC({RS485Controller, 0, 0, SM, RS485}), |
UCHITAKE |
11:a8385ca0a275 | 7 | ikarashiMDC({RS485Controller, 0, 1, SM, RS485}), |
UCHITAKE |
11:a8385ca0a275 | 8 | ikarashiMDC({RS485Controller, 0, 2, SM, RS485}), |
UCHITAKE |
11:a8385ca0a275 | 9 | ikarashiMDC({RS485Controller, 0, 3, SM, RS485}) |
uchitake |
9:39be1525dfe0 | 10 | }) |
uchitake |
9:39be1525dfe0 | 11 | { |
takeuchi |
41:ae6f844facb1 | 12 | omni.wheel[0].setRadian(PI / 4.0 * 3.0); |
takeuchi |
41:ae6f844facb1 | 13 | omni.wheel[1].setRadian(PI / 4.0 * 5.0); |
takeuchi |
41:ae6f844facb1 | 14 | omni.wheel[2].setRadian(PI / 4.0 * 7.0); |
takeuchi |
41:ae6f844facb1 | 15 | omni.wheel[3].setRadian(PI / 4.0 * 1.0); |
uchitake |
9:39be1525dfe0 | 16 | for(int i = 0; i < 4; i++) { |
uchitake |
9:39be1525dfe0 | 17 | wheels[i].braking = true; |
uchitake |
9:39be1525dfe0 | 18 | } |
uchitake |
9:39be1525dfe0 | 19 | } |
uchitake |
9:39be1525dfe0 | 20 | |
uchitake |
9:39be1525dfe0 | 21 | void WheelUnit::moveXY(float X, float Y, float moment) |
uchitake |
9:39be1525dfe0 | 22 | { |
uchitake |
24:593910fa1397 | 23 | omni.computeXY(X, Y, moment); |
uchitake |
9:39be1525dfe0 | 24 | for(int i = 0; i < 4; i++) { |
uchitake |
24:593910fa1397 | 25 | wheels[i].setSpeed(omni.wheel[i]); |
uchitake |
24:593910fa1397 | 26 | } |
uchitake |
24:593910fa1397 | 27 | } |
uchitake |
24:593910fa1397 | 28 | |
uchitake |
24:593910fa1397 | 29 | void WheelUnit::moveXY(float X, float Y, float gX, float gY, float moment) |
uchitake |
24:593910fa1397 | 30 | { |
uchitake |
24:593910fa1397 | 31 | omni.computeXY(X, Y, gX, gY, moment); |
uchitake |
24:593910fa1397 | 32 | for(int i = 0; i < 4; i++) { |
uchitake |
24:593910fa1397 | 33 | wheels[i].setSpeed(omni.wheel[i]); |
uchitake |
9:39be1525dfe0 | 34 | } |
uchitake |
9:39be1525dfe0 | 35 | } |
uchitake |
9:39be1525dfe0 | 36 | |
uchitake |
9:39be1525dfe0 | 37 | void WheelUnit::moveCircular(float r, float radian, float moment) |
uchitake |
9:39be1525dfe0 | 38 | { |
uchitake |
24:593910fa1397 | 39 | omni.computeCircular(r, radian, moment); |
uchitake |
9:39be1525dfe0 | 40 | for(int i = 0; i < 4; i++) { |
uchitake |
24:593910fa1397 | 41 | wheels[i].setSpeed(omni.wheel[i]); |
uchitake |
9:39be1525dfe0 | 42 | } |
uchitake |
9:39be1525dfe0 | 43 | } |
uchitake |
24:593910fa1397 | 44 | |
uchitake |
24:593910fa1397 | 45 | void WheelUnit::moveCircular(float r, float radian, float gX, float gY, float moment) |
uchitake |
24:593910fa1397 | 46 | { |
uchitake |
24:593910fa1397 | 47 | omni.computeCircular(r, radian, gX, gY, moment); |
uchitake |
24:593910fa1397 | 48 | for(int i = 0; i < 4; i++) { |
uchitake |
24:593910fa1397 | 49 | wheels[i].setSpeed(omni.wheel[i]); |
uchitake |
24:593910fa1397 | 50 | } |
uchitake |
24:593910fa1397 | 51 | } |