We left at the point that a robot was able to send us the pores of its look because it's spores from
Gazi was a relation to the script.
Let's move on.
Previously in the go to function we just wrote a minus which is equal to one meaning.
Do something.
Don't give me a syntax.
Added a no.
I am going to write certain things.
The first thing is going to be related to the equations.
What were the equations?
The equations were distance at a distance that was equal to the square root of something like a square
root.
And then within there was a square for x2 minus from x2, minus x1 and then there was a again a square
of y2 minus y1 and it's square x2, minus x1 and x squared.
That's how you write the squares for all the force.
So we have a distance error being calculated and then we have an what was the name, eight and do an
optimized function for our contingent.
And that was containing y two minus y one and that was divided by x2 minus x one, if I remember correctly.
So these are the equations that we need to fill and now we are going to be filling them with the proper
value.
So x2 is basically good and Google contains x and y two values.
The next thing for Robot Boy is Robot Pose contains three values X, Y, and Z.
Previously, when we saw that there was orientations, Z was changing into values.
I came across very interesting information.
Let me share it with you.
When I got into the cross to show Interface.
Show me the interface of NAV messages.
Again, there is a messages and then there is our dormitory.
Now, if I get information about it, when I see geometric message post covariance with force that was
added straight, that was containing the board.
So I have to get the information about this specific message across to interface.
Sure.
Geometric message with Bose.
Covariance.
Bose with covariance.
And yes, show me this specific message state.
What does it contains?
It shows it contains Bose, Bose and some variances.
So what is Bose eight?
I think the Bose's geometric message was.
And what does this Bose contain?
It contains a point position, which is three values point position, X, Y, Z and a good turning orientation.
Now the to orientation is very important thing, but that really is basically a representation of a
rotation in 3D space, a more appropriate method to represent orientation in 3D space.
In our case, we need to convert it into way that I get from Atomic.
I listen.
I obtained this code in which our goal was actually converting or turning orientation into a letter
and that can be read in in degrees.
We need this.
So how can we utilize it?
We can utilize it here.
Like the point that I just emphasized that from the Bose Bose orientation part, which is a quarterly
endpoint, we are going to make it as ten year ops.
We are going to write its name as quite dead, and yet I'm going to say it's which molecule.
And then we are going to say call this specific function.
This specific function is going to give all three values.
The role, the role, pitch angle, three different angles of when we call this function and this function
is class function.
And what does it requires?
It requires X, Y, Z and Omega W.
We'll give that in this manner, which is quarterly text.
We're going to give it as quarterly invite, but again, let it go to the Omega.
These are all values that are being obtained by the message that we are dealing with Z and Y.
So it is going to give us role by role picture and we are only interested in Java.
So I'm going to just write something very.
Interesting related to the robot was I'm going to utilize this where it is point position.
If I'm going to use this message type, if I write it geometric message point, what does it contain?
It contains three values flawed six four, three values x, y, z.
And that's what I need to make it more object oriented.
I am going to utilize the class and write a variable and that is going to be a robot force.
That is going to be all point type Y and robot for Z's job.
So you understand what I did.
I utilize the rise functionality, loss medicine, step into my robot for saving you.
So what are you know, you understand what I did?
I obtained the boards in a very different manner.
I converted into I let go of the orientation part only I'm submitting to a specific data type into a
flow data type that it is that is robust based data.
David I don't want to create a custom one.
So point contains three float values and I have float values to store in it.
So the robot poses of point type.
There is another point variable I will be using and that is goal posts.
I will not be making the robot move towards the goal post with the specific orientation, but I should
just write goal position.
But I'll write goal posts as I like it.
I'll do a robotics time if I save both both content position and orientation.
But I'm not dealing with orientation specific goal because it is going to make the code very complex
and I'm not in the favor of that right now.
So here when we call go to goal function, we are going to initialize three different values goal force
X
and then we are going to how we are going to define we are going to take value from the user from the
terminal system.
DOT are we whenever we run through the terminal we can utilize the arguments of it as well and we are
using the service function assist library, so import sets as well.
And similarly for the X Park for the Y part as well, although it contains a Z part, but we are not
going to be utilizing it.
Okay.
And it returns a string.
So I will convert it into a float to make it more understandable.
Everything else is are dealing with floats or converted to to float.
Now coming to the real part, how these equations are going to make sense x2 is going to be the goal
for is x okay goal pose x minus the robot pose x.
Okay.
This is going to be the turning point of our code where things are going to be get technical and both
of them are dealing with X right now.
And similarly, we are going to copy it and we are going to be based it for the Y part here.
I'm going to do right y y it is stacking goalpost y could pose x and both goalposts vital, which is
why it was like minus robot pose.
Right?
So the equation is now set a square.
It is not yet imported.
I will import that.
Let me complete the equations first.
Goalpost X was y and here y and here.
Right.
So you can see we have arranged things in a manner that we have defined in the structure.
We are utilizing raw structures that are going to make a useful code out of it and more presentable
code.
That's very important.
I'm going to utilize this self-taught, self-taught angle to cool a very class variable is going to
be created self taught distance to call.
Both of these variables are going to be initialized in the class as well.
Self taught angle to goal and set of distance to void.
Our version of these variables are initialized ID and matched related property that here.
So I'm going to say import map.
And four square root beer.
Was it Matt Doherty?
Square Root.
Matt Doherty Thank you.
I hope everything is good right here.
We just need to publish our message and see if things are working in our favor or not.
As this function is going to recall, this go to call function is going to be called every half a second.
I'm going to change it to 0.2 of a second every 0.2 seconds.
It is going to call this go to go function and I'm going to print out the message, hit the log in message
what it is going to be ex-wife.
And I don't need that.
I don't need this anymore.
I am going to write self taught distance to go and self doubt.
I'm going to put both of these are going to be utilized here.
I'm going to say distance to goal and angle to do it and it is going to be logged in.
Let's build it if we can.
And where is our simulation?
We are going to bring our robot back to the point where it was.
Let me bring it here and we've created a little bit to make it more look like that it has yet going
to move from the origin.
I am going to run my node that we need to do before running it.
We have to give these arguments as well.
Several effects sinks away as the arguments are in the code.
Let's take a look what is going to be the output.
So it says that you have a distance to go line booted and angle equals 0.7.
I have given seven six.
Right.
I'm going to rotate that order and see if it changes a little bit.
If I rotated totally, does it changes very little?
There is some sort of a problem with the robot, I think.
No, that is not the case.
My robot is not moving.
If I put it here, then the values change as all of the values are dependent on x and y.
Okay.
It is not taking the force of the robot directly.
So angle to call 0.6 as I move the robot angle to voltages and the distance towards changes as well.
So to some extent our code is ready, but we need to give control commands to a robot and see what is
the difference that we can do create that is going to make the robot move.