Now we are going to learn about the very lightweight simulator turtlesim 2
it provide all the basic functionalities of ros2 that a bigginer needs to learn 3
so open up your terminal 4
in order to install the turtlesim you first need to update 5
so now you can install this package using sudo apt install ROS its distro foxy and turtlesim 6
so this is the command to download or to install a package in ros base workspace first 7
we type sudo apt install and then the ros distro if its foxy then we will write foxy if 8
it's humble then we will write humble and then the pakage name so 9
let's give it a try it is installed and now we can find out the executable files in this package ros2 package executable turtlesim 10
so it has given us a list of the Node that we can utilize 11
so let first write ros2 run turtlesim 12
Node so a window appears so this is the first simulator that we utilize to learn the basic 13
ros Concepts we can move our Turtle around play with the several parameters and services 14
so open another terminal and we are going to control it ros2 run 15
turtlesim turtle underscore 16
teleop keys okay so it has created a Node that can move the turtle around so you can 17
press forward backward key right to rotate it to right left to rotate it to left right and left 18
so you can play with it as it moves it draws a line it's pretty fun to play with it 19
and you can also choose these letters to 20
rotate to absolute orientation so let's press G 21
G and P C and D you can play with it and F to cancel the rotation 22
so if I press like G and then suddenly I press F it will stop right there 23
To quit this node we can press Q and we are going to see the Node list ros2 Node list so we currently 24
have one node that is turtlesim and we can also see the topics ros2 topic list so these are 25
the topic currently I know you do not understand the topic and nodes and services parameters but 26
you will learn them in the next lectures uh you just get an idea and ros2 service 27
list and these are a bunch of services that this node contains and ros2 action list so it 28
has also an action now we will install the rqt.rqt is a tool that will allow you to monitor 29
subscribe or publish onto a topic and it will even allow you to call services to install this tool 30
we will just copy this command and paste it here enter your password to just update the system and now 31
so now the tool is installed we can type rqt and 32
appeared so it is showing me the topics we can monitor them and the message type of 33
the topic and the value So currently we are not monitoring any of the topic. Let's 34
click here so this command velocity topic has several values in it currently 35
there is no data being published on this topic I will just open another terminal 36
Okay ros2 run turtlesim turtle_teleop_key yes 37
drag it down and move the turtle around 38
so here you can see it get the data and the frequency 39
this is how you can monitor the topic on rqt now no data is being published on 40
this topic so it is giving us no frequency but if I move the robot around it will give us 41
some value of frequency it also shows the X and linear X and rotational z that we give it using 42
the tally operation let's just uncheck this topic and let's check the pose of the turtle 43
move the turtle around it is giving us the value of the pose of the turtle in the 44
turtlesim window this is the frequency more than 62 and the value of x and the theta 45
let's just play a little bit more so you can see it is changing it's pose 46
as I move it around in the window so now we will try to call some services and check the topic and 47
go to the plugin and select service caller so here we have the service caller okay here 48
it is the service that is clear we have a list of other services that we can utilize but let's just 49
select clear and call so it has finished all the lines that were on on the window 50
that's again move it around 51
and we will see the line select the service reset and call so it will just reset our window 52
turtle one set pen here are a bunch of arguments that it needs to know 53
and we will like set it to 255 give it any random value less than 255 54
this is RGB value and width let's increase it to four 55
and call so the service is called and yeah here you can see the difference 56
so now let's call another service that is spawn I will I selected the service spawn and it is asking 57
what is the value of X Y theta and the name of our new turtle that will be spawn in 58
the window let's say two and four and the name call here is our the second turtle 59
but if I try to move I can only move one turtle that was turtle one 60
I cannot move to Turtle 2 with this teleop now let's check the topics 61
now we have turtle one and turtle two topics 62
and we can also see some extra services that are related to Turtle 2 and turtle one so here 63
is the command to move the second Turtle as well okay this is the command to move so ros2 run 64
Turtle Sim turtle_teleop_key -- or dash dash 65
Ros minus args these keyword will let the ros know that the user 66
want to specify an argument and what is the argument the argument is the remap 67
and remap what I want to remap turtle 68
1 CMD vel 69
to turtle 70
2 71
CMD underscore vel so why am I doing this the default topic for this node is turtle one 72
slash CMD vel but we have another turtle that has Turtle 2 cmd vel 73
topic so I will just hit enter and try to move and here you can see 74
the turtle 2 is also moving and we can also move turtle one as well 75
that must be a very exciting experience for you 76
so you have learned to use the turtlesim you have monitored a topic on rqt 77
and you also called several Services related to turtlesim so that was it