Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:ros:turtlesim [2020/03/23 08:53] tomykalmen:ros:turtlesim [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 1: Line 1:
-====== 2D Simulation ====== +====== ROS Tools ======
- +
-Using simulations is a good way to learn ROS without having to own a physical robot. In this chapter we just use a 2D simulation called Turtlesim.+
  
 +Using simulations is a good way to learn ROS without having to own a physical robot. In this chapter we just use a 2D simulation called Turtlesim. This tutorial will give you a good idea of what ROS tools can do for you.
 First, run //roscore//: First, run //roscore//:
  
    $ roscore    $ roscore
  
-Run a node named //turtlesim//_node from the library //turtlesim//:+Run the launch file demo for Turtlesim:
  
-   rosrun turtlesim turtlesim_node+   roslaunch turtle_tf turtle_tf_demo.launch
  
-When the node is run, a simulation with a graphical user interface opens.+When the launch file is running, a simulation with a graphical user interface opens.
  
-The library also contains a node that can be used to send keyboard movement messages to the robot.+The launch file also contains a node that can be used to send keyboard movement messages to the robot. you need to click on the terminal that you opened the launch file and use arrow keys to move the turtlebot1. Then you can see that the second turtle bot will follow the first one.
  
-Run the robot remote control node in a new terminal window:+{{ :en:ros:screenshot_from_2021-03-29_12-10-01.png?300 |}}
  
-   $ rosrun turtlesim turtle_teleop_key+===== RViz ===== 
 +Short for ROS Visualization. It’s a 3-dimensional visualization tool for ROS that helps to visualize what the robot seeing and doing. To run the RViz for the turtlebot simulation there is a predefined configuration file that you can run with the following command:
  
-Now by pressing the arrow keys in this terminal, we can move the robot in the simulation:+  $ rosrun rviz rviz -d `rospack find turtle_tf`/rviz/turtle_rviz.rviz
  
-{{:et:ros:turtle_key-290x300.png?400|}}+As you can see there are three different transformation frames (tf) in the environment that each represents an element. The world is defined for the environment and turtle1 and turtle2 are for the robots. These transformation frames are useful for positioning and localization
  
-====== Rqt_graph ======+{{ :en:ros:screenshot_from_2021-03-29_12-18-19.png?600 |}}
  
-Let's see how it works using the //rqt_graph// tool, which visualizes the relationships between nodes and themes:+===== Rqt_graph ===== 
 +  
 +ROS also comes with some graphical tools. //Rqt_graph// graphically shows which nodes communicate with each other. It is also possible to filter nodes and topics differently. //rqt_graph// allows you to save the graph in //pdf// format. 
 + 
 +run //rqt_graph//:
  
    $ rqt_graph    $ rqt_graph
-{{:et:ros:rqt_graph_turtle.png?800|}} 
  
-Launching the command opens a graphical user interface. We see that the ///teleop_turtle// node reads the arrow keys and turns them into a robot speed //geometry_msgs/twist//. It is sent to ///turtle1/command_velocity//, which is listened to by a robot simulation. By running the same nodes on different computers, we can control the robot from another computerA similar configuration is often used to control real robots.+When the command is executed, the graphical user interface opensRobots with complex tasks usually have many different nodes working on them that interact with a variety of topics. It is difficult to see the big picture from the command line and this is done using the //rqt_graph// programLet's see how it works using the //rqt_graph// tool, which visualizes the relationships between nodes and themes. 
 +   
 +{{ :en:ros:screenshot_from_2021-03-29_12-28-02.png?600 |}}
  
-====== Command line command ======+Launching the command opens a graphical user interface. We see that the ///teleop// node reads the arrow keys and turns them into a robot motion. It is sent to ///turtle1/cmd_vel//, which is listened to by a robot simulation. By running the same nodes on different computers, we can control the robot from another computer. A similar configuration is often used to control real robots. Also, there are two broadcasters for the TFs, ///sim// node is publishing position in ///turtl1/pose// and ///turtle2/pose//
 + 
 +Example of a graph on a more complex robot: 
 + 
 +{{ :et:ros:rqtslam.png?700 |}} 
 + 
 + 
 +===== Rqt_tf_tree ===== 
 +You can also use rqt tool to see the current transformation frames and relations. To see that run the following command
 +  $ rosrun rqt_tf_tree rqt_tf_tree 
 + 
 +{{ :en:ros:screenshot_from_2021-03-29_13-08-13.png?600 |}} 
 + 
 +As can be seen in the GUI, two //turtle1// and //turtle2// frames are connected to the world tf. There are two broadcasters for them that calculate their transformation and publish them relative to the world.  
 +===== Command line =====
  
 The robot type is controlled by the message type //geometry_msgs/twist//, which consists of linear and angular velocities. Let's try to speed ourselves from the command line. The //TAB// key can be used to automatically complete the command. We use the //rostopic pub// tool //argument to r 1//, which sends the given message at 1 Hz: The robot type is controlled by the message type //geometry_msgs/twist//, which consists of linear and angular velocities. Let's try to speed ourselves from the command line. The //TAB// key can be used to automatically complete the command. We use the //rostopic pub// tool //argument to r 1//, which sends the given message at 1 Hz:
  
-   $ rostopic pub/turtle1/cmd_vel geometry_msgs /Twist -r 1 - '[2.00.00.0]' '[0.00.0, -1.8]' +   $ rostopic pub /turtle1/cmd_vel geometry_msgs/Twist "linear: 
-{{:et:ros:turtlerostopicpub.png?400|}}+    x: 3.0 
 +    y: 0.0 
 +    z: 0.0 
 +  angular: 
 +    x: 0.0 
 +    y: 0.0 
 +    z: 2.0"  
 +   
 +{{ :en:ros:screenshot_from_2021-03-29_13-43-58.png?400 |}}
  
 We see that the robot moves from a circular motion in the simulation. We see that the robot moves from a circular motion in the simulation.
  
-====== Rqt_plot ======+===== Rqt_plot =====
  
-The //rqt_plot// tool is used to visualize the subject data over time. With this tool you can display the values ​​of the messages as a graph. This tool can be used, for example, to visualize sensor values. Turtlesim simulator publishes the x and y coordinates of a robot in ///turtle1/pose/x// and ///turtle1/pose/y//. Let's try to display these topics on the graph.+The //rqt_plot// tool is used to visualize the subject data over time. With this toolyou can display the values ​​of the messages as a graph. This tool can be used, for example, to visualize sensor values. Turtles simulator publishes the x and y coordinates of a robot in ///turtle1/pose/x// and ///turtle1/pose/y//. Let's try to display these topics on the graph.
  
 Run //rqt_plot//: Run //rqt_plot//:
Line 51: Line 78:
 Adding ///turtle1/pose/x// and ///turtle1/pose/y// to the graph shows the real-time position of the robot on the x and y axes: Adding ///turtle1/pose/x// and ///turtle1/pose/y// to the graph shows the real-time position of the robot on the x and y axes:
  
-{{:et:ros:rqt_plot.png?400|}} +{{ :et:ros:rqt_plot.png?400 |}}
- +
- +
- +
-[{{:et:ita_logo.v.jpg|Sponsored by the IT Academy of Education Information Technology Foundation program}}]+
en/ros/turtlesim.1584953635.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0