Use the ROS Development Studio (ROSDS), an online platform for developing for ROS within a PC browser. Easy-peasy. I’m using this option for this post.
Once you log in, click on the New ROSject button to create a project that will host your code. Then Click on Open ROSject to launch the development/simulation environment.
To open a “terminal” on ROSDS, pick the Shellapp from the Tools menu.
You can find the IDE app on the Tools menu.
You have ROS installed on a local PC. Okay, skip to Step 2.
Next step!
Step 2: Create a package as specified in the question to reproduce the problem
1. If you are working on ROSDS, please create a ROSject first, as indicated above.
2. Open a terminal and create a package:
user:~$ cd catkin_ws/src
user:~/catkin_ws/src$ catkin_create_pkg custom_msg rospy roscpp
Created file custom_msg/CMakeLists.txt
Created file custom_msg/package.xml
Created folder custom_msg/include/custom_msg
Created folder custom_msg/src
Successfully created files in /home/user/catkin_ws/src/custom_msg. Please adjust the values in package.xml.
3. Create a custom message
user:~/catkin_ws/src$ cd custom_msg/
user:~/catkin_ws/src/custom_msg$ mkdir -p msg
user:~/catkin_ws/src/custom_msg$ cd msg
user:~/catkin_ws/src/custom_msg/msg$ touch my_msg.msg
user:~/catkin_ws/src/custom_msg/msg$
4. Open the IDE and paste the following into my_msg.msg:
home/user/catkin_ws/src/custom_msg/src/custom_msg.cpp:1:31: fatal error: custom_msg/my_msg.h: No such file or directory
compilation terminated.
Done here. We are able to reproduce the error. Now let’s fix it.
Step 3: Fix the problem and rejoice!
The above error says it cannot find the header file while building the C++ source. This is because we have not specified that this header file is a dependency and should be built first.
Add the following line to the build section of CMakeLists.txt (under the lines added earlier). The format is add_dependencies(source_file_name package_name_generate_messages_cpp).
Here below you have a “sights and sounds” version of this post, just in case you prefer it that way. Enjoy!
Feedback
Did you like this post? Do you have any questions about the explanations? 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 or ROS2 topics, please let us know in the comments area and we will do a video or post about it.
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.
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.
Learn how to use rqt_console for debugging by setting the logger level for ROS nodes. We’ll see some sample messages generated, including that of a turtle, which we will intentionally run into a wall!
Let’s go!
Step1: Create an account and/or Login to Robot Ignite Academy (RIA)
On RIA, you get access to the best online ROS courses and environment. No need to install and set up ROS locally – the only thing you need is a browser!
You’ll now have access to the simulation screen with a Notebook, an Editor, four Shells, a Simulation Window, and a Graphical Interface. We are only using the Graphical Interface and Shells for this demo.
Step 2: Launch rqt_console and related commands
Start the RQT tools and a Turtle:
On Shell #1, run rqt_console: user:~$ rosrun rqt_console rqt_console
On Shell #2, run rqt_logger_level: user:~$ rosrun rqt_logger_level rqt_logger_level
On Shell #3, run turtlesim_node: user:~$ rosrun turtlesim turtlesim_node
Cannot see much output yet? Not to worry! Now click on the computer monitor icon to the right of the Editor screen to open the Graphical Tools app.
Open the Graphical Tools
You should see a screen shown below:
rqt_console Debugging Screens
The three windows shown above are the ones we launched on Shells #1-3 earlier.
The rqt_console window shows messages from the current node being debugged, based on the Severity level set.
The rqt_logger_level is where the Severity (or Verbosity or Logger) level is actually set for each node.
The TurtleSim window shows the “scapeturtle” we’re using for experiments in this post 😀 .
The current Severity for the /turtlesim node is Info, as you can see from the image. Let’s change that.
Focus the rqt_logger_level window by clicking on it.
Click on the “Refresh” button under the Nodes lists. You should see the /turtlesim node appear now.
Select /tutlesim from the Nodes lists. Looking at the Levels list, you’ll see that “Info” is selected for this node by default.
Change the Level from “Info” to “Debug” and observe the changes on the rqt_console screen. What did you notice? Too many messages among other things!
rqt_console – Before Changing Logger Level
rqt_console – After Changing Logger Level
Perhaps everything has been a bit boring till now, so now let’s move to the fun part – run the “scapeturtle” into a wall!
Change the Level to “Warn” in the rqt_logger_level window.
Clean all current messages on the rqt_console window by clicking on the brush icon.
On Shell #4, run the keyboard teleop in order to control the turtle: user:~$ rosrun turtlesim turtle_teleop_key
Keeping the Shell #4 active, use the keyboard to move the turtle forward for a few seconds, so that it runs into the wall!
Now go back to the Graphical Tools window, you should have something like this:
rqt_console – ScapeTurtle runs into a Wall!
So you finally ran the turtle into a wall…move to the next section for the verdict!
Step 3: Master the Concept: rqt_console and Logger Levels
rqt_console is for viewing the messages from nodes according to the verbosity level, which is set with rqt_logger_level.
Here are key points to note about the Levels:
Debug is the lowest level, and Fatal is the highest.
The lower levels usually have more messages than the higher ones. In fact, we would prefer not to see messages from levels like Error and Fatal!
Each Level will also show messages from the Levels below it. For example, we would still get the Warn messages on Info level. (Try it out!)
Read more above the Levels at: http://wiki.ros.org/Verbosity%20Levels
And that’s it!
Extra: Video
Prefer to see the ‘sights and sounds’ version of this post? We made this video just for you!
Feedback
If you are interested in this topic, please check our ROS Basics in 5 Days course where you’ll learn more about the debugging tools available in ROS.
Did you like this post? Please leave a comment on the comments section below, so we can interact and learn from each other.
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.