Skip to content

Instantly share code, notes, and snippets.

View cactorium's full-sized avatar

Kelvin Ly cactorium

View GitHub Profile
@cactorium
cactorium / hello.cc
Last active October 17, 2016 02:41
Fix typo
// NOTE: if you are running in an IDE, you may need to add -std=c++11
// to the compiler settings for this to compile correctly.
// GCC (which is the most common compiler suite) defaults to using an older standard of
// C++, so it won't be able to understand all the awesomecool features we're using here
// until you tell it that you want to use them
//
// A line that starts with two slashes like this is a comment!
// They're ignored by the compiler, so you can write whatever you want in them
// They're mainly used for commenting code, to better describe what's happening
// in the code if it's complicated
// Same #includes as last time, nothing new here
#include <vector>
#include <iostream>
// C++ has structs just like C!
// This defines a new type of thing, called a Point
// so you can make Points, and they'll all have these exact components
struct Point {
double x, y, z, mass;
};
@cactorium
cactorium / vectors.cc
Created October 26, 2016 22:50
Week three UCF Lunar Knights C++ notes
// so this week we're starting where we left off last week!
// we moved some of the stuff into a header file called "vectors.h"
// so check that out before moving forward
// include stuff as before
#include <vector>
#include <iostream>
// here we include our brand new header file
// note that its name is surrounded in quotes instead of brackets

Keybase proof

I hereby claim:

  • I am cactorium on github.
  • I am cactorium (https://keybase.io/cactorium) on keybase.
  • I have a public key whose fingerprint is 9872 DAA3 6680 490B CD12 D694 0DC7 89A1 5B2E 6E75

To claim this, I am signing this object:

@cactorium
cactorium / ADA4807.cir
Created June 6, 2018 02:21
Noninverting amplifier test
* ADA4807 SPICE Macro-model
* Function: Amplifier
*
* Revision History:
* Rev. 4.0 Dec 2014 -TC
* Copyright 2014 by Analog Devices
*
* Refer to http://www.analog.com/Analog_Root/static/techSupport/designTools/spicemodels/license
* for License Statement. Use of this model indicates your acceptance
* of the terms and provisions in the License Staement.
@cactorium
cactorium / texture_test.cpp
Last active July 13, 2018 21:01
OpenCV texture test
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/cuda.hpp>
#include <opencv2/core/cuda_stream_accessor.hpp>
#include <opencv2/cudev/ptr2d/glob.hpp>
void transfer_caller(cv::cudev::GlobPtrSz<float> in, cv::cudev::PtrStepSz<float> out);
@cactorium
cactorium / calc_lens.py
Created September 14, 2018 13:20
Lens configuration calculator for a simple microscope
# finds possible lens configurations to make a working microscope given a set of available lenses and a couple of other parameters
# outputs the max and min magnification of each valid lens ordering and the total length of each lens system
lens = [25.4, 25.4, 25.4, 100.0, -75.0]
eye_dist = 270.00
# each lens adds one degree of freedom to the system; it's fully constrained
# with 2 lens but every additional lens adds a DoF
# so we'll brute force it by checking every possible combination of lengths
# between 10mm and 100mm and pick the best set of valid parameters
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[
@cactorium
cactorium / lknotes.md
Last active February 27, 2019 13:38
Lunar Knights 2018 notes

So the most important thing to keep in mind when looking at ROS-based designs is that it's meant to be very modular. This hopefully simplifies the task of automotonously controlling a robot into smaller problems that are a little easier to solve, so the problem goes from "autonomously controlling a robot" to "sensing the robot's position in the environment", "moving the robot", and "figuring out where to move the robot based on its position". "Sensing the robot's position" is broken into "calculating wheel odometry", "reading from the IMU", "calculating visual odometry", and "combining all the data to get an accurate robot pose (ROS's term for position and orientation)" "Moving the robot" is broken into "calculating the commands to send to the ESCs", "sending teleop commands", "letting teleop override the autonomous controls" and "sending the commands to the ESCs over CAN" "Figuring out where to move the robot" is broken into "figuring out how to move the robot to a new pose" and "figuring out the next pose t

@cactorium
cactorium / build-notes.txt
Created November 15, 2019 03:47
Installing the Icestorm-based iCE40 toolchain using a nonstandard prefix
git clone https://github.com/cliffordwolf/icestorm.git icestorm
cd icestorm
PREFIX=~ make -j$(nproc)
PREFIX=~ sudo make install
Installing Arachne-PNR (place&route tool, predecessor to NextPNR):
git clone https://github.com/cseed/arachne-pnr.git arachne-pnr
cd arachne-pnr
PREFIX=~ make -j$(nproc)