Skip to content

Instantly share code, notes, and snippets.

View soulslicer's full-sized avatar

Raaj soulslicer

  • Carnegie Mellon University Robotics Institute
View GitHub Profile
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 331.62 (buildmeister@swio-display-x64-rhel04-19) Wed Mar 19 18:42:16 PDT 2014
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import *
import sys
name = 'OpenGL Python Teapot'
def main():
glutInit(sys.argv)
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
@soulslicer
soulslicer / GPU-EC2.sh
Created July 9, 2014 21:17
OpenCL on GPU instance
# This script installs everything you need on an EC2 GPU Instance
# Create an Ubuntu 12.04 GPU Instance with at least 16GB of free space
# Base packages
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install gcc git cmake
# CUDA/Nvidia installations
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1204/x86_64/cuda-repo-ubuntu1204_6.0-37_amd64.deb
@soulslicer
soulslicer / capture.cpp
Last active August 29, 2015 14:17
C920 Capture header
//#define DEBUG
#define MB(x) (x*1024*1024)
#include "c920capture.h"
//Callback for process frame
int process_frame(void* data, size_t length, c920_parameters_t c920_parameters)
{
static long bytes = 0;
static long fcount = 0;
@soulslicer
soulslicer / sonar-rtheta
Created March 18, 2015 14:51
Sonar RTheta
bool sonar_pixel(sonar::sonar_pixel::Request &req, sonar::sonar_pixel::Response &rsp)
{
int row = ((double)(req.y) / HEIGHT) * BVTMagImage_GetHeight(rangeImage);
int col = ((double)(req.x) / WIDTH) * BVTMagImage_GetWidth(rangeImage);
rsp.range = BVTMagImage_GetPixelRange(rangeImage, (int)row, (int)col);
rsp.bearing = BVTMagImage_GetPixelRelativeBearing(rangeImage, (int)row, (int)col);
ROS_INFO("range bearing for pixel [%d %d] = [%f %f]", req.x, req.y, rsp.range, rsp.bearing);
}
clear ; close all; clc
sonarmap = importdata('sonarmap.mat');
A=[];b=[];
xarr = [];yarr = [];rarr = [];tarr = [];
for i=1:size(sonarmap,1),
x = sonarmap(i,1) - 196;
@soulslicer
soulslicer / thetamap.m
Created March 18, 2015 15:49
Thetamap
clear ; close all; clc
sonarmap = importdata('sonarmap.mat');
A=[];b=[];
xarr = [];yarr = [];rarr = [];tarr = [];
for i=1:size(sonarmap,1),
x = sonarmap(i,1) - 196;
y = 479 - sonarmap(i,2);
/usr/local/bin/gst-launch-1.0 uvch264src fixed-framerate=1 iframe-period=30000
initial-bitrate=500000 peak-bitrate=500000 num-reorder-frames=20 device=/dev/video0 name=src auto-start=true num-buffers=300 src.vfsrc ! queue ! fakesink src.vidsrc ! queue ! video/x-h264,width=1280,height=720,framerate=30/1,format=GRAY8 ! h264parse ! qtmux ! filesink location=video.mp4
gst-launch-1.0 uvch264src fixed-framerate=1 iframe-period=30000 initial-bitrate=500000 peak-bitrate=500000 num-reorder-frames=20 -e filesrc location="output.raw" ! h264parse ! qtmux ! filesink location=video.mp4
gst-launch -ev \
alsasrc device=hw:0 ! audio/x-raw-int,rate=44100,channels=2,depth=16 \ ! queue ! lamemp3enc target=bitrate cbr=true bitrate=128 \
! tee name=audio ! queue ! video. \ audio. ! queue ! grabber. \
v4l2src device=/dev/video4 ! video/x-raw-yuv,width=1792,height=768 \ ! tee name=pip ! queue ! videorate ! video/x-raw-yuv,framerate=25/1 \ ! videocrop left=1024 bottom=192 ! video/x-raw-yuv,framerate=25/1 \
! xvidenc bitrate=2000000 max-key-interval=25 ! video/mpeg,framerate=25/1 \ ! queue ! video. \
pip. ! queue ! videorate ! video/x-raw-yuv,framerate=5/1 \ ! videocrop right=768 ! video/x-raw-yuv,framerate=5/1 \
! xvidenc bitrate=1000000 max-key-interval=5 ! video/mpeg,framerate=5/1 \ ! queue ! grabber. \
gst-launch -ev \
v4l2src device=/dev/video4 ! video/x-raw-yuv,width=1792,height=768 \ ! tee name=pip ! queue ! videorate ! video/x-raw-yuv,framerate=25/1 \ ! videocrop left=1024 bottom=192 ! video/x-raw-yuv,framerate=25/1 \
! xvidenc bitrate=2000000 max-key-interval=25 ! video/mpeg,framerate=25/1 \ ! avimux ! filesink location=/tmp/video.avi \
pip. ! queue ! videorate ! video/x-raw-yuv,framerate=5/1 \ ! videocrop right=768 ! video/x-raw-yuv,framerate=5/1 \
! xvidenc bitrate=1000000 max-key-interval=5 ! video/mpeg,framerate=5/1 \ ! avimux ! filesink location=/tmp/grabber.avi \
alsasrc device=hw:0 ! audio/x-raw-int,rate=44100,channels=2,depth=16 \ ! queue ! lamemp3enc target=bitrate cbr=true bitrate=128 \
! avimux ! filesink location=/tmp/audio.avi