Skip to content

Instantly share code, notes, and snippets.

View ArchdukeTim's full-sized avatar
🏠
Working from home

Tim Winters ArchdukeTim

🏠
Working from home
View GitHub Profile
package com.qualcomm.ftcrobotcontroller.opmodes;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
/**
* Created by winterst on 9/12/15.
*/
public class Arcade extends OpMode{
DcMotor motorRight;
@ArchdukeTim
ArchdukeTim / gist:61a344ed204ef62bbc09
Created January 23, 2016 00:56
Put this in ~/.bash_profile
alias deploy="networksetup -setairportnetwork en0 1418 Fedora1418;robot;./robot.py deploy"
alias robot="cd ~/src/2016-robot/robot"
alias sim="robot;./robot.py sim"
alias pyfrc="pip3 install -U pyfrc --user"
def initialize(self):
from autonomous import SimpleAutonomous
self.obstacles = {
'LowGoal': SimpleAutonomous.LowGoal(),
'A0': SimpleAutonomous.DirectPortcullis(),
'A1': SimpleAutonomous.ChevalDeFrise()
}
@state(first = True)
def main_autonomous(self, initial_call):
if initial_call:
#! /usr/bin/env python3
import wpilib
from robotpy_ext.control import xbox_controller
import magicbot
class MyRobot(magicbot.MagicRobot):
def createObjects(self):
self.driveStick = xbox_controller.XboxController(0)
@ArchdukeTim
ArchdukeTim / Field
Last active February 20, 2016 04:31
"field": {
"w": 27,
"h": 27,
"px_per_ft": 10,
"objects": [
{ "color": "blue",
"points": [ [0, 0], [0, 4.5], [24, 4.5], [24, 0] ] },
from pyfrc.physics.drivetrains import four_motor_drivetrain
import wpilib
class PhysicsEngine:
def __init__(self, controller):
self.controller = controller
def update_sim(self, hal_data, now, tm_diff):
package com.qualcomm.ftcrobotcontroller.opmodes.autonomous;
/**
* Created by winterst on 2/11/16.
*/
public class BlueColorAuto extends StatefulAutonomous{
@timed_state(duration = 15, first = true)
public void driveForward() throws NoSuchMethodException {
tank.move(-.25f, -.25f);
while (change >= tolerance)
{
change = 0.0;
for (int i = 1; i < path.length - 1; i++)
{
for (int j = 0; j < path[i].length; j++)
{
double aux = newPath[i][j];
newPath[i][j] += (weight_data * (path[i][j] - newPath[i][j])) + (weight_smooth * (newPath[i - 1][j] + newPath[i + 1][j] - (2.0 * newPath[i][j])));
change += Math.abs(aux - newPath[i][j]);
//
// FrameExtractor.swift
// Created by Bobo on 29/12/2016.
//
import UIKit
import AVFoundation
protocol FrameExtractorDelegate: class {
func captured(image: UIImage)
//The Structures for Lines, Sets and the cache itself///
struct Line {
int valid;
unsigned long tag;
int age;
};
struct Set {
struct Line* lines;
};