NHK2017 octopus robot
Dependencies: 2017NHKpin_config mbed FEP ikarashiMDC PID jy901 omni HMC6352 omni_wheel
Fork of KANI2017v2 by
bot/wheel_unit/wheel_unit.cpp
- Committer:
- number_key
- Date:
- 2017-09-30
- Revision:
- 25:d199d621ecca
- Parent:
- 24:9a4ca5442717
- Child:
- 26:7258d5ad0bff
File content as of revision 25:d199d621ecca:
#include "wheel_unit.h" WheelUnit::WheelUnit(DigitalOut* RS485Controller, Serial* RS485) : Omni(4), wheels({ {RS485Controller, 0, 1, SM, RS485}, {RS485Controller, 0, 2, SM, RS485}, {RS485Controller, 0, 3, SM, RS485}, {RS485Controller, 0, 0, SM, RS485} }) { Omni::setWheelRadian(PI / 4.0, 3 * PI / 4.0, 5 * PI / 4.0, 7 * PI / 4.0); //Omni::setWheelRadian(PI / 4.0, PI / 4.0, PI / 4.0, PI / 4.0); for(int i = 0; i < 4; i++) { wheels[i].braking = true; } } void WheelUnit::moveXY(float X, float Y, float moment) { Omni::computeXY(X, Y, moment); for(int i = 0; i < 4; i++) { wheels[i].setSpeed(Omni::getOutput(i)); } } void WheelUnit::moveCircular(float r, float radian, float moment) { Omni::computeCircular(r, radian, moment); for(int i = 0; i < 4; i++) { wheels[i].setSpeed(Omni::getOutput(i)); } }