Skip to content

Commit

Permalink
Merge pull request #38 from ad101-lab/ad-remove-units
Browse files Browse the repository at this point in the history
Remove units
  • Loading branch information
alexDickhans authored Oct 27, 2021
2 parents ff7a34b + 8dfb906 commit 40912a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions include/position/odomWheel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ namespace Pronounce {
*/
class OdomWheel {
private:
double mmPosition = 0;
double position = 0;
double lastPosition = 0;
public:

/**
* Get the mm at the current moment
* Get the position at the current moment
*/
double getMM() {
return this->mmPosition;
double getPosition() {
return this->position;
}
/**
* Set the MM
* Set the position
*/
void setMM(double mmPosition) {
this->mmPosition = mmPosition;
void setPosition(double position) {
this->position = position;
}

double getChange() {
double difference = this->getMM() - this->lastPosition;
this->lastPosition = this->getMM();
double difference = this->getPosition() - this->lastPosition;
this->lastPosition = this->getPosition();
return difference;
}

Expand Down
6 changes: 3 additions & 3 deletions src/position/motorOdom.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include "motorOdom.hpp"

namespace Pronounce {
MotorOdom::MotorOdom(pros::Motor* motor, double radiusMM) {
MotorOdom::MotorOdom(pros::Motor* motor, double radius) {
this->motor = motor;
this->radius = radiusMM;
this->radius = radius;
this->motor->set_encoder_units(pros::E_MOTOR_ENCODER_ROTATIONS);
}

MotorOdom::~MotorOdom() {
}

void MotorOdom::update() {
this->setMM(motor->get_position() * radius * M_PI * 2.0 * tuningFactor);
this->setPosition(motor->get_position() * radius * M_PI * 2.0 * tuningFactor);
}
} // namespace Pronounce

0 comments on commit 40912a1

Please sign in to comment.