Instantly share code, notes, and snippets.

View Question1.m
%% Kent Libby question 1 matlab script
L=.2; % in meters
end_point=[6 7]; % in meters
R=5; % in meters
D=sqrt(end_point(1)^2+end_point(2)^2)
%% This calculates angle of the arc the robot travels
arc=acos((-D^2+R^2+R^2)/(2*R*R)) % in radians
dt=20 % in seconds
omega=-arc/dt
%% This finds the wheel speeds based off radius and omega
View robot.py
#!/usr/bin/env python
import math
import copy
import numpy
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import PoseStamped, Twist, Pose, PoseWithCovariance
from geometry_msgs.msg import Quaternion
View Hwk2.py
"""
@Author Kent Libby
This was compiled against python 2
To run the script use python2 Hwk2.py
"""
import random
import math
def create_array(num_items):
View KentLibby_hwk2.jl
#=
Kent Libby Homework 2, 11/03/18
=#
clearconsole()
using Plots; gr()
#=
Excercise 1.1:
1. The formula needed is V=omega(rad/s)*Diameter/2
=#
View dhOutput.m
function [DH] = dhOutput(a, alp, d, th)
DH = [cosd(th), -sind(th)*cosd(alp), sind(th)*sind(alp), a*cosd(th);
sind(th), cosd(th)*cosd(alp), -cosd(th)*sind(alp), a*sind(th);
0, sind(alp), cosd(alp), d;
0, 0, 0, 1];
end
View ikin.m
function [joints]= ikin(x, y, z)
%% TODO update these with the robot params
theta1=0;
theta2=0;
theta3=90;
curPos=zeros(3,1);
L1 = 135; L2 = 175; L3 = 169.28;
%% Creates a jacobian then uses the difference between the locations to give the theta values to move to
J1=cross([0;0;1], [L2*cosd(theta2) + L3*cosd(theta3); L2*sind(theta2)+L3*sind(theta3); L1]);
J2=cross([sind(theta1); -cosd(theta1); 0], [L2*cosd(theta2) + L3*cosd(theta3); L2*sind(theta2)+L3*sind(theta3); 0]);
View fwkin.m
%% For this function, z is defined to be the axis coming out of the plane the base is on (z is up)
%This uses degrees
function p = fwkin(t1, t2, t3)
L1=135;
L2=175;
L3=169.28;
TX12=[cosd(t1) -sind(t1) 0 0;
sind(t1) cosd(t1) 0 0;
0 0 1 L1;
0 0 0 1];
View DummyServer.cpp
#include "DummyServer.h"
void DummyServer::event(float * buffer){
for(int i = 0; i < myPumberOfPidChannels; i++)
{
buffer[(i*3)+0] = 0;
buffer[(i*3)+1] = 0;
buffer[(i*3)+2] = 0;
}