Symbolic Computations and Dynamic Visualisation in Robotics Research and Education

Sandipan from IIT Madras shows how Mathematica handles symbolic math in robotics. He shrinks a Stewart platform singularity expression from 2.87 megabytes to 45 kilobytes using a monomial-based method, then uses it to compute safe zones for robot path planning.
Questions this video answers
Sandipan, IIT Madras.
February 10, 2024.
Monomial-based canonical form (referred to as 'monopoly').
From approximately 2.87 megabytes to about 45 kilobytes.
Section 3 of the referenced paper (slide link).
Chapters
Hello everyone. This is Sandipan here from India, IIT Madras, and depending upon where you are, a very good morning, good afternoon, or good evening. So I'm going to talk about a bit of my work that I do in the field of robotics. So I primarily work in the field of parallel manipulators and, and wedding. We use a whole lot of symbolic computations as well as visualizations. So this is the abstract art, my talk. So this presentation has already been shared with you in the notebook format and during this session you can pose questions or I can take questions at the end. So feel free to ask anything that you think is of interest to you. Okay, so a very brief note as to how I got started with this. So my interaction or connection with Mathematica goes all the way back to 1998 is like 25 years. As a matter of fact, even my wife comes a close second. I know her only for 24. So this started off basically as a tool for doing matrix multiplications that we had to do in, in an assignment during my masters. But then again, as things progressed, it became a very major tool for my research during my doctoral studies. And then afterwards I started developing my own modules. And now this has become an indispensable part of my work. And this is something that I use extensively in my teaching as well as research. So in this talk, which is very, very brief, I would just like to introduce you to one or two of those things that I use so that we get some glimpse and if any of you are interested to know things further, you can obviously communicate afterwards. Okay, so here is the first one. So this is coming from my teaching examples. I teach something called parallel manipulator. So this robot that you see here, this has got three degrees of fairness. So this three links have motors here, here and here. And they can move. So this presentation is for short duration and I just to keep it light and not too long. I didn't introduce the dynamic version, but you can imagine that I can use the sliders to move these links around. And the interesting point is this that when the. The target here is to be able to find the position and orientation of this green triangle here, which is known as the end effector. Now there, there are a bunch of equations at the back end of this which are being solved for any given set of theta 1, theta 2, theta 3 and the length, lengths. What I am trying to depict here is actually something that is very interesting geometrically. So the center point of this triangle is what I need to find. And we can Reduce this problem into this intersection of these three circles is red, green and blue. And if you look carefully that these three circles actually intersect at this point. And this gives us a way to formulate this problem in terms of geometry. You can solve this problem any which way and then you can verify this geometrically, or you can actually use this geometry to think of something else. Okay, how else can I solve? So that is also here, if you look at these three circles, and if you look at them pair wise, then you could see that they have this common chord, these three lines again in RGB formation. So when the three circles meet at a point, so do the three lines. And therefore you could come up with a formulation which basically keeps two of these lines in one circle, and so on, so forth. The point I'm trying to make here is that one could solve these equations even without going through any of this visualization or geometric understanding of the problem. But now that we have this beautiful capability that we can do the computation, we can visualize, and that visualization by itself actually inspiring more intuitions and thoughts. Because when students see these, and they actually move these sliders around and see that no matter what the robot's inputs are, there are always this geometric constant that holds good. So that gives them some kind of intuition into the problem. And also perhaps the joy that is associated with geometry engineering, general. So this is not just confined to the planes. This is one example in space. So here again, this is a different manipulator, but this is a spatial one. So three degrees of freedom. This top platform again moves when we change this three link lens. So there are three legs here which can change in the length. And when they do, again there are these circles and these three circles are now intersecting at the center of this triangle. Now in this case the problem is more complicated. So this gives rise to a 60 degree polynomial at the back end. But what is interesting is that when you look at it in a geometric setting, you can relate between the previous problem, which was three circles intersecting the plane, as opposed to here, which are three circles intersecting at the same at the same point in space. So it kind of provides a continuity and all of that can be brought alive within this platform. So this is a very interesting tool. Again, I use this not just for my class, but also for some amount of research here. So this is a very complicated problem. We're trying to now not analyze the manipulator, but to design. Now this is a multi objective problem and multi parameter problem. There are many inputs here. Some of them are Shown here on these sliders. So one objective might be stiffness, another might be mechanical advantage. And here, the third one is payload to self iter inertia is deflected on the actuators. Now, these things vary not only with the configuration of the manipulator, but also with these design variables. So given this tool, the students can actually do a visual check on their design that they can drag the sliders and get a feel that how this design is evolving in this multi parameter space. So these are some of the things that I use in my teaching. And here let's go a little deeper into the research aspect of it. So most of these problems that I talked about, they give rise to equations which involve algebraic and trigonometric terms. So here I'm just showing a very simple example. This is a trivial example. We have some expressions which go into megabytes, sometimes even hundreds of megabytes. But the challenge I'm trying to show you here is that how do we simplify these expressions to get to the meaning of it. Now, as you can see here, this is a very trivial one. And if I ask Mathematica to simplify this, it does a fantastic job and eventually finds out that the result is a square plus B square, which is obvious because if you look at this, this is essentially a rotation matrix multiplied by A and B, right? Now what I do is that I add a term. So I simply add a small term here +C and see whether we can get this result again that whether Mathematica is able to simplify it by default turns out that yes, it does so. So the point I am trying to make here is that the end result should be independent of sin square and cos square. As you can see here, the end result is linear. Now we do that yet again, and this time yet I add one more term. So I add minus C to the second one. And when I do this squaring and adding, now we see that full simplify apparently had no effect on this expression. So what went in is what came out. So does this really mean that simplification failed? Not really. I'll just explain to you in a minute what happened. But here is one bypass to this problem or a remedy that. If you just did an expand before doing the simplification, then Mathematica is able to, or rather full simplify is able to get to the right answer that you want. So what really happened? So if we want to understand what happened, we look at the syntactical tree, which you can get by this command tree. Form and use it on these two expressions. Now when it was applied on H1, there is this leaf count, that is the complexity measure that is used by default by post. Simplify and simplify that how many leaves there are in the syntactical tree. Now you see that previously in H1 it was 26 and after the simplification in 2023. So this is a favorable direction. That's why this got simplified. Now when we look at what happened when we expanded first and then simplified, you see the leaf count actually went up. So mathematical built in routines do not find that to be the right direction. Because leaf count is increasing, the complexity measure is increasing. So therefore it does not go in that direction. So the point being that what human intuition suggests at as the right direction for simplification is not necessarily what a software or computer thinks, because the measures are different and it is hard for the computer in the general sense to figure out that what I need in a particular example. So we could always do this, that we could guide the simplification by expanding. But here is the problem. If we do an expansion of the whole expression here and we look at the leaf counter, as you can see here, even visually the tree looks very big. And when you look at the leaf count, it is actually pretty much the double of what it was. So again, this is a problem not for such small expressions, but when you have a megabyte long expression and you do expand, it could actually run into hundreds of megabytes, if not bytes. So which makes it very difficult, if not completely impossible, to go further. So what's the solution? Now here I have shown one of our inbuilt on our own developments. We call this function monopoly. Okay? It's a short form for monomial based polynomial form. I will show you a reference afterwards where you can find the theoretical details behind it. But the idea in short is this, that we break this expression, but in a manner we that splits it into smaller chunks. So what this command does is that it breaks this complete expression h2 in terms of this polynomials or monomials in A, B and C. So these are the algebraic parts of it. And it completely isolates the trigonometric parts in the triggers. So that allows us to do the following, that I can now work on the triggers alone. And here you can see the sine squared and cos square get to see each other and they get simplified quickly to one. So now what I do is that I take this algebraic terms and I multiply them with the simplified trigonometric terms. Basically a dot product of two vectors. And I get back the original expression. Now you can see that it doesn't have the sine square and cos square. So we did not fully expand. We did a divide and conquer split into smaller portions. And you want to adding this even further on this. If you use full sin tile, you can see that it rearranges in a manner that sin theta and cos theta appears only one. So this is what it found favorable in terms of deepcoming. So this is a very useful function for people working in kinematics. So I'll just show you how this came about. So this was part of my doctoral research going all the way back to about 20 years. This manipulator here is known as the steward platform. So this has got six legs and these legs can exchange or contract. Therefore this top platform, moving platform has six degrees of freedom. This is one of the toughest challenges in our field. So everybody wants to solve this problem to sort of, you know, gain some confidence in this area. So one of the problems that I tried to solve in my doctoral research is to find the so called singularity surface. Now this device has an issue that whenever the center of the top platform lies on a single surface. Now what's a singularity surface? So if this point lies on that particular surface, then the legs get locked. So if you are not familiar with this field, don't worry. But imagine this as a bad set of points where the manipulator cannot be. So if the coordinates of the central point of the moving platform is xyz, then that xyz cannot satisfy e equal to 0 where is given by this equation. And so this equation is not really new. It was known earlier that this basically represents a determinantal condition. Some determinant goes to zero, then you get this condition. So the details can be found in this paper here. The only problem was that when I started working on this, this determine turned out to be 2.87 megabytes long. And this was way back in 2003 or so when this research was being done. And it was a big challenge to even handle that much for an expression. So I had to do something with the simplification scheme. And that's how this idea of breaking things and packing them into smaller pieces, that came about incidentally, that worked and we managed to get this down to 45 kilobytes. So the consequence of that is very significant, which is why I'm just giving this example, sharing this example with you, that this allowed us to have a complete Algebraic closed form expression of this surface. So this is the surface that we are trying to find. Now we have to make sure that this point, center point, does not hit the surface. So the question is that how far are we at in any given configuration? So that is the next challenge that how do I find out that how far we are? So that problem got solved recently not too far back, a couple of years back. Now you can see that there has been a gap between this, because again, these problems take a big, huge amount of symbolic computation and effort. So what we have found here is that now we are able to find this sphere, okay, centered at the point of my interest. And what I do is that we try, we grow this sphere till it becomes tangential. You can see it's become tangential at this point. When it becomes tangential to this, then we know we cannot go any further, we hit the surface. But then within this sphere we are completely safe. So we know that we can move around in this sphere in any which direction we want and will be completely safe. So this is the utility of actually being able to derive the surface. And so I am just showing you one example where something very different, some algorithm in symbolic computation aids in our understanding of the geometry or the physics of a problem. And then that allows us to solve this problem in a manner that can be extended further and further. So first we found the surface, now we're able to find the sphere. So next question is that what can we do with that sphere? And that's exactly what we are working on currently. So what we're doing now is that starting from one point, so this is one point. And if you can see, here is the other point. Now this dotted line here represents the path. So the idea is that I should be able to go from one of these points, either this or that, to the other one. And all the time without hitting this very complicated looking surface. Now, how do I find this path and how do I make sure I don't hit it, is that along this path I keep generating these surfaces. There's a lot of math behind it. I'm just keeping it at the rudimentary level. So we get this spheres along a path. And then since the spheres are all shift, so are the center points. Now if I continue along the center, joining the centers, so this becomes like a stream passing through a number of spherical beads. And therefore this is the safest part that you can get that at any point of time, at any location, this path is the furthest from the surface as it could possibly be. You move away from this path in this direction or that direction, you get closer to the bad set. So this is how one thing leads to the other. And currently we're working on the path planning problem on this. And all of this is solely possible because of the symbolic nature of the manifold or the surface that we could derive earlier. Okay, so I think, you know, that would be the end of my talk. What I wanted to convey is that we talk about robotics and people have different notions of it. Our idea of robotics is something that involves a whole lot of kinematics and therefore geometry. And when we add visualization to this, not only we get just validation of our intuitions or know that our results are true, but we also see that we could come up with new ideas to solve. Like, you know, instead of three circles, we could have two lines and one circle, etc. But for that we need something like Mathematica, which is so robust and capable. And that's all I have for you today. Thank you very much for attending this session. And now if you have any questions or queries, I'd be happy to answer. Thank you. Okay, I see one question here. You work mostly with parallel platform systems or are there other types for these methods can apply? Actually, I'm showing you parallel manipulators, because that's closer to my teaching and research both of them. But if you go to my website, you see that I also teach a course on serial robots. And there again a whole bunch of codes are available when I use the same things over there, geometric visualizations and so on. I also taught a course in mechanism, so anything that moves and involves geometry, I think you can always use this. So it's not about just parallel manipulators. You can use this too. And as far as the symbolic computation capabilities are concerned, the simplification tools, those things can be used in all fields, wherever you have requirements of computation like that. So I have a comment from Thomas Branham. I hope I got the last name correct. You see a great deal of simulated protein folding. So thank you for the comment. Actually, I was not very sure that how much it is relevant to protein folding. But of course there is geometry in that. But if there are any connections to this and you want to interact at some other time, I'd be very happy to do so. Okay, I have a question from Ahmed Albana. You mentioned a reduction in the size of an expression. Can you give few more details on how he did it? The algorithm has been presented in the paper that I mentioned. Let me just take you to the slide where I have the link. So if you go to this, this paper and there is a section three, I believe, which gives you the complete details of the algorithm. We call this the monomial based canonical form. So basically it's a matter of splitting an expression, treating it as an algebraic entity, a polynomial in multiple variables. And what we do is that we separate out the monomials from the rest of it. And that way what happens is the trigonometric content gets picked from the algebraic content. So now we can go back and simplify the trigonometric content separately and bring it back. So the whole mathematics has been explained in detail in the paper. If you like, you can have a look at it. And if you want to interact, please feel free to document email and I'd be happy to respond to that. Do I have any other questions, please? So here is that slide again, if you want to look at it. So this expression had three algebraic variables in it, A, B and C. And it had this sine theta and cosine theta terms in trigonometry. So what I have done is that I have split it into two vectors. As you can see, the ALGE term has the algebraic variables, the monomials separated out, and the trig terms are the coefficients thereof. And since they completely free of the algebraic entity, so these are only functions of sin theta and cos theta, otherwise they are constants. So now what we do is that we do a simplification of these terms. So since they are already split into very small components and they have been brought together, like you can see that cos square theta plus sin square theta, they are added together in this coefficient. And when you simplify this, they get simplified much better and much easier. Because you're only using the trigonometric identities here, you are not using any complicated ideas. So that is how we simplify the trigonometric terms and then we bring that expression back into life by doing the dot product with algebraic terms and the simplified ones. I have one more question. Do you see applicability of this approach to peptide chain construction? I really have to learn this. Okay. I have not much of an idea about peptide chains, but I do believe that, you know, it's a geometrical problem. So there might be some application of what we do there. If you're interested, like I said, you know, please feel free to drop me an email and I'll be more than happy to see whether we can do something together, something useful. Is there any other question? Yeah, thank you Thomas for your comment. And I look forward to interact with you. Thanks Abel for your appreciation. I hope it was useful. By the way, I should have mentioned this but I thought I would run out of time. So let me still do this before it's too late. I wish to thank a lot of people, my students and others who have helped in putting all these things together, the work. And I also wish to work to thank Abel and before him other people like Sonali d' Souza and Kim Schiffer. All these people in Mathematica that have been in touch with me at IIT Mattress were very, very long time. So without their help we couldn't have become the first mathematical campus in this country. I think we are the first at least among the IITs, if not in the country. So I have really enjoyed knowing and working with these people. Thank you. Yeah, some Danny has mentioned that I might want to mentioned that Vasquez talk is coming next. Arvind Vaskar. Yeah, I look forward that to that too. So Arvind Bhaskar has been a student of mine and he is now doing a Ph.D. on monodromy. He has just finished a Ph.D. i believe he's just finishing is working on the insolvent with extension using monodomy. So I look forward to that talk too. Thank you for mentioning. Okay, I think I need to close the session now or will somebody else do that? So thank you everyone for. Thank you for joining and thank you for all the interactions. Have a good day. Good evening. Bye.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






