Rigid Bodies Modeling

Robotics Fundamentals

Date: August, 2017. Location: Quito, Pichincha, Ecuador.

Actividad WBS (Fundamentals)
Lunes 14, 8:31 am

  1. Robotics: Dynamics and Control
    1. Rigid Bodies
    2. Transformation example in Matlab


We’re gonna be talking about rigid bodies. The first thing you wanna know about rigid bodies is besides the fact that they’re rigid, you wanna think about modelling them. And in order to model them, we attach reference frames to them. So here I show reference frame A, which is essentially an origin O and a set of axes, x, y, and z. We would also need a set of unit vectors that are parallel to these axes, a1, a2, and a3. So these vectors are mutually orthogonal.

And in fact, it’s these vectors that are more important than the axes. In fact, I’m gonna get rid of those axes and just keep the unit vectors, a1, a2, and a3. You have to remember that these vectors are attached to the rigid body as is the origin O.

Likewise for frame B, we have another set of unit vectors, b1, b2,and b3. And an origin P that’s attached to the rigid body.

So, we have two sets of basis vectors. Each set of basis vectors consists of mutually orthogonal unit vectors. The as are attached to the frame A, the bs are attached to the frame B.

Now I have a different set of components, q1 prime, q2 prime and q3 prime. Clearly, they are different from q1, q2, and q3 because b1, b2, and b3 are different from a1, a2, and a3. And yet, we wanna find a relationship between q1, q2, and q3 on one side and q1 prime, q2 prime, and q3 prime on the other side. This relationship is called a rigid body transformation because you’re talking about the same point. And looking at it from the vantage point of two different frames, each frame attached to a different rigid body.

So how do we relate q1, q2, and q3 to q1 prime, q2 prime, and q3 prime? Well, you can write down the vectors pictorially, and you see that immediately that picture suggests that you can use the triangle law of vector addition. The vector from O to Q is simply the sum of the vector from O to P, and the vector from P to Q. I can write this down in terms of components, as we’ve discussed before.

So now, I have a vector equation.I could even try to write this equation in terms of 3 by 1 vectors.

But you cannot simply add these 3 by 1 vectors.

Instead, you should take the vector of components q1 prime, q2 prime, and q3 prime, pre-multiplied by suitable transformation matrix, so that the resulting set of components is along a1, a2, and a3. Well, this transformation is essentially due to a rotation. And the matrix in front is a 3 by 3 rotation matrix. It’s denoted by the boldface symbol R with subscripts A and B. Suggesting that you are transforming components from frame B into frame A.

How do you write the components of a rotation matrix? Well, it’s a 3 by 3 matrix, and if you look carefully at the vector equation and the equation with 3 by 1 vectors, you can see that the rotation matrix is simply a collection of dot products or scalar products. You’re taking all possible combinations of the basis vectors, b1, b2, and b3, with the basis vectors a1, a2, and a3. In fact, if you look at the first row, it is simply the components of the basis vector b1 written in frame A.

Now we’re gonna collapse everything into a single matrix, the homogenous transformation matrix. Again, the same equation that essentially describes the triangle law of vector addition in terms of components, components written in terms of a1, a2, and a3. Let’s use homogeneous coordinates where we append the regular xyz coordinates by the number 1 as the fourth element. So this set of four numbers essentially give you a vector which is a representation of the position vector, but in projector coordinates. To relate these two sets of 4 by 1 vectors, all you need is a homogenous transformation matrix that includes elements of the rotation matrix that we’ve just described and the translation from O to P given by the components p1, p2, and p3. The last row, which consists of 0s and 1s, is simply inserted to make sure that the matrix multiplication reflects the triangle law of vector addition.

Well, this 4 by 4 matrix, we’re gonna denote by the boldface symbol T with subscripts A and B. And again, the subscripts denote the fact that you’re transforming position vectors from the second letter, B, to the first letter, A. This is our 4 by 4 homogeneous transformation matrix.

For an example see: Transformation example in Matlab

Written by: Larry Francis Obando – Technical Specialist

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Ecuador (Quito, Guayaquil, Cuenca)

