Skip to content

Instantly share code, notes, and snippets.

;; 第1回 Scheme コードバトン
;;
;; ■ これは何か?
;; Scheme のコードをバトンのように回していき面白い物ができあがるのを楽しむ遊びです。
;; 次回 Shibuya.lisp で成果を発表します。
;; Scheme 初心者のコードを書くきっかけに、中級者には他人のコードを読む機会になればと思います。
;;
;; ■ 2 つのルール
;;
;; (1)自分がこれだと思える変更をコードに加えて2日以内に次の人にまわしてください。
<node pkg="amcl" type="amcl" name="amcl" machine="amcl-machine">
<param name="odom_alpha1" value="5"/> <!-- dtheta -> x -->
<param name="odom_alpha2" value="10"/> <!-- dx -> theta -->
<param name="odom_alpha3" value="5"/> <!-- dx -> x -->
<param name="odom_alpha4" value="5"/> <!-- dtheta -> theta -->
<param name="odom_alpha5" value="5"/> <!-- slip -->
<param name="update_min_d" value="0.05"/>
<param name="update_min_a" value="0.1"/>
<!-- for AmclNode::uniformPoseGenerator bug -->
<param name="recovery_alpha_slow" value="0.000"/>
@garaemon
garaemon / gist:732160
Created December 7, 2010 18:07
classmethod on CLOS
;; utility functions to define class methods
(defun extract-argument-symbols (args)
(mapcar #'(lambda (x) (if (listp x) (car x) x)) args))
(defun has-class-method-p (method class arguments)
(let ((methods (compute-applicable-methods method (cons class arguments))))
(dolist (m methods)
(let ((specializers (closer-mop:method-specializers m)))
(if (typep (car specializers) 'closer-mop:eql-specializer)
(return-from has-class-method-p t))))
(require :closer-mop)
(defpackage :clap-metas)
(defclass clap-metas::clap-base--meta (standard-class) ())
(defmethod closer-mop:ensure-class-using-class :around ((class null) name
&rest options
&key metaclass
direct-superclasses
&allow-other-keys)
@garaemon
garaemon / gist:733636
Created December 8, 2010 17:55
classmethod on clos
(defun extract-argument-symbols (args)
(mapcar #'(lambda (x) (if (listp x) (car x) x)) args))
(defconstant +built-in-class-instances-table+
`((arithmetic-error . ,(make-condition 'arithmetic-error))
...))
(defun lookup-built-in-class-object (class)
(cdr (assoc class +built-in-class-instances-table+)))
@garaemon
garaemon / gist:735708
Created December 10, 2010 03:19
all of the built-in classes of CommonLisp
(defun enumerate-all-classes (&optional (result nil)
(prepended (list (find-class 't))))
(if (null prepended)
result
(let ((subclasses (closer-mop:class-direct-subclasses (car prepended))))
(let ((new-subclasses (remove-if
#'(lambda (c)
(member c (append prepended result)))
subclasses)))
(enumerate-all-classes (cons (car prepended) result)
@garaemon
garaemon / gist:743134
Created December 16, 2010 06:50
sample of linking external libraries in ros build system, CMakeLists.txt
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
@garaemon
garaemon / topics_to_ssv.py
Created February 17, 2011 12:24
a script to output the values of ros topics into a text file
#!/usr/bin/env python
import roslib
roslib.load_manifest("sensor_msgs")
roslib.load_manifest("message_filters")
roslib.load_manifest("rxtools")
import rospy
import rxtools
import rxtools.rosplot
import sys
@garaemon
garaemon / cairo and gtk
Created May 8, 2011 13:57
cairo and gtk on ruby
# -*- coding: utf-8 -*-
require 'cairo'
require 'gtk2'
format = Cairo::FORMAT_ARGB32
width = 300
height = 200
radius = height / 3
window = Gtk::Window.new('Graph')
window.set_default_size(width, height)
@garaemon
garaemon / gist:2232015
Created March 29, 2012 01:00
UtilityMacros.h
#define DICT(...) ([NSDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil])
#define MDICT(...) ([NSMutableDictionary dictionaryWithObjectsAndKeys:__VA_ARGS__, nil])
#define FORMAT(...) ([NSString stringWithFormat:__VA_ARGS__])
#define ARRAY(...) ([[NSArray alloc] initWithObjects:__VA_ARGS__, nil])
#define MARRAY(...) ([[NSMutableArray alloc] initWithObjects:__VA_ARGS__, nil])
#define ASSOC(D, K) ([D objectForKey:K])
#define PREDICATE(F, ...) ([NSPredicate predicateWithFormat:F, __VA_ARGS__])
#define LOCALIZED_STRING(S) (NSLocalizedString(S, S))
#define IS_VALID_STRING(s) (s && s != NULL && ![s isEqual:[NSNull null]])
#define CG_RECT_MAKE_SHORT(N) (CGRectMake(N##_X, N##_Y, N##_WIDTH, N##_HEIGHT))