@[TOC](ROS learning series (1))
Before learning
This is a learning series blog about ros. Readers should have the basics of C++ ,ubuntu and Python.
If you want to know what ros can dfo ,there is a video(https://www.bilibili.com/video/av17015149?from=search&seid=4379750409926275624) which can tell you.
ROS basic (1)
Beginners had better get knowledge from roswiki , watch the video of 古月居 at bilibili and learn the book 《ROS机器人开发实践》by 胡春旭 .
Install ROS
1.Install ubuntu16.04
2.change the software source to China source
3.Install ros(https://blog.csdn.net/weixin_39583302/article/details/103456160)
Understand “source”
Whenever we need to configure the ROS environment, we need source to devel / setup.bash under workplace, which is a very critical step.You can know about “source” by this(https://blog.csdn.net/u012686154/article/details/81978348)
Explore ROS file system
ROS has its own tool commands for its own files, which are very convenient when operating on ROS files. These commands are similar to but different from the original commands of the ubuntu system, optimizing the operating habits and improving efficiency for ROS files alone.
Install a ros learning package for learning needs
sudo apt-get intsall ros-kinetic-turtlesim
File system concept
-
Packages: a software organization unit of the ROS code. Each package can contain a library file, executable file, script file, or other package.
-
Manifests (package. XML) : the corresponding package description file, he used to define the dependencies between packages than the version number of the package, maintainer and key information such as certificate.
File system tools
Code is widely used in many ROS packages, and using command line tools such as ls and cd to navigate is tedious, and ROS provides some useful tools to solve this problem.
rospack
Information about the package can be obtained by using rospack:
rospack find [package-name]
such as
rospack find turtlesim
/opt/ros/kinetic/share/turtlesim
roscd
Roscd is part of the rosbash command that allows us to change the directory directly to the directory where a package or stack resides.
Usage:
roscd locationname/subdir
such as
roscd turtlesim
pwd
/opt/ros/kinetic/share/turtlesim
With the roscd command, jump directly to the directory where the software package turtlesim , which is the same directory that was found with the rospack find command. Note that ROS tools will only operate on ROS packages in your ROS_PACKAGE_PATH directory.
rosls
just like ls, rosls Is part of the rosbash command that allows us to list files in a package by package name instead of absolute path.
Usage:
rosls locationname/subdir
such as
rosls turtlesim
cmake images msg package.xml srv
tab
Complete through tab.This is a very useful tool, especially for people like me who have a very poor memory
conclusion
Note: since rospack, roscd, and rosls command line tools are all for ROS packages, be sure to include the package you want to operate in the ROS_PACKAGE_PATH variable. If a warning of " No such package/stack ‘beginner tutorial’ " appears when using these commands, indicating that the location of the package has not been added to the ROS_PACKAGE_PATH directory, and the package cannot be found, then you need to read the devel/setup.*sh file in the workspace where the package is located.
- rospack = ros+pack
- roscd = ros+cd
- rosls = ros+ls
This naming pattern is also followed in many other ROS tool commands
self-study
Now you can understand Workspace and catkin_make by yourself through the ros wiki(http://wiki.ros.org/ROS/Tutorials/CreatingPackage)
NOTE:
When downloading a function package to its own space, there is a dependency problem during compilation. The solution is as follows:
$roscd package_name
$rosdep package_name
Rosdep can install the missing dependencies
Just use this method
One by one is too much trouble, we directly install ros a feature pack need to rely on a more commonly used command is:
Rosdep install --from-paths SRC --ignore -- SRC --rosdistro= kinetic-y
This command is used to install dependencies on all packages under the SRC path in the workspace (as specified by the pacakge.xml file).