Skip to content

Instantly share code, notes, and snippets.

View primaryobjects's full-sized avatar

Kory Becker primaryobjects

View GitHub Profile
@primaryobjects
primaryobjects / 1-quickbot.md
Last active March 10, 2019 17:44
Controlling Mobile Robots Week 3 Programming Assignment GoToGoal

GoToGoal Controller

This project implements a GoToGoal controller for the QuickBot differential drive robot.

A screenshot of the robot successfully turning and driving towards the goal coordinate can be seen below in the first image. As seen in the recording, the robot is able to quickly and smoothly turn towards the goal position. This is controlled by the value selected for the PID gain factor obj.Kp = 2 in the GoToGoal.m constructor.

If the selected value for the PID gain is too small or large, the robot may be unable to reach the goal.

Too Large PID Gain

@primaryobjects
primaryobjects / 1-face.png
Last active March 6, 2019 01:05
Drawing a face by calculating the x,y points along a circle's circumference for https://easyprog.online/ide/
1-face.png
@primaryobjects
primaryobjects / 1-quickbot-3.gif
Last active March 5, 2019 22:18
Control of Mobile Robots, Coursera - Week 2 Programming Assignment: Differential Drive Dynamics, Robot Odometry, IR Range Sensors
1-quickbot-3.gif
@primaryobjects
primaryobjects / ffnn.R
Last active November 9, 2018 02:02
Feed-Forward Neural Network for XOR written in R from scratch.
train <- list(c(0, 0, 0), c(0, 1, 1), c(1, 0, 1), c(1, 1, 0))
w1 <- 0.5
w2 <- 0.5
w3 <- w2
w4 <- w1
b1 <- 0.5
b2 <- b1
g <- 0.05
layer <- function(x1, x2) {
@primaryobjects
primaryobjects / genetic-programming.txt
Last active July 29, 2018 20:17
Evaluate a Prefix and Postfix expression. Extract a prefix subtree at a starting index. https://codepen.io/anon/pen/KBmpzr
y = f(x)
input: (x, y)
GA should generate program (tree) that calculates f(x) most correct for any value of x.
During fitness run, replace x with input value. Checkout output against correct value for y.
T: 1 2 3 4 5 x
F: + - * /
Example tree: y = 3 + 5 - x
ducci <- function(ntuple, sequence = data.frame(), depth = 0) {
# Append the first value to the end of the list.
ntupleExt <- c(ntuple, ntuple[1])
# Start the result sequence with the first ntuple.
if (nrow(sequence) == 0) {
sequence <- rbind(sequence, ntuple)
}
# Calculate the next sequence.
iBeforeE <- function(word) {
isValid <- T
word <- tolower(word)
letters <- unlist(strsplit(word, ''))
# If "ei" appears in a word, it must immediately follow "c".
indices <- unlist(gregexpr('ei', word))
if (indices != -1) {
for (index in indices) {
@primaryobjects
primaryobjects / main.R
Created June 7, 2018 18:31
Trending topics with k-means clustering in R. A basic example of natural language processing.
source('nlp.R')
dbconnection <- odbcDriverConnect("Driver=SQL Server Native Client 11.0;Server=myserver;Database=mydb;Uid=user;Pwd=pass")
# Get data.
docs <- sqlQuery(dbconnection, "SELECT * FROM Data")
docs$title <- docs$summary
odbcClose(dbconnection)