POV-Ray : Newsgroups : povray.advanced-users : Manipulator arm design : Re: Manipulator arm design Server Time
29 Jul 2024 00:26:02 EDT (-0400)
  Re: Manipulator arm design  
From: Mike Williams
Date: 15 Jul 2003 01:32:57
Message: <5PWy9HA3E5E$Ewzs@econym.demon.co.uk>
Wasn't it David Wallace who wrote:
>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:

I'd suggest having your macro work down the arm in the opposite
direction, from the hand to the elbow, counting ps down from Joints-1 to
zero. I find it easier to get the links in the correct position that
way.

It looks a bit odd having all the links the same size. You might want to
make "ob" into a macro that produces links of different sizes and pass
the size parameters as an array into ManipArm() when then passes the
relevant parameters for the particular link into ob(). In this scene
I've simply used an array of sizes to perform a scaling in the y
direction, but it should give you the general idea.


global_settings { assumed_gamma 1.0 }
camera { location  <10,20,-50> look_at <20, 15, 0>}
light_source {<-1000,1000,-1000> colour rgb 1}
plane {y,0 pigment {rgb 0.8}}

// ----------------------------------------

// Subsection
#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> } }
}

//Joint array
#declare maRotArray = array [5] { 23, 29, -10, 15, 30 }
// Joint lengths
#declare maSizeArray = array [6] {10,9,7,5,4,3}


//Connection macro
#macro ManipArm(ob, Lengths, Joints)
 #local ps = dimension_size(Joints,1) - 1;
 #local Arm = union{ob scale <1,Lengths[ps+1]/10,1>}
 #while (ps>=0)
   #local Arm = union {
     object {Arm 
       rotate x*Joints[ps]
       translate y*Lengths[ps]
     }
     object {ob scale <1,Lengths[ps]/10,1>}
   }
   #local ps = ps-1;
 #end
 object {Arm}
#end

//Invocation
object {ManipArm(maSection, maSizeArray, maRotArray) 
  rotate y*90
}


Post a reply to this message

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