Bayley Wang
/
priustroller_3
temp repo
Fork of priustroller_2 by
motor.cpp
- Committer:
- nki
- Date:
- 2015-03-04
- Revision:
- 6:99ee0ce47fb2
- Parent:
- 1:1f58bdcf2956
- Child:
- 7:76d6ceb23e0d
File content as of revision 6:99ee0ce47fb2:
#include "includes.h" #include "core.h" #include "sensors.h" Motor::Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t) { _sense_c = sense_c; _sense_b = sense_b; _sense_p = sense_p; _sense_t = sense_t; UpdateState(); } float Motor::UpdateCurrentC() { return I_c = _sense_c->GetCurrent(); } float Motor::UpdateCurrentB() { return I_b = _sense_b->GetCurrent(); } float Motor::UpdatePosition() { return angle = _sense_p->GetPosition(); } float Motor::UpdateTemp() { return temp = _sense_t->GetTemp(); } void Motor::UpdateState() { UpdateCurrentC(); UpdateCurrentB(); UpdatePosition(); } void Motor::Config(int num_poles, float kv) { _num_poles = num_poles; _kv = kv; }