How Do You Build a ROS Robot?
For the system to work well, and for you to be able to follow what the device will do in certain situations, you need standard definitions for each part. In ROS, these components are nodes, services, and topics. In short, you create one node for each major need. For example, motion is one node, vision is another node, and planning is a third node. The nodes contain services that can send information to other nodes, and services can also handle requests and responses. A topic can broadcast values to many other nodes. Getting to grips with these terms and how you should use them is the first key to mastering ROS2 development.
Emulate Navigation with turtlesim
When starting out in ROS, you will probably buy a robot that walks or rolls around in your house. To do this, the robot needs to have a view of the area where it is navigating. To do this, you can use a map-like application to test your robot’s behavior. The designers behind the Turtlebot have come up with an application, called turtlesim, that can do this for you. As with all other parts of ROS2, you can start these tools with a sub-command from the command line. You then have activities for different functions. The first part is to start the window where you can see the simulation, and this is called a node.
A window will appear with a Turtle in the center. To control the turtle with your keyboard, you must run a second command that stays open and keep pressing certain keys. This is a second node that communicates with the first one.
Now, you can move the turtle around and see how it moves. You may also get errors, such as hitting the wall. These errors show up in the terminal where the turtlesimnode is running. This is the simplest use of the simulation module. You can also run given shapes, a square is provided, and add more turtles. To add more turtles, you can use the rqt command.
Define Services with rqt
The rqt program provides services for the simulation. The q stands for Qt, which is for handling the interface. In this example, you spawn a new turtle.
The rqt interface is a long list of services for the simulation you are running. To create a new turtle, pick the ‘spawn’ drop-down menu, give the turtle a new name, and click ‘call.’ You will immediately see a new turtle next to the first. If you click the ‘spawn’ drop-down menu, you will also see a new bunch of entries related to the newly-spawned turtle.
You can also remap commands to run the new turtle. The command to do so is as follows:
Set the name ‘turtle2,’ according to your earlier choice.
Advanced Viewing with Rviz
For more advanced and 3D viewing, use rviz. This package simulates all the nodes in your design.
In the graphical interface, you have three panels, with the view in the center. You can build environments using the ‘Displays’ panel. You can add walls, wind forces and other physical properties. This is also where you add your robots.
Be aware that before you get to this point, you will need to understand how to use the URDF format. The URDF format defines a robot, allowing you to set the body, arms, legs, and, above all, collision zones. The collision zones are there so the simulation can decide whether the robot has collided.
Learning about creating a robot in the URDF format is a large project, so use an existing open-source code to experiment with the emulators.
Simulate Physics with Gazebo
In Gazebo, you can simulate the physics of the environment surrounding your robot. Gazebo is a complement program that works well together with rviz. With Gazebo, you can see what is actually happening; with rviz, you keep track of what the robot detects. When your software detects a wall that is not there, Gazebo will show empty and rviz will show where in your code the wall was created.
Conclusion
Simulating your robot and its environments is necessary to find bugs and provide needed improvements in the operation of your robot before you put it out in the wild. This is a tedious process that continues long after you begin testing the bot, in both controlled environments and real life. With adequate knowledge of the infrastructure of your robot’s internal systems, you can make sense of what you have done right and wrong. Learn quickly to appreciate all the faults you find, as they can make your system more robust in the long run.
from Linux Hint https://ift.tt/35opJLo
0 Comments