Skip to content

Instantly share code, notes, and snippets.

View PeterJohnson's full-sized avatar

Peter Johnson PeterJohnson

  • Pasadena, California
View GitHub Profile
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.util.sendable;
/**
* Interface for sendable objects.
*
* <p>Idiomatically, classes that support sendable operation should provide a static final
@PeterJohnson
PeterJohnson / lvrt
Created March 27, 2023 03:52
lvrt shell script
#!/bin/sh
exec 2>&1 >/dev/null
while true; do
APP_PATH=`nirtcfg --file /etc/natinst/share/lvrt.conf --get section=LVRT,token=RTTarget.ApplicationPath`
if [ "$APP_PATH" = /home/lvuser/natinst/bin/TBLStartupApp.rtexe ]
then
APP_BOOT=`nirtcfg --file /etc/natinst/share/lvrt.conf --get section=LVRT,token=RTTarget.LaunchAppAtBoot,value=true | tr "[:upper:]" "[:lower:]"`
APP_DISABLED=`nirtcfg --get section=SYSTEMSETTINGS,token=NoApp.enabled,value=false | tr "[:upper:]" "[:lower:]"`
if [ "$APP_BOOT" = true ] && [ "$APP_DISABLED" = false ]
then
@PeterJohnson
PeterJohnson / MyRobot.cpp
Created February 15, 2020 06:44
Thanksgiving LED
#include <cstring>
#include <vector>
#include <frc/AddressableLED.h>
#include <frc/TimedRobot.h>
static const char* msg[8] = {
"* * ***** ***** ***** * * ***** * * ***** * * * * ***** ***** ***** * * ***** * * ***** * 2 3 ",
"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 3 ",
"* * * * * * * * * * * * * * * ** * * * * * * * * * ** * * * 2 3 ",
#pragma once
#include <initializer_list>
#include <unordered_map>
#include "SendableCommandBase.h"
#include "CommandGroupBase.h"
#include "PrintCommand.h"
namespace frc {
public class Slow3 {
private static double freememory = 0.0;
private static double m_a = 1.0;
private static double m_b = 2.0;
private static double m_c = 3.0;
private static double m_d = 4.0;
private static double m_e = 5.0;
private static double m_f = 6.0;
private static double m_g = 7.0;
@PeterJohnson
PeterJohnson / laptop-stats.txt
Created September 11, 2017 03:16
libuv stats comparison
1..50
ok 1 - sizes
# uv_shutdown_t: 80 bytes
# uv_write_t: 192 bytes
# uv_connect_t: 96 bytes
# uv_udp_send_t: 320 bytes
# uv_tcp_t: 248 bytes
# uv_pipe_t: 264 bytes
# uv_tty_t: 312 bytes
# uv_prepare_t: 120 bytes
@PeterJohnson
PeterJohnson / CameraServer.h
Created November 17, 2016 06:56
CameraServer API
class CameraServer : public ErrorBase {
public:
static constexpr uint16_t kBasePort = 1181;
static constexpr int kSize640x480 = 0;
static constexpr int kSize320x240 = 1;
static constexpr int kSize160x120 = 2;
public:
static CameraServer* GetInstance();
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
evaluationDependsOn(':wpilibj')
mainClassName = 'edu.wpi.first.wpilibj.RobotBase'
buildscript {
repositories { jcenter() }
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.AnalogOutput;
import edu.wpi.first.wpilibj.IterativeRobot;
@SuppressWarnings("all")
public class MyRobot extends IterativeRobot {
AnalogInput a0, a1, a2, a3;
AnalogOutput aout0;
public void robotInit() {
a0 = new AnalogInput(0);
> Building 93% > :ui:jfxRunJul 29, 2016 4:29:53 PM java.util.logging.LogManager$RootLogger log
CONFIG: Configuration done.
Jul 29, 2016 4:29:53 PM java.util.logging.LogManager$RootLogger log
CONFIG: GRIP Version: 1.4.0-56-g58635d3
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in Application init method
java.lang.reflect.InvocationTargetException