WhatsApp: 00593984950376

email: dademuchconnection@gmail.com

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)


UML Advanced

  1. SuperClass
  1. Fuente. KULeuvenX: UMLx UML Class Diagrams for Software Engineering (Copia Textual – Literature Review).
    1. Superclass/Subclass/inheritance
    2. Generalisation sets
    3. Constraints on generalisation/specialisation
    4. Reading a diagram with Inheritance (Inherited Associations)
    5. AssociationClass


In this presentation we’ll explain the concept of generalization and specialization. This concept is actually a UML association construct. It relates to inheritance, fundamental concept of object oriented programming. This concept states that a class can inherit attributes and operations from a parent class.

In this example We have the general concept of account and two more specific concepts of checking account and saving account that inherit the characteristics of the more general concept of account. The more general concept is called generalization, superclass or supertype and the more specific concept is called the specialization, subclass or subtype. Graphically, the generalization/specialization association is drawn as a line connecting the super type to the subtype, and which is adorned with a triangle pointing towards the super type.

The principle of inheritance states that a subtype inherits the features of the super type. So, in this case, the superclass ‘account’, has defined two attributes: ‘IBAN number’ and ‘balance’. Those attributes will be inherited by checking account. So, also checking account will have an IBAN number and a balance. In addition, the checking account can extend what it inherited from account with its own attributes. And, in this case, checking account defines an additional attribute: ‘credit card’. Likewise, the savings account inherits from account that it has an IBAN number and a balance. But, it extends this with four attributes relating to a savings plan…Here, we graphically represent how a generalization/specialization is similar to a superset/subset relation.

Generalization sets.

Sometimes it is difficult to decide how to define the specialisations of a super type because different partitionings are possible. Take the example of vehicles. If you look at the transportation medium, you would have a partition like this:

This examples illustrates how in certain cases a single concept can be partitioned in two different ways. In UML, the concept of generalization set provides a way to group Specializations into orthogonal dimensions. Each group is represented by a generalization set. There are three different notations to represent generalisation sets.

First, by putting a name next to the Generalization relationship lines, that name designates a GeneralizationSet to which the Specialization belongs.

Second, two or more lines can be drawn to the same arrowhead and labelled by a single

generalization set name. This is called the “shared target” style.

With either of these two notations, if there are no labels on the Generalization arrows it cannot be determined from the diagram whether there are any generalization sets in the model.

Finally, a generalization set may be designated by drawing a dashed line across those lines with separate arrowheads that are meant to be part of the same set. Here, the generalization set is labelled with a single name, instead of each line labelled.

Constraints on Generalization/Specialization.

The concept of generalization/specialization comes with constraints and there are two types of constraints to consider. The first is whether the specialization is complete or incomplete. The question to ask is whether the subclasses cover all the elements of the superclass. Let’s consider an example where the superclass are the pet animals. That is the general concept. And you have three subtypes or specialized concepts namely cats, dogs and horses. The question to ask is: are there other pet animals than cats, dogs and horses? If yes, then the specialization of the subclasses is an incomplete specialization of the general concept. If there are no other pet animals than cats, dogs and horses, then the specialization is complete.

The other constraint to consider is whether or not subclasses are disjoint or overlapping. The question to ask here is: are there overlapping subclasses? For our example: Are there animals that can be dog and cat at the same time? Or cat and horse at the same time? Or dog and horse at the same time? If that’s not the case, then your classes are disjoint. If it is possible that an animal is a cat and a dog at the same time or a cat and a horse or a dog and a horse at the same time, then you have overlapping subclasses. If you don’t specify anything then by default it is assumed that your subclasses are disjoint.

The way to write these constraints down is simply by including the words that indicate the correct constraint between brackets next to the triangle.

Reading a diagram with inheritance (Inherited associations).

The general rule is that you have to read inheritance as an OR. So if you read the association between customer and account in this direction, the way to read the diagram is as follows.

A customer can have zero to many accounts and these accounts are either checking accounts or savings account because the specialization is complete and disjoint.

