Skip to content

Wierd issues whilst using afterTime(0, a) and waitSeconds(). (v1.0) #115

@Xtendera

Description

@Xtendera

Okay I will try to be as detailed as I can here.

I am making a autonomous program with RR v1.0. We are having some trouble understanding how our code is supposed to look.

Suppose the follow example code.

Pose2d beginPose = new Pose2d(40, 64, Math.toRadians(270));
Actions.runBlocking(drive.actionBuilder(beginPose).
                strafeTo(new Vector2d(40, 32)).
                afterTime(0, sliderAction.highBucket()).build())

Naturally, looking at this example, what the code does is pretty clear.

  1. Strafes forward 32 units.
  2. While doing the above task, it moves the slider up.

Assuming that the slider action works fine (it has been tested, it does), this is exactly what this snippet should do. In practice, it does not do this. It actually does:

  1. Strafes forward 32 units.
  2. After task 1 is completed, it moves the slider up.

Clearly, something is not working properly. After a bit of tinkering, switching the two instructions seems to fix the issue:

Actions.runBlocking(drive.actionBuilder(beginPose).
                afterTime(0, sliderAction.highBucket()).
                strafeTo(new Vector2d(40, 32)).build())

Already, this is quite odd. In the docs it is clear that afterTime is meant to be used after another instruction, not before. These results were verified with one of our sister teams who have also setup roadrunner.

Lets ramp it up a bit. Consider the following:

Actions.runBlocking(drive.actionBuilder(beginPose).
                afterTime(0, sliderAction.highBucket()).
                strafeTo(new Vector2d(40, 32)).
                waitSeconds(0.9).
                stopAndAdd(intakeAction.outake()).
                waitSeconds(0.9).
                stopAndAdd(sliderAction.reset()).
                waitSeconds(4).
                build())

For context, the intakeAction.outake() method immediately returns false, as in it turns on our intake system, then it acts like the action is done and continues to the next instruction. This means that the code should do the following, ignoring the jank solution to the first problem:

  1. Strafes forward 32 units.
  2. While doing the above task, it moves the slider up.
  3. After the two tasks above are completed, it waits 0.9 seconds
  4. After the wait, it turns on the intake motor.
  5. Immediately after the number 4 task, it waits another 0.9 seconds.
  6. Resets the slider down
  7. Waits a couple seconds for motor power.

In reality, the first waitSeconds works perfectly. The second, however, does not. It ONLY works if the wait is 1 or greater. If it is a decimal value, it does not work. Yeah, I don't really know why either.

For our sister teams, they were having similar issues (although I am not sure if it is the exact same) with their roadrunner. As soon as afterTime() is swapped out for a stopAndAdd(), everything works perfectly.

I would like some insight into this issue(s), as I am not sure where to even start debugging it.

EDIT 1: If needed, I will post a video of our robot doing whats described above on Thursday, as that is our next work day meeting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions