loading

We’re working on a project where we explore robotic body language as a way to augment/replace purely digital communication protocols. For this, we need to move a cellphone with as many degrees of freedom as possible. A robot arm would have been a good option, but for aesthetic reasons, we don’t want the mechanism to draw too much attention to itself. After a bit of research, we’ve settled on a structured called a Stewart Platform.

The Stewart Platform is a really amazing and versatile building block of robotics. It exists in many sizes and is used for many purposes. Lots has been written about it. But sometimes it’s hard to find a nice intro to the basic operation of its mechanism.

After reading a couple of papers and trying out a couple of different implementations, this is the one that worked for us.

Step 1: Hardware: Modeling, Cutting, Printing and Assembling

We designed the platform using servo motors because they are easier to find and cheaper than linear actuators. The range of motion is a bit more limited, but we were designing for expressiveness and not so much for range.

Before cutting metal and programming motors, Radamés designed a version of our platform using Fusion 360 in order to get some intuition about the range of movements and motor positioning.

The materials we used were:

- 1x RaspberryPi (with 5V/2A power supply)
- 6x Dynamixel AX-12A motors
- 1x UART circuit (with 12V/6A power supply)
- 1x aluminum base
- 1x plastic platform
- 12x M3 ball joints
- 6x threaded rods
- 6x servo brackets
- 6x servo horns
- lots of tiny screws

The servo brackets and horns came with the motors we bought, but we also modeled them in case we needed replacement parts. Simpler acrylic pieces can be used to hold whatever object you need on top of the platform, but since we wanted to hold cellphones in an upright position, we ended up designing a custom platform. STLs are attached here. The servo horns can also be cut from 1/8” acrylic or wood using a laser cutter.

Step 2: Testing

We tested our AX-12A library and motor driver circuit using one of the motors attached to our platform. We quickly realized that the servos on the platform can’t be driven independently of each other; in most cases, all six motors have to move simultaneously in order to achieve a desired position or pose.

This is a video showing how all the motors are affected when we drive only one motor up and down.

Step 3: Math: Papers

Before we started sending signals to all the servos, we figured it would be worthwhile to get familiar with the mathematics of the Stewart Platform.

Unlike articulated robotic arms, the Stewart Platform’s inverse kinematics are simpler than its forward kinematics. What this means is that it’s easier to calculate the leg lengths and motor parameters given a desired position for the platform, than to calculate where the platform is located for a given set of motor parameters. This is fine; we really want the inverse kinematics anyway, and that way we avoid solving a system of 18 non-linear equations with 40 possible solutions.

Some of the papers that we found were not specific to servo-based Stewart Platforms; they simply described the math based on desired leg lengths, and sometimes assumed that linear actuators would be used. This is the case for this MICS journal paper, which describes a very specific Stewart Platform and focuses on its forward kinematics.

We also found two papers that were more specific for servos. This paper by Filip Szufnarowski describes the inverse kinematic problem very nicely, but it was this document by an unknown author from the Wokingham U3A Math Group that had the most detail and cleanest notation. For example, this image that labels all the relevant points of a Stewart Platform with their corresponding coordinate system.

Step 4: ​Math: Joint Equations

The inverse kinematics problem of a Stewart Platform can be broken up into two stages:

(1) Given a desired position and orientation for the platform, how far is each joint on the platform from its corresponding base joint,

and

(2) What servo angles, if any, put each platform joint in the positions calculated in the previous step.

The first problem is easy to solve; once you have the appropriate points and coordinate systems defined like in the above image, the distances between base joints and platforms joints can be calculated with simple matrix operations for rotation and translation.

Namely, the length of each leg is calculated using the li equation in the image above. T is the translation vector between base coordinate system and platform coordinate system (where you want the platform to move), bi and pi are the locations of the joints in base and platform coordinate systems, respectively, and PRB is a rotation matrix describing how you want the platform to rotate. PRB is also described in detail in one of the images above.

Step 5: ​Math: Length Equations