In the other direction, from account to customer, the way to read the diagram is that each account, be it the checking account or savings account, must have exactly one customer as an owner. In other words, checking account and savings account inherit from account that they belong to exactly one owner.

And here’s another example. Reading from student to course means that a student can follow zero to many courses and that these courses are advanced or intermediate or both, or just courses. Because inheritance is overlapping and incomplete.

In the other direction, reading from course to student we can see that each course is followed by zero to many students. And, because of the inheritance relationship, the advanced course and intermediate course inherit from course the fact that they are followed by zero to many students. So each course, advanced or intermediate, or just course is followed by zero to many students.

In the case of multiple inheritance trees in a single diagram, extra care is required. Consider this example. The association between Flight and Airplane seems to read as a general rule “Each flight has to be done with an airplane, and each Airplane can serve for zero to many flights.” While this seems a logical interpretation, the actual meaning is different.

The blue part of the model should be read as “A Flight, which could be either a cargo flight or a passenger flight” Similarly, the orange part of the model should be read as “An airplane, which could either be a passenger airplane or a cargo airplane.” In combination with the association, the true meaning of the model is: A flight of any kind, be it cargo or passenger flight, is always done with one airplane of any kind, be it a passenger or a cargo plane. So if you want to capture that passenger flights can only be done with passenger planes, and that cargo flights can only be done with cargo planes, then you need to model this at the level of the specialisations. And obviously, the association at the level of the super type then needs to be removed.

And what if cargo flights can be done with any kind of planes? Then the association connects “Cargo Flight” to the superclass “Airplane” rather than to the subclass. And the model looks like this.


Let’s take a look again at the example of projects, products and suppliers. Suppose that prior to buying a product for a project, you need to be able to look up the different prices different suppliers ask for a product. So, next to keeping track of which product has been sourced from which supplier for a project, you also want to know which supplier offers which product.

So, where would you keep the price attribute? Would you model this as an attribute of supplier? Definitively not. Is it an attribute of product? Since each supplier has its own price for a given product, you can’t model it as an attribute of product either.

The price is rather an attribute of the combination of supplier and product. It’s therefore an attribute of the association between supplier and product. As a result, the association exhibits the characteristics of a class. In UML this is capture by the concept of associationclass.

An association class is both an association and a class at the same time. The association class is therefore named like a Class, and it can have attributes and operations. In this example, a good name for the association class is “ProductOffer”. And next to the price, this association class could also contain other attributes such as shipping conditions, average shipping time, etcetera.

In the example of the projects, products and suppliers, also the other associations may be converted to association classes, depending on required attributes. For example, the association that models which products are required by which projects, may be turned into an association class ProductRequirement capturing the required quantity, the maximum price that should be paid and the deadline by which products should be available.

The use of the concept of association class adds complexity to a model, in the sense that it is an extra symbol one needs to understand. To a large extent, a model using only classes and associations can express the same thing. For example, the product offer can also be modelled as a conventional class, related to a single supplier and a single product.


Larry Francis Obando – Technical Specialist

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, CCs.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Ecuador (Quito, Cuenca, Guayaquil)

WhatsApp: 00593984950376

email: dademuchconnection@gmail.com

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Machine Learning – Regression

Date: August, 2017, Location: Quito, Pichincha, Ecuador.


Actividad WBS (Linear Regression – )
Sábado 05, 5:12 am

Este material es una copia textual de (This material is a textual copy of):

Machine Learning

Linear Regression


So the first subject that we’re going to be discussing in this course is regression. And particularly, in this lecture, we will be discussing something called linear regression.

So this is the most basic form of regression. And to introduce it, I’ll use a very simple problem, the problem of Old Faithful. So with this problem, what we have is a geyser that’s erupting for a certain amount of time. And then not erupting for a certain amount of time.

And what we want to do is we want to come up with a way to predict when is the next eruption going to be. And so one way that we might do this is to collect some data. So collect pairs of inputs and outputs. Where the input might be how long the geyser erupted for in minutes. And then the output would be after that eruption, how long we had to wait for the next eruption in minutes.

