Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Conversation

@ShreyaRavi
Copy link
Member

Just realized I never made a pull request for this. Added ping sensors to drive to the hopper.

@ShreyaRavi ShreyaRavi requested review from 098tarik and rothso February 1, 2017 15:35
@ShreyaRavi ShreyaRavi changed the title Rothso/develop/auto Added autonomous driving code to the hoppers using the ping sensors Feb 1, 2017
@ShreyaRavi ShreyaRavi changed the title Added autonomous driving code to the hoppers using the ping sensors Added autonomous driving code to hoppers using ping sensors Feb 1, 2017
@rothso rothso mentioned this pull request Feb 3, 2017
@rothso rothso force-pushed the rothso/develop/auto branch 3 times, most recently from 9bcb438 to e7042ea Compare February 11, 2017 17:42
ShreyaRavi and others added 8 commits February 11, 2017 12:52
…ut need to add ability to add constant to the SynchronousPID @rothso.
…ce dummy values with real values and test. Fingers crossed.
…ngleHoldController. Works when not right up against ping sensor, not sure why very small readings make it go in the opposite direction. Testing needed.
@rothso rothso force-pushed the rothso/develop/auto branch from e7042ea to f084149 Compare February 11, 2017 17:52
@rothso rothso force-pushed the rothso/develop/auto branch from b52beab to 3bd2f1a Compare February 11, 2017 18:00
Copy link
Contributor

@rothso rothso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preliminary review!

I've kept in mind that this is still very much a rough draft and so your names, organization, and structure are likely temporary. I've geared my comments to be not so much about polishing a product but rather reorganizing what you currently have to reduce code duplication, standardize vocabulary, and remove dead code to repay the techinical debt of moving fast and breaking things before the very act comes to ironically slow us down.

With respect to the autonomous routine, is it safe to transition from Y to X without braking in between? I also believe we're currently running at a slow speed. Are things ready to be tested and tuned on the mock field?

public final double yDist;

Feedback(double currentAngle) {
Feedback(double currentAngle, double xDist, double yDist) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want more than two ping sensors on the bot, then these won't be xDist and yDist for long. Maybe distinguish them with left/right/front/rear instead?

gyro
);
// private static final DistanceSensor xDistPing = Hardware.DistanceSensors.digitalUltrasonic(0,1);
// private static final DistanceSensor yDistPing = Hardware.DistanceSensors.digitalUltrasonic(2,3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code. Can be removed to avoid confusion.

public void robotInit() {
Strongback.configure().recordNoEvents().recordNoData();
IO.xDistPing.setAutomaticMode(true);
IO.yDistPing.setAutomaticMode(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines are super important. I think they're better placed in a static initializer at the bottom of IO so they're closer to the ping sensor declarations. Someone in the future who wants to just copy/paste the IO class into another project may not remember to configure the ping sensors.

static {
  xDistPing.setAutomaticMode(true);
  yDistPing.setAutomaticMode(true);
}

reactor.onTriggeredSubmit(rightJoystick.getButton(3), () -> new HoldAngleCommand(drive, 135));
reactor.onTriggeredSubmit(rightJoystick.getButton(4), () -> new HoldAngleCommand(drive, 0));

reactor.onTriggeredSubmit(leftJoystick.getButton(6), () -> new DriveToYX(drive,60,66,60,0));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button 6 was being used for one of the Driving buttons. Could you find that test up there and change it to 9? Maybe move the line for 10 to be above 11 while you're at it too.

After this PR gets merged we should consider archiving some of these tests. I've got a long-term solution in mind for this button fiasco that doesn't involve attaching a piano to the DriverStation.

@Override
public void autonomousInit() {
Strongback.start();
// make sure these measurements are right
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this line? Sorry about that, looks like it was left over from the rebase.


@Override
public Drive.Signal computeSignal(Drive.Signal feedForward, Feedback feedback) {
// multiplied xSpeed by -1 because otherwise, would go in wrong direction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment out of date?

@Override
public Drive.Signal computeSignal(Drive.Signal feedForward, Feedback feedback) {
// multiplied xSpeed by -1 because otherwise, would go in wrong direction
double xSpeed = this.xTranslationPID.calculate(feedback.xDist) + this.ADDED_POWER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.ADDED_POWER might be better written as just ADDED_POWER because it's static.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On that note, how does the bot stop when the ADDED_POWER is always added? Are you relying on friction?

@Override
public boolean isOnTarget() {
return (xDistPingSensor <= hackTargetX);
// return xTranslationPID.isWithinTolerance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're good to revert the code back.

/**
* Created by shrey on 1/29/2017.
*/
public class DriveToYX extends CommandGroup {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's too early to put this into a class? This may make it harder to add more Commands to the ping sensor routine because you would have to add additional parameters to the class. I would consider removing this class and inlining the CommandGroup in Robot.java, similar to how the strafing CommandGroup is written.

private static final double ROTATION_KP = 0.008;
// private static final double ROTATION_KD = 0;
// private static final double ROTATION_KI = 0;
// private static final double ROTATION_FF = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code. Looks like it can be removed, since you've inlined all the 0s.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants