ROS course 003: git respository
1. Summary
This course was originally written at quita. If you find this is useful, go there and give srs some thumb up.
2. Environment
This post is tested under the following Environment:
Item | Value |
---|---|
CPU | AMD Ryzen 5 2600 |
Ubuntu | 18.04 |
ROS | Melodic |
3. Source code location
The source code of this couse is available at github
4. Usage
4.1. Install ROS
See 02 install。
4.2. source code
Our ROS workspace is as followed.
/ros_ws/
├── build
├── devel
└── src
├── 3rdparty <------ dependencies
├── CMakeLists.txt
└── tutorial
├── ros_lecture <----- source code
├── adv_lecture
├── basic_lecture
├── cam_lecture
├── hard_lecture
├── info_lecture
├── laser_lecture
├── LICENSE
├── nav_lecture
├── net_lecture
├── obstacle_detector
├── plugin_lecture
├── py_lecture
├── qt_lecture
├── sim1_lecture
├── sim2_lecture
├── sim3_lecture
├── vis_lecture
└── web_lecture
Create workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
Download source code
cd ~/catkin_ws/src/tutorial
git clone https://github.com/project-srs/ros_lecture
Reload terminal
source ~/catkin_ws/devel/setup.bash
Build source code
cd ~/catkin_ws
catkin_make
If there’s any missing dependencies error, we choose between following 2 approaches. We’re using melodic which is a quite new distribution, so i prefer the second approach
- Install dependencies using apt
- Download and put dependencies source code inside 3rdparty
Create eclipse project
cd ~/catkin_ws
catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"
# generate .project
awk -f $(rospack find mk)/eclipse.awk build/.project > build/.project_with_env && mv build/.project_with_env build/.project
Open Eclipse and import into eclipse : File -> Import Project -> select Build directory. Detail is at ros_eclipse. In my environment, it will look like this
4.3. How to run
After downloading and building source code, follow instruction at each tutorial to run the source code.
4.4. Tutorial and file relation
In the beginning of each tutorial, i’ll add a simple structure of used files in corresponding tutorial. File name is also embedded in the beginning of each code block. Example is as follow:
// basic_lecture/src/basic_simple_talker.cpp
#include "ros/ros.h"
#include "std_msgs/String.h"
Leave a comment