goToPoint()

This function can make the robot go to a certain point on the x, y plane and can snap to a certain heading using a PID Controller.

goToPoint(...)

Use this method if you want to use doubles instead of Pose2d for the target position, and also if you are fine with using the in-built localizer to get your current position.

Parameter Type

Parameter

double

Target X Position

double

Target Y Position

double

Target Heading in Radians

double

Maximum Translation Power(0 - 1)

double

Maximum Rotational Power(0 - 1)

goToPoint(...)

Use this method if you already have a Pose2d for target position, and also if you are fine with using the in-built localizer to get your current position.

Parameter Type

Parameter

Pose2d

Target Position

double

Maximum Translation Power(0 - 1)

double

Maximum Rotational Power(0 - 1)

goToPoint(...)

Use this method if you already have a Pose2d for target position, and if you are testing a custom localizer which gives you your current position.

Parameter Type

Parameter

Pose2d

Target Position

Pose2d

Current Position

double

Maximum Translation Power(0 - 1)

double

Maximum Rotational Power(0 - 1)

goToPoint(...)

Use this method if you want to use doubles instead of Pose2d, and also if you are testing a custom localizer which gives you your current position.

Parameter Type

Parameter

double

Target X Position

double

Target Y Position

double

Target Heading in Radians

double

Current X Position

double

Current Y Position

double

Current Heading in Radians

double

Maximum Translation Power(0 - 1)

double

Maximum Rotational Power(0 - 1)

This function can be called inside the OpMode using the syntax below:

//Method 1:
Robot.goToPoint(new Pose2d(30.0, 30.0, Math.PI/2), 1.0, 1.0);

//Method 2:
Robot.goToPoint(30.0, 30.0, Math.PI/2, 1.0, 1.0);

//Method 3:
Robot.goToPoint(new Pose2d(30.0, 30.0, Math.PI/2), new Pose2d(Robot.getPose().x, RObot.getPose().y, Robot.getHeading()), 1.0, 1.0);

//Method 4:
Robot.goToPoint(30.0, 30.0, Math.PI/2, Robot.getPose().x, Robot.getPose().y, Robot.getHeading(), 1.0, 1.0);

Last updated