Skip to content

Instantly share code, notes, and snippets.

View codeNinjaDev's full-sized avatar
💭
We are the times: Such as we are, such are the times.

Peter Chacko codeNinjaDev

💭
We are the times: Such as we are, such are the times.
View GitHub Profile
package org.firstinspires.ftc.teamcode;
import org.opencv.core.*;
import org.opencv.imgproc.Imgproc;
import org.openftc.easyopencv.OpenCvPipeline;
import java.util.*;
import java.util.stream.Collectors;
public class UGBasicHighGoalPipeline extends OpenCvPipeline {
from requests_oauthlib import OAuth2Session
import json
from time import time
import requests
class Gmail_API:
def __init__(self, scope=['https://mail.google.com/',
'https://www.googleapis.com/auth/gmail.send',
"https://www.googleapis.com/auth/gmail.readonly"], default_token=None):
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot.commands;
import edu.wpi.first.wpilibj2.command.CommandBase;
package frc.robot.subsystems;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX;
import edu.wpi.first.wpilibj.CounterBase;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.controller.PIDController;
import edu.wpi.first.wpilibj.controller.SimpleMotorFeedforward;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
package com.arcrobotics.ftclib.command.commands;
import com.arcrobotics.ftclib.command.Command;
import com.arcrobotics.ftclib.controller.wpilibcontroller.PIDController;
import com.arcrobotics.ftclib.controller.wpilibcontroller.ProfiledPIDController;
import com.arcrobotics.ftclib.controller.wpilibcontroller.SimpleMotorFeedforward;
import com.arcrobotics.ftclib.geometry.Pose2d;
import com.arcrobotics.ftclib.kinematics.wpilibkinematics.ChassisSpeeds;
import com.arcrobotics.ftclib.kinematics.wpilibkinematics.MecanumDriveKinematics;
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.subsystems.VuSubsystem;
public class VuSubsystemSample extends LinearOpMode {
VuSubsystem vu;
package org.firstinspires.ftc.teamcode;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.openftc.easyopencv.OpenCvPipeline;
package org.firstinspires.ftc.teamcode;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.imgproc.Imgproc;
import org.openftc.easyopencv.OpenCvPipeline;
package org.firstinspires.ftc.teamcode;
import com.arcrobotics.ftclib.geometry.Pose2d;
import com.arcrobotics.ftclib.geometry.Rotation2d;
import com.arcrobotics.ftclib.geometry.Twist2d;
import org.firstinspires.ftc.robotcore.external.navigation.Rotation;
public class WPIMecanumOdometry {
double prevLeftEncoder, prevRightEncoder, prevCenterEncoder;
# Draws Contours and finds center and yaw of ball
# centerX is center x coordinate of image
# centerY is center y coordinate of image
def findBall(contours, image, centerX, centerY):
screenHeight, screenWidth, channels = image.shape;
#Seen vision targets (correct angle, adjacent to each other)
ball = []
if len(contours) > 0:
#Sort contours by area size (biggest to smallest)