************************************
ros 编写 helloworld 程序
(参考:https://blog.youkuaiyun.com/mxgsgtc/article/details/71450763)
************************************
1,先建立工作空间~/catkin_ws
(参考:https://www.douban.com/note/516838470/)
a,ros工作环境检查
$ export | grep ROS
b,将ros的配置文档加入到teminal启动脚本里
$ source /opt/ros/melodic/setup.bash
c,创建工程空间
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
d,将ros用户自己的工程目录配置到bash里
$ gedit ~/.bashrc
在其最后一行加入
export ROS_PACKAGE_PATH=~/catkin_ws:$ROS_PACKAGE_PATH
e,编译工程
$ cd ~/catkin_ws/
$ catkin_make
f,将catkin_make加入到shell里
//原文这个命令每次电脑重启后都要重复一次,否则报错// $ source devel/setup.bash
改进为如下两行:
$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
$ echo $ROS_PACKAGE_PATH
2,在工作空间~/catkin_ws下创建包pkg目录