Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove units #38

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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