diff --git a/20151021/src/euslisp/kadai1.l b/20151021/src/euslisp/kadai1.l new file mode 100644 index 00000000..e956aef0 --- /dev/null +++ b/20151021/src/euslisp/kadai1.l @@ -0,0 +1,24 @@ +(if (not (boundp '*irtviewer*)) (make-irtviewer)) + +(setq sun (make-sphere 100)) +(send sun :set-color :red) + +(setq earth (make-sphere 10)) +(send earth :set-color :blue) + +(setq moon (make-sphere 2)) +(send moon :set-color :yellow) + +(send earth :locate #f(200 0 0)) + +(send sun :assoc earth) +(send earth :assoc moon) +(send moon :locate #f(250 0 0)) + +(objects (list sun earth moon)) + +(do-until-key + (send sun :rotate (deg2rad 5) :z) + (send earth :rotate (deg2rad 10) :z) + (send *irtviewer* :draw-objects) +) diff --git a/20151021/src/euslisp/kadai2.l b/20151021/src/euslisp/kadai2.l new file mode 100644 index 00000000..b13bf66e --- /dev/null +++ b/20151021/src/euslisp/kadai2.l @@ -0,0 +1,37 @@ +;;(if (not (boundp '*irtviewer*)) (make-irtviewer)) + +(defun make-piston-cylinder nil + (let (b1 b2) + (setq b1 (make-cylinder 10 50)) + (send b1 :locate #f(0 0 0)) + (setq b2 (make-cylinder 6 50)) + (send b2 :locate #f(0 0 0)) + (setq b1 (body- b1 b2)) + (send b1 :set-color :red) + b1)) + +(defun make-piston nil + (let (b1 b2 b3 b4 b5) + (setq b1 (make-cylinder 7.9 15 )) + (setq b2 (make-cylinder 2 10)) + (send b2 :locate #f(0 0 15)) + (setq b3 (make-cube 6 10 2)) + (send b3 :locate #f(0 0 25)) + (setq b4 (body+ b1 b2)) + (send b3 :set-color :gray80) + (send b4 :set-color :white) + (setq b5 (body+ b3 b4)) + b5)) + + +(setq c1 (instance bodyset-link :init (make-cascoords) :bodies (list (make-piston-cylinder)))) +(setq p1 (instance bodyset-link :init (make-cascoords) :bodies (list (make-piston)))) +(setq a1 (instance rotational-joint :init :parent-link c1 :child-link p1 :axis :z)) + +(setq r (instance cascaded-link :init)) +(send r :assoc c1) +(send c1 :assoc p1) +(setq (r . links) (list c1 p1)) +(setq (r . joint-list) (list a1)) +(send r :init-ending) +