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?”

Yes! Yes.

Skycam test rig

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 structure

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:

A photo posted by Dan Royer (@imakerobots) on

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:

A photo posted by Dan Royer (@imakerobots) on

In this side view, the square I talked about is some distance off the floor, and +Z means “up”.

Inverse Kinematics

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.

Movement

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.

Code

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?

Final Boss

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.

Only registered users can comment.

  1. Hello,

    I find it really interesting and planning to create one, I would like to use your skycam code from the github to build it and tilt the object. Could you please tell which arduino board the code is written, is it for a UNO board or some thing else. I also have a doubt regarding the motor so if you please share the hardware specification like arduino board, motor shield from adafruit version, servo motor or industrial servo etc., for running the software, a beginner like me will find it really helpful.

    Also please share a sample video if you have done any testings.

    Thank you, much awaited for your reply.

    Raja

  2. Hello Dan,

    First of all, thank you very much, the article is very interesting.

    Why did you use two arduinos instead of merging the code into one? Wouldn’t it be easier to use it if all the code would reside in 1 arduino and from that arduino control the 4 steppers?

    I tried to do the merge, but I don’t have deep programing skills and I get lost when I try to change the bresenham’s line algorithm for using 4 cables instead of 2.

    I think that including the possibility of controlling the robot with a joystick and 2 buttons (up and down9 will be also very interensting.
    Thank you very much!

  3. Hello Dan,
    It would be great if you could update this prototype with newest Makelangelo firmware and use a single arduino with 4 steppers, instead of 2 arduinos with 2 steppers each.
    Thank you very much!