How to code the Inverse Kinematics for a SpiderCam or SkyCam
Büşra wrote in through the live chat to ask “I’m a student of Mechatronical Engineering in Kocaeli University, in Turkey. My senior project is ‘Skycam’. I’ve been trying to find this equations for a few months but I couldn’t reach any result. Can you help?”
Skycam and Spidercam are trademarked names of the cameras that are now often seen at large sporting events. They can fly right down over the middle of the field without interrupting the players. A big hit at the olympics and in major league football, they can be built in a small room from 3D printer parts. I built one in my garage by combining two Makelangelos, just for fun.
The simplest design is a square, parallel to the ground. At each corner of the square attach a stepper motor that turns a pulley and pulls on some timing belt. All four motors are controlled by a RUMBA controler or a RAMPS shield on an Arduino MEGA 2560. You can build this machine with only three motors, but then the camera can only cover a triangle-shaped area of the floor. You could even start with a Makelangelo, then add one motor at a time until you get a full Skycam.
I’ve drawn some sketches based on a four-motor setup. Here’s what it would look like from above:
I’ve labelled the four motors as A, B, C, and D. The tool is EE, same as for the recent Stewart Platform Inverse Kinematics post. Notice the +X and +Y. Here’s what it would look like from the side:
In this side view, the square I talked about is some distance off the floor, and +Z means “up”.
Now to make the upcoming math simple, I’m going to pick a spot on the floor under C and say that spot is the origin. Every measurement I make on the machine starts at that (0,0,0) location. If the square is 2x2x1 then point A is (2,2,1), B is (0,2,1), C is (0,0,1), and D is (2,0,1). What I’ve done here is make a coordinate system, and now it’s easy to find the length of each belt.
T = (EE - A);
lengthA = sqrt( Tx*Tx + Ty*Ty + Tz*Tz );
I can repeat that for all four belts, anywhere. Even outside the cube, though that’s physically impossible.
Just like the Makelangelo, I have motors with pulleys moving the belts. The pulleys have a diameter, the diameter gives me the circumference, the circumference / motor-steps-per-turn gives me the belt-move-per-motor-step.
Just like the Makelangelo, if I want to move the EE from some point Start to some other point End, I can find the amount of change in every belt and then move each motor. To get the movement pretty close to a straight line I’d need to move each motor at different speeds so that all the belts arrive at their new lengths at the same time. To get even better results I would split long moves into lots of short segments. That would eliminate the wierd movement like I mentioned in the Stewart Platform Inverse Kinematics post.
Skycam on GitHub has all the arduino and Java code from my version. I used two arduinos and two ads fruit motor shield v1. If it’s stupid and it works…it isn’t stupid.
Now you try
The real fun of this project isn’t the math or the code, tho those are a certain kind of fun. The real fun for me are the design decisions about the hardware. How do you mount the motors? Do they turn to face the EE to reduce stress on the system? Does the spot that the belt attaches to the EE change when the EE position changes, also to reduce unwanted stress?
If you’re building a big machine, do you have to worry about sag on the belts?
If you’re making a fast machine, do you have to compensate for momentum?
How do you keep the camera steady? The pro machines use a gyroscope and maybe an accelerometer. How would you do it?
Build a skycam in your home with a camera on the EE. Make a time lapse video. Share it with us. Bonus points if you can make the camera pan and tilt, too.