Our goal is almost complete.
We need to do the last, final step and that contains multiple parties.
The first thing is we need to make the robot take action on the values we have obtained.
And that includes anger.
To goal is going to be just a simple continual calculation that this is the goal to the goal.
But how to make the robot take action?
That is the real question.
And that is angle what I call angle to turn.
That's the best lead that I can come up with, which is basically equal to angle to goal minus robot
pause towards the rotational part of the robot is going to be subtracted from the remaining angle and
we will get the value that that is going to be the actual angle error we have to reduce.
Okay.
We have the angle to the goal 30 degree and we are currently at ten degrees.
So we get the actual error 20 degree and we have to rotate 20 degrees to get to the desired position
desired at this angle to.
Now we have to make the robotic action or do it right.
So if angle to turn.
If angle to turn, we don't need these because if angle to turn is greater than 0.1, which is set to
be the angle tolerance, you can see the if it reaches 0.1, then the if it is greater than that, you
are going to be continuously making the robot rotate until unless it is less than the defined tolerance.
What are you going to do?
We are going to be needing a velocity, miss.
Do we have that?
No, we don't have that.
Okay, let's define it here.
The place where we defined the order, other messages as one self-talk velocity message.
And that velocity message is off going to be obviously data type.
Now let's utilize that message, self-talk, velocity, message.
And that message is going to be the velocity message dot angular of Z because we are going to be treating
Z and you can understand that this is a twist message type.
So linear and annular X, Y, Z, all of them.
And yet you're just utilizing Angular and angular z.
We are going to say take the value angle to turn and do the rotation.
And for this specific time, you are not going to be moving right now.
Okay.
And 0.0.
Meaning first you need to fixed your angle to the goal.
You want to move and then you will move.
Okay.
Else there is only one simple condition to the EZ and that is when your face towards the angle is correct,
meaning your angle error has been reduced.
You are going to start moving at a velocity of distance toward whatever the distance to goal value is.
You are going to start moving with that error value because distance to go is basically distance at
it and we are going to give it to the velocity, linear velocity as the distance reduces the velocity
of the robot is going to reduce.
That is how it is going to move.
And now what we are interested in looking at is angle to go in and distance to go.
I think it is already written.
I just need to write distance to go ahead and angle to cool, angle to angle to turn and see how much
angle I have to turn so I can see if my cord is running correctly or not.
That is what is required.
Last thing with you to publish this as well.
Publish this velocity message into our velocity publisher that is going to make the robot move and that
is the self-talk, the last message.
And that's it I take towards the goal thing.
Go to go robotic movement.
Let's bring it back here.
Let's zoom it a little bit.
And where is the terminal Ted?
We have it perform call can be let's give the values of a one way to the robot.
And this should be at this specific point.
Let's see what the robot says.
What robot is rotated in the counter-clockwise direction.
Distance to go is 1.3.
Angle to goal is 0.68.
Okay.
What just happened?
This disease is increasing and increasing and increasing.
But there was one problem that the report is not even stopping.
Whoa.
Let me pause this evolution, and it is not even pause.
So a robot has gone rampage.
And the reason is the robot took a turn in the opposite direction and then it started to move.
And as you can see, the distance to goal value started to increase.
The robot motion started to increase as the robot has taken the turn in the opposite direction, in
the distance to go increases and the robot moved towards that.
Let me bring the robot back.
One thing we need to look at is the angle to goal being very accurately solving the angle problem.
But it is not working for the distance problem.
The real thing was the orientation of the current robot state was at an offset and we are going to do
that offset into angle to good.
Whenever you calculate the tangent inverse after the result you are going to add 3.1 for a 360 degree
rotation because you because you saw the robot started to move in the opposite direction.
What it should not have been doing.
So before moving to the final steps, I have made some changes and that is user input from the terminal
as an angle offset.
I made some changes, but this one is the major one so we can directly give an angle offset as we send
commands as as an argument to the file we need to perform the collagen build and bring the simulation.
This time the simulation has turned dark.
My laptop has turned off the GPU, but we can still manage to see what the robot is doing.
I am going to first give one one -3.14 as an angle offset -360 degree rotation.
That basically means.
So the robot has started to move towards the one one and you can see the angle.
The angle got less than 1.0.1 and the robot is taking baby steps, the distance is decreasing and it
is moving towards the goal location one one.
The thing is that the robot moves a little bit and the angle to goal gets changed.
This is because that the problem with the robot's physical properties and when it reaches the goal almost
reaches the goal.
The robot exit that my net had corrected said that the basic logic is rated at within a goal of ten.
Then you can see it is taking some time and it is really trying to reach the goal.
It fixes its orientation and then it gets a little off the F condition that we wrote.
But still it is moving, taking baby steps and this distance is decreasing.
It is going to take a lot of time.
I have rated this based logic for you and because it is very easy to understand this basic event as
it is controlling the robot.
Now I want you to improve this.
This is the boiler plate code, and I want you to improve it to a very good quality.
You can write some basic conditions.
Do not make this kind of behavior of taking baby steps and then stopping error, correcting that goal,
then stopping and correcting that again.
Okay, so that's good.
The goal driving it is going to take a lot of time to reach that specific point.
But for now, let's leave it and move to the next part.