CityU Dream Development

Dependencies:   mbed ros_lib_melodic

Committer:
bensonsinsin998
Date:
Thu Feb 25 07:41:29 2021 +0000
Revision:
0:c2b6f8b48076
hi

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bensonsinsin998 0:c2b6f8b48076 1 // Mbed Library
bensonsinsin998 0:c2b6f8b48076 2 #include <vector>
bensonsinsin998 0:c2b6f8b48076 3 // Header File
bensonsinsin998 0:c2b6f8b48076 4 #include "OmniWheel.h"
bensonsinsin998 0:c2b6f8b48076 5
bensonsinsin998 0:c2b6f8b48076 6 using namespace std;
bensonsinsin998 0:c2b6f8b48076 7
bensonsinsin998 0:c2b6f8b48076 8 // Constructor
bensonsinsin998 0:c2b6f8b48076 9 OmniWheel::OmniWheel() {
bensonsinsin998 0:c2b6f8b48076 10 }
bensonsinsin998 0:c2b6f8b48076 11
bensonsinsin998 0:c2b6f8b48076 12 // Destructor
bensonsinsin998 0:c2b6f8b48076 13 OmniWheel::~OmniWheel() {
bensonsinsin998 0:c2b6f8b48076 14 }
bensonsinsin998 0:c2b6f8b48076 15
bensonsinsin998 0:c2b6f8b48076 16 // Function
bensonsinsin998 0:c2b6f8b48076 17 void OmniWheel::clear() {
bensonsinsin998 0:c2b6f8b48076 18 this->vel.clear();
bensonsinsin998 0:c2b6f8b48076 19 this->rpm.clear();
bensonsinsin998 0:c2b6f8b48076 20 this->pwm.clear();
bensonsinsin998 0:c2b6f8b48076 21 }
bensonsinsin998 0:c2b6f8b48076 22
bensonsinsin998 0:c2b6f8b48076 23 // -> Getter
bensonsinsin998 0:c2b6f8b48076 24 int OmniWheel::getWheelNum() {
bensonsinsin998 0:c2b6f8b48076 25 return this->wheel_num;
bensonsinsin998 0:c2b6f8b48076 26 }
bensonsinsin998 0:c2b6f8b48076 27
bensonsinsin998 0:c2b6f8b48076 28 vector<double> OmniWheel::getVel() {
bensonsinsin998 0:c2b6f8b48076 29 return this->vel;
bensonsinsin998 0:c2b6f8b48076 30 }
bensonsinsin998 0:c2b6f8b48076 31
bensonsinsin998 0:c2b6f8b48076 32 vector<double> OmniWheel::getRpm() {
bensonsinsin998 0:c2b6f8b48076 33 return this->rpm;
bensonsinsin998 0:c2b6f8b48076 34 }
bensonsinsin998 0:c2b6f8b48076 35
bensonsinsin998 0:c2b6f8b48076 36 vector<double> OmniWheel::getPwm() {
bensonsinsin998 0:c2b6f8b48076 37 return this->pwm;
bensonsinsin998 0:c2b6f8b48076 38 }
bensonsinsin998 0:c2b6f8b48076 39
bensonsinsin998 0:c2b6f8b48076 40 // -> Setter
bensonsinsin998 0:c2b6f8b48076 41 void OmniWheel::setWheelNum(int _wheel_num) {
bensonsinsin998 0:c2b6f8b48076 42 this->wheel_num = _wheel_num;
bensonsinsin998 0:c2b6f8b48076 43 }
bensonsinsin998 0:c2b6f8b48076 44
bensonsinsin998 0:c2b6f8b48076 45 void OmniWheel::setVel(double _vel) {
bensonsinsin998 0:c2b6f8b48076 46 this->vel.push_back(_vel);
bensonsinsin998 0:c2b6f8b48076 47 }
bensonsinsin998 0:c2b6f8b48076 48
bensonsinsin998 0:c2b6f8b48076 49 void OmniWheel::setRpm(double _rpm) {
bensonsinsin998 0:c2b6f8b48076 50 this->rpm.push_back(_rpm);
bensonsinsin998 0:c2b6f8b48076 51 }
bensonsinsin998 0:c2b6f8b48076 52
bensonsinsin998 0:c2b6f8b48076 53 void OmniWheel::setPwm(double _pwm) {
bensonsinsin998 0:c2b6f8b48076 54 this->pwm.push_back(_pwm);
bensonsinsin998 0:c2b6f8b48076 55 }