POV-Ray : Newsgroups : povray.advanced-users : Manipulator arm design : Manipulator arm design Server Time
29 Jul 2024 00:34:37 EDT (-0400)
  Manipulator arm design  
From: David Wallace
Date: 14 Jul 2003 20:57:27
Message: <3f135177@news.povray.org>
I am trying to find a simple way to set up a manipulator arm consisting of
multiple connected parts.  Let's start with a simple piece definition:

#declare maSection = union {
    box { <-2, 0, -1>, <-1, 9, 1> }
    cylinder { x*-2, x*-1, 1 }
    box { < 1, 0, -1>, < 2, 9, 1> }
    cylinder { x*2, x*1, 1 }
    box { <-1, 1, -1>, <1, 10, 1> }
    cylinder { <-1, 10, 0>, <1, 10, 0>, 1 }
    texture { pigment { rgb <0.45, 0.49, 0.60> } }
}

The idea is have an array of rotation angles,

#declare maRotArray = array [5] { 23, 29, -10, 15, 30 }

so that each joint has its own angle.

A brute force approach might look like this:

#macro ManipArm(ob, sep, Joints)
 #local ps = 0;
 #local nJoint = dimension_size(Joints,1);
 union { #while (ps<nJoint)
  object { ob
   #local rt = 0;
   #while (rt<ps)
    rotate x*Joints[rt]
    translate y*10
    #local rt = rt + 1;
   #end
  }
 #end }
#end

The combined object would look like this:

#declare Arm = object { ManipArm(maSection, 10, maRotArray) }

Note that 5 joints means 6 pieces.  I want to know if this is the best way
to carry it out before proceeding to build such a system with more complex
parts.  Feel free to add array validation or other error checking if you
want.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.