- aditya mehrotra.

# scout inverse-kinematics part one: getting robots to understand themselves with models [updates]

Updated: Jan 6, 2020

WHAT IS INVERSE KINEMATICS? Good question, this is my way of teaching myself too. The basic idea is this. *Forward Kinematics* is like you learn in physics where based on an object's trajectory or the forces on it you can determine the path it will take/is going to take/etc. For example, I have a gravitational force on a ball, I give it some initial upwards velocity, I know its trajectory will be parabolic according to kinematics. *Inverse Kinematics *does the opposite. If I KNOW I want a certain trajectory, let's say of a ball or even of a robot arm (or dare I say robot leg), how do I move the actuators to get to that original and final position? How do I move the actuators to get the desired forces and etc, especially in 3D space?

So my plan, at least for scout, is to learn about inverse kinematics the *theory* and what it is trying to do. When walking through Wikipedia to gain a basic understanding (just enough to write the first paragraph above), it mentioned a software called __OpenRAVE__, an open-source software from the industry to do these reverse kinematics problem and possibly do code-generation for them! I want to try out this software after learning a bit about the theory.

## step one: inverse-kinematic theory

Oscar Liang explained this very well on his __blog post__, here I summarize. When you're creating something like a four-legged robot, the problem you're solving when making it walk *isn't *just the fact that you need to know how to move the legs and when to make it move forward, it's that if you just LIFT a leg and move it forward the dog will fall over because it can't balance on all positions of it's legs, right? It's like this, if you stand on one leg, your body *shifts* its weight to the other leg by leaning slightly to one side so you don't fall. In robotics it's the same, the dog would need to shift its weight onto the other three legs for this to happen. This is NOT as easy as you think as I'll now explain.

When *anything on legs* is standing. Looking at the diagram above, if the pencil-targets are the position of the feet, and the black and white circle is the center of gravity, the reason this above robot is able to stand is because the CoG is contained *within *the polygon created by connecting the points where the feet touch the ground.

When the configuration is like this, the CG is outside the polygon made by the feet, we've lifted the leg on the bottom-left, and moved the one on the top-left inwards. In this case, the robot would fall over. So the point I'm making here is the robot needs to be aware of a FEW things in its coordinate space, one, it's center of gravity, and two, the positions of its feet, projected onto an *xy plane* that's been standardized. At least, this is the approach that we can take to estimate the walking of the robot. As far as climbing stairs, we are *not *there yet.

So the first thing to do with this robotic system, before we get to inverse kinematics, is create a plane and an x-y coordinate system we can project onto.

*First, *take the four mounting points of the legs, each at one corner of the robot's frame and create a rectangle that connects these four points. The center of this rectangle is the *geometric center *of the robotic system in the top-view plane. The corners of the rectangle are points at the origin of the legs (where they mount to the frame), we generate the coordinates of these corner points with respect to the origin we just created.

*Second, *we measure the CoG (calculation will come later, unsure of what it is at the moment) and place its coordinate on this new plane with reference to the origin we created above.

*Then*, we can use inverse kinematics of each of the legs to determine the foot positions with reference to the origin of each leg (the place where it mounts to the body), and plot them on our plane to get the position of the feet with reference to the geometric center of the robot.

The robot can then plot the lines connecting the points between the feet that are down too see if the CoG is within the polygon so it can then decide if it will be able to stand or not. This is how we can make a robot walk, stand, etc with NO accelerometers or otherwise, just inverse kinematics from the legs. This is the plan to get the robot to understand *it's physicality* and how it can walk and balance *at least initially*. My plan isn't to create one giant model, it's to create small, lighter models but a few of them. Enough to get the robot to understand itself inherently.

#robotics #scout #math #design #robot_leg #projects #engineering #ongoing #update