-
Notifications
You must be signed in to change notification settings - Fork 1
Using RViz to visualize the turtlebot3 burger
To visualize the tb3 a previously made file was used. This file, however, did not contain all the components that will be integrated on the physical robot. A depth of field camera was missing from the simulated model. This had to be added to the SDF file that was already in use. This was possible by simply adding some extra lines of XML code to the SDF file.
To do this there was some research needed. ROS communicates with RViz by sending so-called topics, that RViz then has to subscribe to, to receive. A decision had to be made at this point. Should the camera be added in blind faith that all underlying mechanics were functioning the way that was hoped or should the camera be added only after gaining proper knowledge of the whole system?
It was decided that gaining a good understanding of the tools that were used were more important than rushing to the result of having a camera integrated virtually on the tb3 robot. There was still room for research in the time plan.
To gain a good base of knowledge to develop from it was decided that the basic tutorial for using RViz together with ROS should be read thoroughly and properly understood. This was done by using the resources that ROS.org provided on the topic.
It turned out that understanding how ROS worked was critical to understanding how RViz worked so some time had to be spent on understanding ROS.
By following the tutorial found on ROS.org the basic concepts of ROS were grasped.
Making ROS packages with catkin is crucial to working with ROS. A good start for understanding the structure, the process of working and building packages was found here.
ROS topics and nodes were expanded upon. This would be beneficial knowledge to possess as RViz and ROS communicate by messages sent through topics. It was found out that when publishing topics it is not XML but YAML that is the language which syntax should be followed on the command line. The details of writing YAML syntax were not investigated.
Some tools to visualize topics were discovered in the same tutorial. These were thought to be useful for a large range of statistical telemetry purposes such as measuring packet output and input for wireless communication.
By using services it was discovered that parameters for ROS nodes can be altered within parameter bounds while running. This was thought to be a possible solution to the problem of adding a waypoint for the tb3 robot to navigate towards.
Launch files were briefly read about along with loggers inside of ROS. These were thought to be useful when debugging the tb3 robot as using a launch file would execute a lot of actions that would normally be less than trivial in a terminal command line.
The point was now reached that reading about topics only involving ROS was not crucial. It was time to start looking at the RViz software and how it handled ROS communication.
To understand RViz one needed to understand the TF2 package and the file format URDF that is used in RViz.
(SDF is another file format that was used when simulating robots but was only used within Gazebo. Learning about this was redundant at this point but would be investigated in the future.)
TF2 is useful for listening for or broadcasting 3D transforms. To understand TF2 better the tutorial had to be read and tried out.
From reading the tutorials it was discovered that it might be a good idea to think of the camera as its frame as this would allow the team to integrate the camera in different positions on the tb3 robot almost trivially.
Adding a camera was done by copying the original URDF file for the tb3 and add in XML code for a camera. Then a launch file had to be written to tell Gazebo to make use of this new URDF file. This was done by copying the turtlebot3_world.launch
file and changing the URDF used in the launch file to the new URDF file that was created.
Things that had to change were:
- Spawn position
- URDF used
The camera subscription in RViz did not work. In its stead, the camera topic was handled as a raw image with the image subscriber in RVIz. This worked flawlessly. The results can be seen below. The camera is the gray cube that is highlighted in figure two.