And so what linear regression is going to do is it’s going to take the input. In this case, how long the geyser erupted for. And try to predict the output. How long it’s going to now be silent until the next eruption. So let’s look at the data, at what we have and how we might wanna model this. So here, we clearly see a trend.

So here, we clearly see a trend. In the x axis, we have how long the geyser erupted for. And then in the y axis, we have how long we have to wait for the next eruption.

So now the question is can we meaningfully predict the time between eruptions using only the duration of the last eruption?

So by looking at this data, we might want to come up with some sort of a simplifying function. Where you simply have to take the input, which is how long the geyser erupted for. Perform a function on that. And then the output will be a prediction of how long we think we’re going to have to wait for the next eruption. And by looking at this, the most natural choice is to model this as a linear function.

So this is the most simple regression setting where we want to do linear regression. Where we have an input that we believe is related according to some linear function to the output. The model that we’re going to consider is called linear regression where we have the output which is the waiting time is a function where we have some constant w naught times the last duration of the eruption, how long it erupted for, times a wait w1. And so w naught and w1 are two values that we’re going to now learn from the data. So this is an example of linear regression in this case. Because we are simply learning a line to fit the data.

So how would this translate to higher dimensions, just to give some intuitions? For example, imagine that we have two inputs. And we wanna predict an output based on those two inputs. In this case, we would use the function, also a linear function. Where we say that the output is approximately equal to some offset or bias plus the first input times a wait on the first input plus the second input times a wait on the second input. And so here in this plot, you can see this. Where we have the inputs that are two dimensional. And the output again is one dimensional. And instead of a line in this case, we’re learning a plane through the data.

So let’s look at a more basic definition of the regression problem. So what we have as data are inputs. We’ll call those x that are d dimensional in rd. These inputs have many names. We can call them measurements, covariates, features, independent variables. And I’ll probably switch back and forth between these different names throughout the lectures. And the outputs are the corresponding response or dependent variable y, which is a real value. So this is the data that we’re dealing with. We have inputs, and those can be in rd, and outputs that are real valued. Real valued numbers that we wanna predict.

And the goal of the regression problem is to define a function f that maps an input to an output. So the function f takes x as an input, that’s an rd. And maps that to a value in r, which is in the output space. Such that the output can be reasonably assumed to be approximately equal to the mapping of the input through the function. Along with some parameters or free variables of the model w…And the goal is now to learn those parameters’ given data.

Okay, so let’s look at the simplest linear regression model and a way that we can learn it through least squares. So the model again takes an input xi. Passes it to a function with parameters’ w. And predicts an output yi associated with xi according to this function where we have the waits, w naught. … And then we have a dot product or a element-wise product of the wait wj with the jth dimension of input xi. So xi is an rd. We take the jth dimension of xi. Multiply it by a wait wj. Do this for each dimension and sum those values up. And add the bias to it. And predict the output to be approximately equal to this linear function.

So we’ve defined the model. And we now collect some training data. Meaning we collect pairs of instances of inputs and outputs that we know through measuring them or obtaining them in some way. So we have n pairs, x1 y1, where y1 is the corresponding response for input x1, through xn yn. And now the goal, and this is pervasive throughout machine learning, is to use this data to learn the vector w. Such that we can make predictions or we can approximate outputs according to that function.

So what does it mean to find the vector w? How can we find these values for w that give us this prediction according to this linear function? So in order to know what a good value for the vector w is, we need to define an objective function. And what this does is it basically tells us what are good values for the vector w and what are bad values.

So for least squares, the objective function is the most straightforward one you could think of. It’s the sum of the squared errors. So here we have the output yi from our training dataset. And we subtract our prediction of what yi is according to our linear regression model. That’s the error of our prediction. We then square that value so it’s always a positive number. And then sum up those values to get the total sum of squared errors of our model.

Written by: Larry Francis Obando – Technical Specialist

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Ecuador (Quito, Guayaquil, Cuenca)

WhatsApp: 00593984950376

email: dademuchconnection@gmail.com

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Representación en Variables de Estado de un Sistema Masa-Resorte-Amortiguador.


Las variables de estado son la herramienta más poderosa de la Ingeniería de Control Moderna, ya que no está limitada a sistemas lineales como sí o está el método hasta ahora visto, La Transformada de Laplace.

