安装教程链接:https://blog.csdn.net/dally2/article/details/118028380
mkdir -p catkin_ws/src
catkin_make
注:编译成功后会生成build、devel文件夹;build文件夹用来放编译项,devel放编译输出项。
sudo gedit ~/.bashrc
source /opt/ros/melodic/setup.bash # ROS系统环境变量
source /home/youruser/catkin_ws/devel/setup.bash # 工作空间环境变量
source ~/.bashrc
注:将编译后的devel文件中setup.bash放入终端文件
cd catkin_ws/src
catkin_create_pkg learning_cplus roscpp rospy std_msgs # catkin_create_pkg 功能包名称 依赖项1 依赖项2 ......
cd .. #返回工作空间的主目录
catkin_make #编译
roscd learning_cplus #进入指定的功能包
cd src
touch publisher.cpp #创建c++实现的ROS发布节点
与C++相比,Python 在改CMakeLists.txt不需要添加编译依赖配置。
修改教程:https://blog.csdn.net/dally2/article/details/118117264
(1)如果是C++实现的ROS节点,还要使用source ~/.bashrc
(2)编译
cd ~/catkin_ws
catkin_make
(3)执行
cd catkin_ws/src
#1 C++实现的ROS节点
rosrun learning_cplus listener
rosrun learning_cplus publisher
#2 python实现的ROS节点
rosrun learning_python publisher.py
rosrun learning_python listener.py
(1)在beginner_tutorials目录下新建bringup目录
roscd beginner_tutorials
mkdir -p bringup
(2)进入bringup, 新建talker-and-listener.launch
cd bringup
rosed beginner_tutorials talker-and-listener.launch
(3)手工输入代码:
<launch>
<node name="talker" pkg="beginner_tutorials" type="talker.py" />
<node name="listener" pkg="beginner_tutorials" type="listener.py" />
</launch>
(4)运行launch
roslaunch beginner_tutorials talker-and-listener.launch
rospack depends1 beginner_tutorials #第一依赖包
rospack depends beginner_tutorials #所有依赖包
rosmsg show beginner_tutorials/Num
rostopic echo /chatter
rqt_console
rqt_graph
https://www.waveshare.net/study/article-1056-1.html
2.创客智造
https://www.ncnynl.com/archives/201611/1059.html