Skip to content

Commit

Permalink
fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
j5155 committed Sep 20, 2024
1 parent f983193 commit cf9c062
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package org.firstinspires.ftc.teamcode;

import com.acmerobotics.roadrunner.Pose2d;
import com.acmerobotics.roadrunner.PoseVelocity2d;
import com.acmerobotics.roadrunner.ftc.GoBildaPinpointDriver;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
Expand Down Expand Up @@ -157,18 +158,18 @@ of time each cycle takes and finds the frequency (number of updates per second)


/*
gets the current Position (x & y in mm, and heading in degrees) of the robot, and prints it.
gets the current Position (x & y in inches, and heading in radians) of the robot, and prints it.
*/
Pose2d pos = odo.getPosition();
String data = String.format(Locale.US, "{X: %.3f, Y: %.3f, H: %.3f}", pos.position.x, pos.position.y, pos.heading.toDouble());
telemetry.addData("Position", data);


/*
gets the current Velocity (x & y in mm/sec and heading in degrees/sec) and prints it.
gets the current Velocity (x & y in inches/sec and heading in radians/sec) and prints it.
*/
Pose2d vel = odo.getVelocity();
String velocity = String.format(Locale.US,"{XVel: %.3f, YVel: %.3f, HVel: %.3f}", vel.position.x, vel.position.y, vel.heading.toDouble());
PoseVelocity2d vel = odo.getVelocity();
String velocity = String.format(Locale.US,"{XVel: %.3f, YVel: %.3f, HVel: %.3f}", vel.linearVel.x, vel.linearVel.y, vel.angVel);
telemetry.addData("Velocity", velocity);

telemetry.addData("X Encoder:", odo.getEncoderX()); //gets the raw data from the X encoder
Expand Down

0 comments on commit cf9c062

Please sign in to comment.