Skip to content

Commit

Permalink
i cleaned code and made wheels invert in code
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamer262 committed Feb 2, 2023
1 parent e22d979 commit 16d59a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
3 changes: 0 additions & 3 deletions include/odom.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class odom{
#define YCONV 0.00037339_in

okapi::QLength rightConversion;
okapi::QLength xPosition;
okapi::QLength yPosition;
okapi::QLength xRelativeDelta;
okapi::QLength yRelativeDelta;
okapi::QLength previousRelativeX;
Expand All @@ -27,7 +25,6 @@ class odom{
Cartesian position;
void resetOdom();
void updateOdom();
double heading();
okapi::QLength getX_position();
okapi::QLength getY_position();
void printOdom();
Expand Down
8 changes: 4 additions & 4 deletions include/robotConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
inline pros::Motor left_front1_mtr(7);
inline pros::Motor left_back0_mtr(10);
inline pros::Motor left_back1_mtr(9);
inline pros::Motor right_front0_mtr(5, true);
inline pros::Motor right_front1_mtr(4, true);
inline pros::Motor right_back0_mtr(3, true);
inline pros::Motor right_back1_mtr(2, true);
inline pros::Motor right_front0_mtr(5);
inline pros::Motor right_front1_mtr(4);
inline pros::Motor right_back0_mtr(3);
inline pros::Motor right_back1_mtr(2);
inline pros::Rotation right_encoder(21);
inline pros::Rotation left_encoder(20);
inline pros::Rotation center_encoder(19);
Expand Down
2 changes: 0 additions & 2 deletions src/odom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using namespace okapi::literals;
odom::odom() {
printf("Odom Initialized");
xPosition = 0_in;
yPosition = 0_in;
position = Cartesian(0_in, 0_in);
previousRelativeY = up.get_value()*RLCONV;
previousRelativeX = sideways.get_value()*YCONV;
Expand Down
10 changes: 5 additions & 5 deletions src/robotControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ void RobotControl::raw_tank(double straightPow, double turnPow, double strafePow
left_front1_mtr = (straightPow + turnPow + strafePow)*scale;
left_back0_mtr = (straightPow + turnPow - strafePow)*scale;
left_back1_mtr = (straightPow + turnPow - strafePow)*scale;
right_front0_mtr = (straightPow - turnPow - strafePow)*scale;
right_front1_mtr = (straightPow - turnPow - strafePow)*scale;
right_back0_mtr = (straightPow - turnPow + strafePow)*scale;
right_back1_mtr = (straightPow - turnPow + strafePow)*scale;
right_front0_mtr = -((straightPow - turnPow - strafePow)*scale);
right_front1_mtr = -((straightPow - turnPow - strafePow)*scale);
right_back0_mtr = -((straightPow - turnPow - strafePow)*scale);
right_back1_mtr = -((straightPow - turnPow - strafePow)*scale);
}

void RobotControl::relStrafe(okapi::QAngle relHeading, double pow, double turn) {
Expand Down Expand Up @@ -97,7 +97,7 @@ void RobotControl::goTo(odom odom1, Cartesian to_Cartesian, okapi::QAngle robotF
if (drivePow>100) {
drivePow = 100;
}
this->headingStrafe(to_Polar.angle+180_deg, drivePow * .3 , robotFacing);
this->headingStrafe(to_Polar.angle+180_deg, drivePow * .4 , robotFacing);
}
}
//auton p looper, goes to position given and faces the bot tword heading, if you do not specify an angle the robot will face 0_rad.
Expand Down

0 comments on commit 16d59a0

Please sign in to comment.