Girl Scouts - Everywhere!!!

Girl Scouting builds girls of courage, confidence, and character, who make the world a better place.

www.usfirst.org

For Inspiration and Recognition of Science and Technology

April 14, 2019
2:30-4:00

Engineering

Meeting to fix wheels in the code and configuration file

Attendance

Tempy H.

Task For The Day

Fix the names of the motors in the code and robot configuration.

Journey Of The Day

We fixed the names on the document for the motors. 

  • leftdrive:left_front
  • lefttwo:left_back
  • rightdrive:right_front
  • righttwo:right_back

fixed it in all of the mecanum programs.  Following is a code update snippet:

Code from Mecanum3

 

int drive_mode = 2;

if (gamepad1.right_stick_y != 0 || gamepad1.left_stick_y != 0 || gamepad1.right_stick_x != 0 || gamepad1.left_stick_x != 0) {

// scale and clip the front motors, then the aft

getJoyVals();

//updates joyvalues with deadzones, xyzw

pwr = y;

/this can be tweaked for exponential power increase

robot.right_backpwr =(Range.clip(pwr - x+z, -1, 1));

// frontright

robot.left_frontpwr =(Range.clip(pwr - x-z, -1, 1));

// backleft

robot.left_backpwr =(Range.clip(pwr + x-z, -1, 1));

// frontleft

robot.right_frontpwr =(Range.clip(pwr + x+z, -1, 1));

// backright

robot.status = 0;

setDrivePower( robot.left_frontpwr, robot.right_frontpwr, robot.left_backpwr, robot.right_backpwr, drive_mode);

// write the values to the motors

} else {

robot.right = 0;

robot.left = 0;

// scale the joystick value to make it easier to control

// the robot more precisely at slower speeds.

robot.right_frontpwr = (float) scaleInput(robot.right);

robot.left_frontpwr = (float) scaleInput(robot.left);

robot.right_backpwr = (float) scaleInput(robot.right);

robot.left_backpwr = (float) scaleInput(robot.left);

// write the values to the motors

etDrivePower( robot.left_frontpwr, robot.right_frontpwr, robot.left_backpwr, robot.right_backpwr, drive_mode);

}

public void setDrivePower(float leftPower, float rightPower, float leftPower2, float rightPower2, int power_mode) {

// telemetry.addData("2", format("PM - %d", power_mode));

// telemetry.update();

if (power_mode == 2) {

  // set front and back motors full power

  robot.right_front.setPower(rightPower);

  robot.left_front.setPower(leftPower);

  robot.right_back.setPower(rightPower2);

  robot.left_back.setPower(leftPower2);

  } else if (power_mode == 1) {

  // set front motors

  robot.right_front.setPower(0);

  robot.left_back.setPower(0);

  robot.right_back.setPower(0);

  robot.left_back.setPower(0);

  } else {

  // set front motors

  robot.right_front.setPower(0);

  robot.left_front.setPower(0);

  robot.right_back.setPower(0);

  robot.left_back.setPower(0);

  }

}