Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know on the comments area and we will do a video about it.
About:
In the following video you will learn how to launch a ROS2 node in just a couple of minutes.
RELATED ROS RESOURCES&LINKS:
ROS Development Studio (ROSDS) —▸ http://rosds.online
Robot Ignite Academy –▸ https://www.robotigniteacademy.com
—
Feedback
—
Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know on the comments area and we will do a video about it 🙂
A: In order to do navigation using a laser for localization and obstacle avoidance, you need to do first a map of the environment you want to move through. For that, you need to use the gmapping package. Launch the gmapping package, and then move the robot around using the keyboard or joystick so it can build the map.
Once the map is done, you need to save it using the following command:
rosrun map_server map_saver -f name_of_map
Then you are ready to use that map for localization and sending the robot to different locations in the map, while avoiding obstacles. Kill the gmapping node and launch now the localization package (the amcl). Together with the amcl you need to launch the map_server (to use the map you created on the previous step) and the move_base (to make the robot move around while avoiding obstacles).
In this video answer, we walk through the basics of a Parrot AR Drone Gazebo simulation. You will learn the topics provided by the simulation and how to use a ROS program to interact, sending commands or reading sensors, with this robot.
[irp posts=”8190″ name=”Performing LSD-SLAM with a ROS based Parrot AR. Drone”]
Let’s get started!
Step1. Create a new project on ROS Development Studio(RDS)
We’ll use ROS Development Studio(RDS) for this tutorial, you can register a free account here.
After logging into RDS, click on create my project. It will move to the public simulation. You can find tons of public simulation here offered by the construct for free and start to work on any of them in just minutes. See how powerful RDS is! For today, we’ll use sjtu_drone_tc project. Please click on it. Click the tools menu, you can find some tools that help you develop in RDS. For example, you have the:
Shell: it is the terminal where you can execute commands in RDS. You can open it as many as you want in RDS!
IDE: It’s the best way to explore the source tree of your project. With a right click, you can add or remove files easily.
Jupyter Notebook: You can take notes for your project here. Since it’s working with python shell, you can directly execute python script here. A default notebook is provided to help you start the simulation.
Graphical tool: You can use all the GUIs supported by ROS here(e.g. RViz, rqt_gui…etc.)
Notice:
We are not automatically running the simulation when you start RDS now. In order to have the same simulation shown in the video. Please go Simulations->Select launch file->main.launch to launch it by yourself. Then you can type the following command in a shell to check if the topics are correctly publishing by the drone.
$ rostopic list
Step2. Get started with the simulation
Let’s get started by following the instruction in the default jupyter notebook. Open it from tools->jupyter notebook->default.ipynb.
We can make the drone take off with the shell command
$ rostopic pub /drone/takeoff std_msgs/Empty "{}"
You should see the drone take off as soon as you send this command.
Notice:
You can use the ROS auto-completion function while you are typing a ROS command by pressing [TAB]. It’s a good idea to do that when the command is too long and hard to type it correctly.
You can also land the drone with the following command
$ rostopic pub /drone/land std_msgs/Empty "{}"
You can also find an instruction in the default.ipynb shows you how to do it with a python script instead of sending commend from shell.
Step3. Program with drones
We have more examples for you! Let’s say, we want to use the position control function provided by the drone. We found there is a topic called /drone/posctrl, but how to use it? By typing
It seems that the topic is using the Bool message, but what is Bool message and how can I use it? You can further investigate it by typing
rosmsg show std_msgs/Bool
and got the output
bool data
The Bool message is very simple. It contains only one attribute called data with the type bool. Let’s try to send a message to this topic! Before we publish to the topic, we set up a monitor first with
rostopic echo /drone/posctrl
Then copy, paste and execute the following code in jupyter notebook.
which means the message is published correctly. We enable the position control function on the drone successfully. Similarly, you can move the drone by publishing Twist message to the /cmd_vel topic. Here is an example script
Now you know how to start programming drones easily with RDS! You can do lots of things in RDS(e.g. using the cameras on the drone to implement computer vision algorithms). If you are interested but have no ideas how to do it, you can check our Programming drones with ROS course on robot ignite academy!
Learn how to import python modules from other packages and make them available for all the system. Also learn how to correctly install python scripts and modules.
Step 0. Create a project in ROS Development Studio(ROSDS)
ROSDS helps you follow our tutorial in a fast pace without dealing without setting up an environment locally. If you haven’t had an account yet, you can create a free account here.
Step 1. Create package
In this ROSject, let’s create a new package which contains the modules that you want to use in other packages.
cd ~/catkin_ws/src
catkin_create_pkg rospy
You also need a folder which has the same name as the package under the src folder and inside it, you need a empty__init__.py file.
cd test_pkg/src
mkdir test_pkg
cd test_pkg
touch __init__.py
Then you create the module you want under the src folder(e.g. the ClockSubscriber module in the coomon_tools_pkg). You’ll also need a setup.py file with the following content under the package to help the ROS system find this package.
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_disutils_setup(
packages=['common_tools_pkg'],
package_dir=['':'src'],
)
setup(**setup_args)
In the CMakeLists.txt file, you should change it like the following