Skip to content

Instantly share code, notes, and snippets.

View PierrickKoch's full-sized avatar

Pierrick Koch PierrickKoch

View GitHub Profile
@PierrickKoch
PierrickKoch / morse_octomap_mapping.launch.xml
Last active December 17, 2015 15:40
morse velodyne and octomap (w/ros)
<!--
Example launch file for octomap_server mapping:
Listens to incoming PointCloud2 data and incrementally builds an octomap.
The data is sent out in different representations.
Copy this file into your workspace and adjust as needed, see
www.ros.org/wiki/octomap_server for details
-->
<launch>
<node pkg="tf" type="static_transform_publisher" name="robot_tf" args="0 0 0 0 0 0 base_footprint base_link 100"/>
def save_geotiff(filepath, image32, width, height):
import numpy
import gdal
driver = gdal.GetDriverByName('GTiff')
ds = driver.Create(filepath, width, height, 1, gdal.GDT_Float32)
tmp = [image32[row*width:(row+1)*width] for row in range(height)]
raster = numpy.asarray(tmp, dtype=numpy.float32)
#scipy.misc.imsave('%s.png'%filepath, raster)
ds.GetRasterBand(1).WriteArray( raster )
@PierrickKoch
PierrickKoch / blender_3D_sound.py
Last active December 18, 2015 08:49
test Blender 3D sound
import bpy
filepath = '/path/to/file.mp3'
# use an Empty here, since appending sound on a moving Cube gets wired (accel?)
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.empty_add()
# open sound
bpy.ops.sound.open(filepath=filepath)
import bpy
filepath = '/home/pkoch/media/music/Alice Russell/06 Lights Went Out.mp3'
# use an Empty here, since appending sound on a moving Cube gets wired (accel?)
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.empty_add()
# open sound
bpy.ops.sound.open(filepath=filepath)
@PierrickKoch
PierrickKoch / blender.helper.py
Created July 12, 2013 09:59
blender.helper.py
import bpy
# helpers (c/p following in a Blender Text editor, run it, look at your console)
def do_all():
for obj in bpy.data.objects:
# TODO create object
print_all_logic(obj)
print_properties(obj)
@PierrickKoch
PierrickKoch / morse.props.basics.blend.py
Created July 15, 2013 10:40
Converted props/basic.blend to bpy script
# usage: blender -P {file}
import os, sys, subprocess
def ext_exec(cmd, python=None):
if not python:
python = 'python%i.%i'%(sys.version_info.major, sys.version_info.minor)
return subprocess.getoutput('%s -c"%s"' % (python, cmd) )
def fix_python_path(python=None):
@PierrickKoch
PierrickKoch / robotpkg.bash
Last active December 21, 2015 17:38
robotpkg bump version
__PKGNAME=gladys
__VERSION=0.1.3
__IS_WIP_=wip/
# do not edit following (supposed to be smart)
__DIRNAME=$__PKGNAME-$__VERSION
__ARCHIVE=$__DIRNAME.tar.gz
git tag v$__VERSION
<!doctype html>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="proj4js/dist/proj4.js"></script>
<style>
#map { height: 800px; }
</style>
<body>
from morse.builder import *
mana = ATRV('mana')
minnie = ATRV('minnie')
env = Environment('caylus.50cm.blend')
env.set_camera_clip(clip_end=1000)
env.set_camera_speed(50)
env.show_framerate()
env.configure_multinode(
@PierrickKoch
PierrickKoch / add_grid.bash
Last active December 26, 2015 23:59
Test add grid of specific size in Blender usually freeze over 1000x1000 grid
#!/bin/bash
for grid_size in 100 200 500 1000 2000; do
echo "blender -b -P add_grid.py -- $grid_size"
time blender -b -P add_grid.py -- $grid_size
done
# results:
# https://docs.google.com/spreadsheet/ccc?key=0AmpIySwDLOg8dDFxUlNjZWozRWhqWkF3aXBiQmViYkE