Las variables de estado en el caso del sistema masa-resorte-amortiguador de la Figura 8, nos permitirá reescribir un sistema de segundo orden en un sistema de primer orden. El siguiente material fue obtenido del video: State-Space Representation

Figura 8

Seleccionando nuevamente el desplazamiento como la coordenada generalizada, la ecuación de movimiento del sistema es la siguiente:

El objetivo es expresar esta ecuación en una forma equivalente que tiene la siguiente forma:

Aquí el vector es un Vector de Estado, y X1, X2, son variables de estado que sustituyen a la original variable generalizada X y, más importante, a sus derivadas. El describir el sistema en forma de matrix, ofrecerá la enorme ventaja de utilizar el poder de las computadoras para procesar información y ejecutar análisis de datos presentados en forma matricial (Matrix Algebra).

Las ecuaciones encerradas en círculos amarillos muestran como la primera forma de escribir es la forma compacta de escribir las ecuaciones para y.

El primer paso es definir las variables de estado:

Este procedimiento nos permite obtener de inmediato la primera ecuación de estado :

…..por tanto

El segundo paso consiste en forzar al coeficiente que acompaña al orden más alto, el coeficiente líder, a ser igual a la unidad. Para ello, en nuestro caso, se divide la ecuación de movimiento original entre m (y en general, entre el valor que ocupe ese lugar):

En el tercer paso se despeja la derivada de mayor orden:

El cuarto paso consiste en sustituir las derivadas de la variable original por sus ya asignadas variables de estado:

Y así hemos encontrado la segunda ecuación de estado:


Y así hemos completado el objetivo. La ecuación de movimiento original puede ser expresado como variables de estado en la siguiente forma:

Written by: Larry Francis Obando – Technical Specialist

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Ecuador (Quito, Guayaquil, Cuenca)

WhatsApp: 00593984950376

email: dademuchconnection@gmail.com

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Transfer Function of a DC Motor

Transfer Function of a DC Motor.

Consider the model presented in Figure 10:

Figure 10. Model for a DC Machine [4]

Let’s determine the Transfer Function of the DC Motor from Figure 10. Since the current-carrying armature is rotating in a magnetic field, its voltage is proportional to its speed. That is the back electromotive force as it was established in equation 7:

Equations 12

Taking the Laplace Transform we get:

Equations 13

The torque developed by the motor is proportional to the armature current, as it was said in Equations 9:

Equations 14

Transforming every impedances of Figure 10 into their Laplace Transform equivalent , we find the voltage equation for the loop around the armature circuit:

Equations 15

Now, we substitute Equations 13 y 14 en 15:

Equations 16

We need Tm in terms of in order to find . That can be get using the equivalent model for mechanical loading on a motor as shown in Figure 11:

Figure 11. Typical equivalent mechanical loading for a DC Machine [4]

Where Jm and Dm are mechanical constant which can be derived from a typical configuration such as:

Figure 12. A DC Motor driving a rotational mechanical load [4]

Considering Figure 12, Jm and Dm are:

Equations 17

Now, from Figure 11 we can find the relationship between Tm and :

Equations 18

Substituting Equations 18 in 16 we get:

Equations 19

In the most cases La is too small compared with Ra, so Equations 19 can be simplified and rearrange as:

Equations 20

Now from Equations 20 we obtain the Transfer Function for a DC Motor as follow:

Equations 21

The electrical constants of the motor Kt y Kb can be found with the following relations:

Equations 22

Where Tstall, Ea y Wno-load, use to be derive from a Graphic Speed Vs Torque such as:

Figure 13. Torque-speed curves with an armature voltage Ea as a parameter [4]

As an example, consider the case of Figure 14:

Figure 14. Torque-speed curves and system example [4]


And using the gear ratio N1/N2=1/10:

[4] Control Systems Engineering, Norman Nise

Written by: Larry Francis Obando – TSU

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Ecuador (Quito, Guayaquil, Cuenca)

WhatsApp: 00593984950376

email: dademuchconnection@gmail.com

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)