Skip to content

Commit

Permalink
grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Oct 10, 2023
1 parent f65d1c4 commit fd3d649
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void translateLegacyIfPresent(Path folderPath) {
}

// So we can't save the old config, and we couldn't copy the folder
// But we've loaded the config. So just try to delete the directory so we don't try to load
// But we've loaded the config. So just try to delete the directory, so we don't try to load
// form it next time. That does mean we have no backup recourse, tho
if (maybeCams.exists()) FileUtils.deleteDirectory(maybeCams.toPath());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.photonvision.common.util.file.JacksonUtils;

public class NetworkConfig {
// Can be a integer team number, or a IP address
// Can be an integer team number, or an IP address
public String ntServerAddress = "0";
public NetworkMode connectionType = NetworkMode.DHCP;
public String staticIp = "";
Expand Down Expand Up @@ -58,7 +58,7 @@ public NetworkConfig() {
.orElse("Wired connection 1");
}

// We can (usually) manage networking on Linux devices, and if we can we should try to. Command
// We can (usually) manage networking on Linux devices, and if we can, we should try to. Command
// line inhibitions happen at a level above this class
setShouldManage(deviceCanManageNetwork());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private void saveCameras(Connection conn) {
statement.setString(2, JacksonUtils.serializeToString(config));
statement.setString(3, JacksonUtils.serializeToString(config.driveModeSettings));

// Serializing a list of abstract classes sucks. Instead, make it into a array
// Serializing a list of abstract classes sucks. Instead, make it into an array
// of strings, which we can later unpack back into individual settings
List<String> settings =
config.pipelineSettings.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void initialize(boolean shouldManage) {
.replace(NetworkConfig.NM_IP_STRING, config.staticIp));

if (Platform.isRaspberryPi()) {
// Pi's need to manually have their interface adjusted?? and the 5 second sleep is
// Pi's need to manually have their interface adjusted?? and the 5-second sleep is
// integral in my testing (Matt)
shell.executeBashCommand(
"sh -c 'nmcli con down "
Expand All @@ -125,7 +125,7 @@ public void initialize(boolean shouldManage) {
+ config.getEscapedInterfaceName()
+ "'");
} else {
// for now just bring down /up -- more testing needed on beelink et al
// for now just bring down /up -- more testing needed on beelink et al.
shell.executeBashCommand(
"sh -c 'nmcli con down "
+ config.getEscapedInterfaceName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public NMDeviceInfo(String c, String d, String type) {
nmType = NMType.typeForString(type);
}

public final String connName; // Human readable name used by "nmcli con"
public final String connName; // Human-readable name used by "nmcli con"
public final String devName; // underlying device, used by dhclient
public final NMType nmType;

Expand Down Expand Up @@ -115,7 +115,7 @@ public static List<NMDeviceInfo> getAllInterfaces() {
}

public static List<NMDeviceInfo> getAllActiveInterfaces() {
// Seems like if a interface exists but isn't actually connected, the connection name will be an
// Seems like if an interface exists but isn't actually connected, the connection name will be an
// empty string. Check here and only return connections with non-empty names
return getAllInterfaces().stream()
.filter(it -> !it.connName.trim().isEmpty())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public int executeBashCommand(String command, boolean wait) throws IOException {

boolean success = false;
Runtime r = Runtime.getRuntime();
// Use bash -c so we can handle things like multi commands separated by ; and
// Use bash -c, so we can handle things like multi commands separated by ; and
// things like quotes, $, |, and \. My tests show that command comes as
// one argument to bash, so we do not need to quote it to make it one thing.
// Also, exec may object if it does not have an executable file as the first thing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public static Pose3d convertOpenCVtoPhotonPose(Transform3d cameraToTarget3d) {
new Rotation3d(VecBuilder.fill(1, 0, 0), Units.degreesToRadians(180));

/**
* Apply a 180 degree rotation about X to the rotation component of a given Apriltag pose. This
* Apply a 180-degree rotation about X to the rotation component of a given Apriltag pose. This
* aligns it with the OpenCV poses we use in other places.
*/
public static Transform3d convertApriltagtoOpenCV(Transform3d pose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public enum AprilTagFamily {
kTagCustom48h11;

public String getNativeName() {
// We wanna strip the leading kT and replace with "t"
// We want to strip the leading kT and replace with "t"
return this.name().replaceFirst("kT", "t");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void setExposure(double exposure) {
// If we set exposure too low, libcamera crashes or slows down
// Very weird and smelly
// For now, band-aid this by just not setting it lower than the "it breaks" limit
// Limit is different depending on camera.
// is different depending on camera.
if (sensorModel == LibCameraJNI.SensorModel.OV9281) {
if (exposure < 6.0) {
exposure = 6.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
public interface FrameProvider extends Supplier<Frame> {
String getName();

/** Ask the camera to produce a certain kind of processed image (eg HSV or greyscale) */
/** Ask the camera to produce a certain kind of processed image (e.g. HSV or greyscale) */
void requestFrameThresholdType(FrameThresholdType type);

/** Ask the camera to rotate frames it outputs */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class Calibrate3dPipe
private final Mat stdDeviationsExtrinsics = new Mat();

// Contains the re projection error of each snapshot by re projecting the corners we found and
// finding the euclidean distance between the actual corners.
// finding the Euclidean distance between the actual corners.
private final Mat perViewErrors = new Mat();

// RMS of the calibration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private List<Point> detectExtremeCornersByApproxPolyDp(TrackedTarget target, boo
we want a number between 0 and 0.16 out of a percentage from 0 to 100
so take accuracy and divide by 600
Furthermore, we know that the contour is open if we haven't done convex hulls
Furthermore, we know that the contour is open if we haven't done convex hulls,
and it has subcontours.
*/
var isOpen = !convexHull && target.hasSubContours();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected Void process(Pair<Mat, List<TrackedTarget>> in) {
jac);

if (params.redistortPoints) {
// Distort the points so they match the image they're being overlaid on
// Distort the points, so they match the image they're being overlaid on
distortPoints(tempMat, tempMat);
}

Expand All @@ -107,7 +107,7 @@ protected Void process(Pair<Mat, List<TrackedTarget>> in) {
jac);

if (params.redistortPoints) {
// Distort the points so they match the image they're being overlaid on
// Distort the points, so they match the image they're being overlaid on
distortPoints(tempMat, tempMat);
}
var topPoints = tempMat.toList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class FindBoardCornersPipe
Size imageSize;
Size patternSize;

// Configure the optimizations used while using openCV's find corners algorithm
// Since we return results in real-time, we want ensure it goes as fast as possible
// Configure the optimizations used while using OpenCV's find corners algorithm
// Since we return results in real-time, we want to ensure it goes as fast as possible
// and fails as fast as possible.
final int findChessboardFlags =
Calib3d.CALIB_CB_NORMALIZE_IMAGE
Expand Down Expand Up @@ -213,7 +213,7 @@ private Size getWindowSize(MatOfPoint2f inPoints) {
}

/**
* Find chessboard corners given a input mat and output mat to draw on
* Find chessboard corners given an input mat and output mat to draw on
*
* @return Frame resolution, object points, board corners
*/
Expand All @@ -223,7 +223,7 @@ private Triple<Size, Mat, Mat> findBoardCorners(Pair<Mat, Mat> in) {
var inFrame = in.getLeft();
var outFrame = in.getRight();

// Convert the inFrame to grayscale to increase contrast
// Convert the inFrame too grayscale to increase contrast
Imgproc.cvtColor(inFrame, inFrame, Imgproc.COLOR_BGR2GRAY);
boolean boardFound = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected List<CVShape> process(Pair<Mat, List<Contour>> in) {
Math.max(1.0, params.accuracy),
minRadius,
maxRadius);
// Great, we now found the center point of the circle and it's radius, but we have no idea what
// Great, we now found the center point of the circle, and it's radius, but we have no idea what
// contour it corresponds to
// Each contour can only match to one circle, so we keep a list of unmatched contours around and
// only match against them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class GPUAcceleratedHSVPipe extends CVPipe<Mat, Mat, HSVPipe.HSVParams> {
"",
"void main() {",
" vec2 uv = gl_FragCoord.xy/resolution;",
// Important! We do this .bgr swizzle because the image comes in as BGR but we pretend
// Important! We do this .bgr swizzle because the image comes in as BGR, but we pretend
// it's RGB for convenience+speed
" vec3 col = texture2D(texture0, uv).bgr;",
// Only the first value in the vec4 gets used for GL_RED, and only the last value gets
Expand Down Expand Up @@ -242,7 +242,7 @@ public GPUAcceleratedHSVPipe(PBOMode pboMode) {
// index for the generic position input)
gl.glBindAttribLocation(programId, 0, "position");

// Compile and setup our two shaders with our program
// Compile and set up our two shaders with our program
final int vertexId = createShader(gl, programId, k_vertexShader, GL_VERTEX_SHADER);
final int fragmentId = createShader(gl, programId, k_fragmentShader, GL_FRAGMENT_SHADER);

Expand Down Expand Up @@ -465,7 +465,7 @@ protected Mat process(Mat in) {
GLES3.GL_PIXEL_UNPACK_BUFFER,
(long) in.width() * in.height() * 3, null, GLES3.GL_STREAM_DRAW);

// Map the a buffer of GPU memory into a place that's accessible by us
// Map the buffer of GPU memory into a place that's accessible by us
var buf =
gl.glMapBufferRange(
GLES3.GL_PIXEL_UNPACK_BUFFER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class CVPipelineSettings implements Cloneable {
public ImageRotationMode inputImageRotationMode = ImageRotationMode.DEG_0;
public String pipelineNickname = "New Pipeline";
public boolean cameraAutoExposure = false;
// manual exposure only used if cameraAutoExposure if false
// manual exposure only used if cameraAutoExposure is false
public double cameraExposure = 20;
public int cameraBrightness = 50;
// Currently only used by a few cameras (notably the zero-copy Pi Camera driver) with the Gain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public CVPipelineResult process(

if (!(settings instanceof AprilTagPipelineSettings)
&& !(settings instanceof ArucoPipelineSettings)) {
// If we're processing anything other than Apriltags..
// If we're processing anything other than Apriltags...
var draw2dCrosshairResultOnOutput = draw2dCrosshairPipe.run(Pair.of(outMat, targetsToDraw));
sumPipeNanosElapsed += pipeProfileNanos[4] = draw2dCrosshairResultOnOutput.nanosElapsed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ public void setDriverMode(boolean state) {
}

/**
* Returns whether or not driver mode is active.
* Returns whether driver mode is active.
*
* @return Whether or not driver mode is active.
* @return Whether driver mode is active.
*/
public boolean getDriverMode() {
return currentPipelineIndex == DRIVERMODE_INDEX;
Expand All @@ -260,7 +260,7 @@ public boolean getDriverMode() {
/**
* Sorts the pipeline list by index, and reassigns their indexes to match the new order. <br>
* <br>
* I don't like this but I have no other ideas, and it works so
* I don't like this, but I have no other ideas, and it works so
*/
private void reassignIndexes() {
userPipelineSettings.sort(PipelineSettingsIndexComparator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public void setFov(double fov) {
var settables = visionSource.getSettables();
logger.trace(() -> "Setting " + settables.getConfiguration().nickname + ") FOV (" + fov + ")");

// Only set FOV if we have no vendor JSON and we aren't using a PiCAM
// Only set FOV if we have no vendor JSON, and we aren't using a PiCAM
if (isVendorCamera()) {
logger.info("Cannot set FOV on a vendor device! Ignoring...");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public List<VisionModule> addSources(List<VisionSource> visionSources) {

private void assignCameraIndex(List<VisionSource> config) {
// We won't necessarily have already added all the cameras we need to at this point
// But by operating on the list, we have a fairly good idea of which we need to change
// But by operating on the list, we have a fairly good idea of which we need to change,
// but it's not guaranteed that we change the correct one
// The best we can do is try to avoid a case where the stream index runs away to infinity
// since we can only stream 5 cameras at once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void calculateValues(TargetCalculationParameters params) {
params.dualOffsetValues,
params.robotOffsetPointMode);

// order of this stuff doesnt matter though
// order of this stuff doesn't matter though
m_pitch =
TargetCalculations.calculatePitch(
m_targetOffsetPoint.y, m_robotOffsetPoint.y, params.verticalFocalLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testApriltagFacingCamera() {
pipelineResult = pipeline.run(frameProvider.get(), QuirkyCamera.DefaultCamera);
printTestResults(pipelineResult);
} catch (RuntimeException e) {
// For now, will throw coz rotation3d ctor
// For now, will throw because of the Rotation3d ctor
return;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ public void testApriltagDistorted() {
pipelineResult = pipeline.run(frameProvider.get(), QuirkyCamera.DefaultCamera);
printTestResults(pipelineResult);
} catch (RuntimeException e) {
// For now, will throw coz rotation3d ctor
// For now, will throw because of the Rotation3d ctor
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void testApriltagFacingCameraAruco() {
pipelineResult = pipeline.run(frameProvider.get(), QuirkyCamera.DefaultCamera);
printTestResults(pipelineResult);
} catch (RuntimeException e) {
// For now, will throw coz rotation3d ctor
// For now, will throw because of the Rotation3d ctor
return;
}

Expand Down

0 comments on commit fd3d649

Please sign in to comment.