The second part of the inverse kinematics problem is a little bit trickier. For each servo, given a platform joint position P, relative to the base joint position B, and fixed lengths for the servo horn a and support leg s, what is the servo arm angle that satisfies the distance l calculated in the previous step.

Since l increases as you vary the servo arm angle from -90° to +90° (relative to base plane), one way to solve for this angle is to do a binary search over the angle values, and find the one that more closely satisfies all the distance constraints. This is done on the code for this Stewart Platform.

But, the Wokingham U3A Math Group document actually steps through the derivation of a closed-form expression for this angle, using some pretty sweet geometry, algebra and trigonometry tricks.

The form of the equation for the angle is shown in one of the images above (read the paper for the full derivation and definition of the variables).

We actually found a small bug in this part of the U3A document: instead of using the p values for the platform joint positions in the platform coordinate system, you have to use the q values, which are relative to the base coordinate system.

Step 6: ​Math: Testing

We wrote a simple Stewart Platform simulator for our platform, to see the range of movements that it will be able to achieve, and to double-check the math. The code is in Processing, and is on github.

Step 7: ​Controlling the Stewart Platform

Once the math was verified, it wasn’t hard to extend the code to get real-time communication going between the simulator and the platform. We used OSC to send motor angle packets to the RaspberryPi controlling the platform, and a bit of code to transform these angles into AX12-A motor commands. The code for controlling the motors using the simulator is on github.

Some of this initial controlled movement can be seen on the videos above.

<p>Thanks very much useful... got a small doubt..from my understanding Servo Base Angles and its beta are same..but in your code there are different values..</p><p>Is there something I am missing? </p>
<p>In one comment, as per his drawing you have told the written Base angle as beta..</p>
<p>Which variables in which code?<br><br>If I recall correctly, base angles are the positions of the center of the motors on the base, and betas are the directions which the motors face, relative to the center of the motors, but using the same frame of reference as the base angles.</p>
<p>Sorry for my incomplete question...Thanks for your reply..I understood what I missed after some research along with your explanation..I had been confused with the base and beta angles but now cleared...Thnks..</p>
<p>Hi.</p><p>In the paper they said pi, bi, Bi. These are all<br>constants from the build of the platform.</p><p>I don't know how to get these parameter, could you explain for me?</p><p>are there equation use to caculate them?</p><p><em>b</em><em>i </em>= ( <em>x</em><em>i </em><em>y</em><em>i </em><em>z</em><em>i</em>)<em>T </em>= (<em>R</em><em>b </em>cos( <em>&gamma;</em><em>i</em>) <em>R</em><em>b </em>sin( <em>&gamma;</em><em>i</em>) 0)<em>T</em></p><p><em>p</em><em>i </em>= (<em>p</em><em>x</em><em>i p</em><em>y</em><em>i p</em><em>z</em><em>i</em>)<em>T </em>= (<em>R</em><em>p </em>cos(<em>p</em><em>&gamma;</em><em>i</em>) <em>R</em><em>p </em>sin(<em>p</em><em>&gamma;</em><em>i</em>) 0)<em>T.</em></p><p><em>many tks :))</em></p>
<p>Hi.<br><a href="https://www.instructables.com/files/orig/FCT/FLMF/I55MMXY1/FCTFLMFI55MMXY1.png" rel="nofollow">This image</a> shows what they are.</p><p>Once<br> you figure out your coordinate system (which way the x,y,z axis go on <br>your platform), you can use a ruler to measure b_i, p_i.<br><br>Or you can calculate them from the base radius, platform radius and the angles of how the joints are distributed.</p><p>Like we do <a href="https://github.com/thiagohersan/memememe/blob/master/Processing/StewartSimulator/Platform.pde#L41-L51" rel="nofollow">here</a>: platformJoint[i] and baseJoint[i] are the p_i and b_i numbers.<br><br>Hope this helps.</p>
<p>I'm on my way to caculate my Stewart Platform, there're a lot of new things.</p><p>Here is my Stewart Platform :))</p>
<p>Hello I wonder how was the PID control of servo motors along with the touch screen?</p>
<p>Hi.</p><p>I've seen a mistake in your code, more speific in the line 103 :</p><p>float M0 = 2*hornLength*(h0+q[i].z).</p><p>In the paper said: N0 = 2*hornLength*(h0+q[i].z) not M0</p><p>Is that right? or I'm wrong :))</p><p>And I was wondering between equation (9) and (12). What is the different between M0 = 2a(zp - zb) (9) and M0 = 2a (xp - xb) (12).</p><p>I hope you will explain for me soon. </p><p>Thank you!</p>
<p>Hi. I think in the paper they swapped their definitions for M and N between equations (9) and (12). On (9) it's arctan(N/M) and on (12) it's arctan(M0/N0). </p><p><br>Basically their N0 = M(0) and M0 = N(0). This is hell-a-confusing, so in the code I kept M0 = M(0) and N0 = N(0).<br><br>Equation (12) is a specific instance of (9) where beta=0 so you can simplify some of the terms in what they call M0 and you also have zb = 0.</p>
<p>Hi Thiagohersan.</p><p>In your code, I don't know how to get the coordinates q[i].x, q[i].y, q[i].z because I have no idea to get (rotation.x), (rotation.y), (rotation.z) in my platform.</p><p>And the angle of servo arm (&alpha;0) in the home position in equation (12) is 0 for each servo???</p><p>Finnaly, Can you help me to get Beta angle in this image? </p><p>Hope you can explain to me soon!</p><p>Thank you. :)</p>
<p>qi are the coordinates of the platform connectors relative to the base coordinate system. I think I used mm to measure. You can measure with a ruler. It's the (x,y,z) distance from the origin in the center of the base, at the height of the motor arms.</p><p>Makes sense for the home position be 0, no? This is the angle of the servo arm, which varies from -90 to 90 (or 0 to 180). I defined home position to be servo arm parallel to the base and platform, and called this 0 degrees. The arms then go -90 degrees (when the arm swings down) to 90 degrees when they swing up.</p><p>Beta is the angle of rotation of the motor itself relative to the base. In your drawing, the angle labeled &quot;Base Angle&quot; is the beta for that one motor. You have to measure that one and all others.</p>
<p>How did you compensate for the error in l generated per radian of rotation when the servo axis is not perpendicular to S? Would it be better to design a system where either the connecting rod was always in the same plane as the servo arm or beef up the math to calculate this angular error? I suppose the longer the connecting rods are the less this is a problem, but it would be a problem in a more squat system, no?</p>
Looking at this image:<br>https://cdn.instructables.com/F5Q/C23K/I55MMXYX/F5QC23KI55MMXYX.MEDIUM.jpg<br><br>The servo horn 'a' doesn't have to be perpendicular to 's'. The math here computes the servo angle to make a valid triangle between 'l', 'a' and 's', but it doesn't have to be a right triangle:<br>https://cdn.instructables.com/FNG/4ZFP/I55NUFVG/FNG4ZFPI55NUFVG.MEDIUM.jpg<br><br>The important thing is to make sure the ball joints can move as much as possible to get to the positions calculated.<br><br>Hope this helps.<br>
<p>Hi Thiagohersan!</p><p>Is it possible if i use Law of Cosines to calculate &alpha;0? Because the servo horn &quot;a&quot; doesn't have to be perpendicular to &quot;s&quot;.</p>
<p>Hi. Do you mean the angle between the leg and the plane of motion of the servo horn, to compensate for the fact that the leg is not always perpendicular to the plane of the base? Sure. Off the top of my head, I'm not sure how to solve for the servo angle in this &quot;3D&quot; version.</p>
<p>I wasn't talking about the angle between 'a' and 's'. The math shown does not account for the fact that the further that 's' is out of the plane of rotation of the servo arm the smaller the change is in 'l' for a given change in servo angle. In the extreme, if 's' is perpendicular to the plane of servo rotation (parallel to the servo axis) 'l' does not change at all for a change in servo angle. Do you see what I'm saying now? It seems to me that there would be significant binding and error in positioning at the extremes of travel and rotation of the moving plate.</p>
<p>Ahhh. Yes. You mean the plane defined by 'a', 'l' and 's', in relation to the plane defined by the servo arm movement.</p><p><br>The platform here has that error !! What can I say... I was young and naive... : )<br><br>But one way to deal with it is to make sure 'P' is as much above the servo as possible. So, not so much the length of the rods... but if the size of the top platform is comparable to the size of the base, it helps.<br><br>This is how the latest platform looks, not sure if it's clear, but the top platform has been extended to make sure the 'a' 'l' 's' triangle is more aligned with the plane of rotation of the servo horn:</p><p><a href="http://i.imgur.com/JZgJOHU.jpg" rel="nofollow">http://i.imgur.com/JZgJOHU.jpg</a></p>
<p>what are the problems that we may face when designing Stewart Platform?</p><p>I am a polytechnic student in electric engineering , and really have no idea about </p><p>this platform.I even can't understand the mathematics. I really need your help .</p><p>Thank you so much!!!</p>
<p>Sometimes we get carried away with math, modeling and electronics and forget about the physical stuff. Make sure your motors can handle the weight you have to move. If you're using servos, make sure you have nice ball joints. Also, read the last couple of comments here about the size of the platform compared to the size of the base (make them similar if possible).</p><p>Did you read the <a href="https://www.instructables.com/files/orig/FFI/8ZXW/I55MMY14/FFI8ZXWI55MMY14.pdf" rel="nofollow">document</a> that explains the math? It's a good start.</p>
<p>when you design your stewart platform is there considerations.</p><p>currenly i am designing a chair base on this platform. can you help me check my </p><p>dimensions. is it possible to construct . thanks.</p>
<p>I've never made one this big. With big enought motors, I'm sure it will work.<br><br>You might want to keep the platform and the base similar in size.<br>(see the last couple of comments from milutix and molvikpm).</p>
<p>when you design your stewart platform is there considerations.</p><p>currenly i am designing a chair base on this platform. can you help me check my </p><p>dimensions. is it possible to construct . thanks.</p>
<p>Hello thiagohersan,<br><br>This project is really interesting, well done on successful building the platform!! :D<br>I have build my own prototype via the help of this project. I do, however, have one question which I am trying to get an answer to.<br><br>My platform can rotate around the XYZ axes nicely, however when the platform moves along the X, Y, Z planes, it does so while also rotating slightly.<br><br>To phrase the problem in another way:<br>If the platform is currently at <br>X=0, Y=0, Z=0; <br>R(roll) = 0, P(pitch) = 0, Y(yaw) = 0;<br><br>and I set the platform to move to:<br>X=10, Y=0, Z=0;</p><p>Instead of the R, P, and Y values staying at 0, <br>they change to something like:<br>R = 1, P = 4, Y = 1;<br><br>Would this be a mechanical fault (1), an error due to the servos being inaccurate (2) (I am using Chinese servos with no feedback on their position), or would it be in my mathematical model being incorrect (3)? <br><br>Thank you for reading this.<br>Milutin</p>
<p>Hi <a href="https://www.instructables.com/member/Milutix" rel="nofollow">Milutix</a>. Thanks for the kind words.</p><p>I think all 3 points you've raised are causes for small errors to add up to larger inaccuracies.</p><p>How do you measure R,P,Y after you give it a command to move ? Do you have feedback? I've noticed this on mine, but by looking. Never measured how far off it actually was.</p><p>What does your platform look like? If you read below, the issue raised by <a href="https://www.instructables.com/member/molvikpm" rel="nofollow">molvikpm</a>, there is a mechanical modeling error in the sense that the plane defined by the motor horn and the leg is not perpendicular to the plane defined by the motion of the servo horn.</p><p>I've minimized this in a new platform by making the top platform and the base be the same size, and keeping the legs as &quot;straight up&quot; as possible. See this image:<br><a href="http://i.imgur.com/JZgJOHU.jpg" rel="nofollow">http://i.imgur.com/JZgJOHU.jpg</a></p><p>Hope this helps.</p>
<p>Hello thiagohersan, <br><br>My platform is identical to yours in a mechanical sense, apart from the fact that the rods are no where near perpendicular to the motion of the servo horn. (It's similar to your &quot;instructable&quot; platform, not your newer improved version. :)<br><br>I was trying to increase the roll, pitch and yaw capabilities of the platform by making the platform much smaller than the base, so that each servo degree would affect the rotation of the platform by a larger magnitude.<br><br>Thank you for your reply.<br>I have had a look at molvikpm's comment and yes, it does seem that this is the problem that I am also experiencing. Looks like it is time to do some more math research and look into how to include this parameter in the calculations. <br><br>Thanks again! :D</p>
<p>Cool. If you figure out what the relationship is between size of platform and angle of rotation, or if you figure out a parameter to account for non-perpendicular rods.... let us know ! Good luck.</p>
<p>hi</p><p>what kind of sensors did you used?</p>
<p>where? for what? I don't think I'm using any sensors... </p><p>I have motors, sheet metal, rods, and lots of tiny screws....</p>
sensor for measuring orientation and displacement in the platform. or for feedback for legs translation . what kind of motors did you use ?
<p>There's no feedback. I think you can get pretty far by doing the math and modeling your platform. That is to say, if there's no other force acting on the platform, you know where the platform is based on the math/model.</p><p>I really don't mind answering questions, but please read the Instructable beforehand. Step 1: Materials.</p><p>SPOILER ALERT: Motors are Dynamixel AX-12A.</p><p>I'm not using this feature, but these motors can give you feedback by reporting their position. If you have external forces acting on the platform you can read motor positions and adapt.</p>
<p>Hi. <br>In your processing simulator i notice that you have sett all the beta angles with a refrence to PI, is there a special reason for this ? I have writen a code based on the same paper as you have, only in python. At the moment i am strugeling with x and y movments, as they give a small pitch angle (with x movment) and roll (with y movment), and i am unsure of where my error lies. </p>
<p>Those are the positions of the motors on the base in radians. I find it easier to work with fractions and PI for symmetric things. Along with PI, the Unit Circle is a beautiful beautiful thing.<br><br>Not sure what kind of joints you have, but my platform was never 100% sturdy and precise because of the ball joints. There is always a little movement due to the weight of the phone on the ball joints.</p>
<p>What is the difference, between on where the push rod is placed in on the servo-horn and also the difference on the length of the push rod if it affects the range of motion? Any help will be appreciated. Im trying to built one be connected to Flight Simulator.</p><p>Thanks </p>
Hi. Looking at <a href="http://www.memememememememe.me/wp-content/uploads/2014/07/ServoMath.jpg" rel="nofollow">this image</a>, you are talking about 'a' and 's', right?<br> <br> I've been calling 'a' the horn or arm, and 's' the leg.<br> <br> I don't have math to prove it, but intuitively, the longer your horn/arm the larger your range of motion. The length of the legs don't have any effect on the range of motion, they just determine the starting location of your platform in relation to the base.<br> <br> One thing to keep in mind is that the longer the arm/horn, the more force you need from the motors.<br> <br> Hope this helps.
<p>May i also ask whether there is any specific position of the connection between the platform and the push rods. In addition, what is the relationship between wheres the servos are placed on the base. (like your hex position)</p><p>Thanks for your feedback</p>
<p>I think there's some requirement about keeping the legs in 3 groups of 2, somewhat equally spaced around the platform and the base, so you can get 6-DOF movement.... but am not 100% sure.<br><br>Take a look at other Stewarts online and you'll see there is variation about the ball joint locations though.<br><br>Most variations can be accounted for in code, like, platform ball joint placement and motor location and rotation.</p>
<p>On the image of your phone holder, did u calculate the distance where the 2 push rods meet the top platform? If yes, how did you do that and if no, do you know how the distance affects the motion. </p>
<p>No idea. I think they should be close to each other, but I'm just guessing.</p>
<p>Just thought to add something: I think the motor positions on the base are not so important, as long as your rods/legs have wide range of movement. The positions in the actual platform (3 groups of 2), might be a bit more specific in order to get 6 DOF movements. It's not clear to me that distributing them equally around the platform will give the same movements.</p>
<p>after reading the document &quot;The Mathematics of the Stewart Platform&quot;, there is a thing i didn't get it.</p><p>what is &quot; Bi : are the points of rotation of the servo arms with the coordinates &quot;, i don't understand this coordinates and how he used them in calculating Xa and Ya.</p>
<p>Take a look at this image:<br><a href="https://cdn.instructables.com/FCT/FLMF/I55MMXY1/FCTFLMFI55MMXY1.MEDIUM.jpg" rel="nofollow">https://cdn.instructables.com/FCT/FLMF/I55MMXY1/FCT...</a></p><p>Bi is a set of all motor locations. Each member b of the set has the location of one of the motors, with coordinates Xb,Yb,Zb.</p><p><br>You use these when you calculate Xa and Ya because</p><p>Xa = a cos(alpha) cos(beta) + Xb<br>Ya = a cos(alpha) sin(beta) + Yb</p><p>Those Xb and Yb values are the coordinates of the motor from Bi.</p>
<p>Where 'a' in those equations is the length of the servo horn/arm, as seen here:<br><a href="https://cdn.instructables.com/F5Q/C23K/I55MMXYX/F5QC23KI55MMXYX.MEDIUM.jpg" rel="nofollow">https://cdn.instructables.com/F5Q/C23K/I55MMXYX/F5Q...</a></p>
<p>I've read the document by the unknown author, but there's one part I didnt understand. what is the angle beta? and shouldnt alpha at home be 0 degrees? please help thanks!</p>
<p>Hi. From the paper:<br>alpha is the angle of servo arm from horizontal. Positive going up, negative going down.<br><br>beta is the angle of the motor on the platform. Looking from above, as if the platform were a clock-face, where are the motors? Pick one to be at 0, the others should be regularly distributed on the platform, and beta is the angle between the first motor and all the other ones.<br><br>Take a look at this code for my values of beta:<br><a href="https://github.com/thiagohersan/memememe/tree/master/Processing/StewartSimulator" rel="nofollow">https://github.com/thiagohersan/memememe/tree/mast...</a></p><p><br>I didn't really follow the even/odd distinction from the paper. I pretended that the motors were all aligned the same way and then accounted for it in the code that drives the servos. You could also build a platform with the motors all aligned in the same way.</p>
<p>This is a great post. Could you please help me with the length of the threaded rods and how does the length impact the range of motion?</p>
Yeah.<br><br>So... I'm basing all of this on intuition, I haven't really built other platforms with different rod length (yet!, but soon I will!).<br><br>The length of the threaded rods can be anything, as long as they are the same : )<br><br>What might actually impact the range of motion even more is the length of the servo motor horn. the longer they are, the larger your range of motion. But again, this is just my intuition.... <br><br>
<p>This is really cool but I must be missing something. Can someone explain the purpose of this interesting piece of engineering besides moving a cellphone around?</p>
<p>Never mind... I should have used Google before I asked. Ha ha :) Has anyone come up with a unique and different application of this technoligy?</p>
<p>You probably saw some uses for a Stewart Platform on google... (testing tires, flight simulators, low-gravity simulators...).<br><br>Ours was made for this project: <a href="http://www.memememememememe.me/" rel="nofollow">http://www.memememememememe.me/</a>.</p><p>I think the platform could be extended to make stop-motion animations with a moving camera or cell phone.... for example...<br><br></p>

About This Instructable

44,068views

243favorites

License:

More by thiagohersan:Data Over Light: a Laser Modem Prototype Stewart Platform memememe#selfie 
Add instructable to: