ROS_Stack#
rostopic pub my_topic std_msgs/String "hello there"
*** Multi_line_pub ***
$ rostopic pub /send_BTSVR std_msgs/String "data: '\
first line
second line
third line
'"
=== 【创建ROS Package (catkin) 】===
1. 确认你的catkin Workspace:~/catkin_ws/
2. $ cd ~/catkin_ws/src
3. 创建package (http://wiki.ros.org/ROS/Tutorials/catkin/CreatingPackage)
catkin_create_pkg <package_name> [depend1] [depend2] [depend3] ... [dependn]
e.g.:
catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
4. 编译catkin Workspace:
cd ~/catkin_ws
catkin_make
5. Source the generated setup file:
$ . ~/catkin_ws/devel/setup.bash
6. 可用工具:
rospack
roscd <package_name>
7. Customize Your Packages:
http://wiki.ros.org/ROS/Tutorials/CreatingPackage#ROS.2BAC8-Tutorials.2BAC8-catkin.2BAC8-CreatingPackage.Customizing_Your_Package
8. the binary file generated after your building your catking project is in this path:
/home/exbot/catkin_ws/devel/lib/{your pkg_name}
=== 【Eclipse Project 生成步骤:】 ====
Generate the Eclipse Files for dev. in Eclipse IDE
$ cd ~/catkin_ws //这实际上是Workspace的路径,catkin_ws = catkin workspace
$ catkin_make --force-cmake -G"Eclipse CDT4 - Unix Makefiles"
$ . ~/catkin_ws/devel/setup.bash
to generate the .project file and then run:
$ awk -f $(rospack find mk)/eclipse.awk build/.project > build/.project_with_env && mv build/.project_with_env build/.project
在Eclipse里创建cpp源文件:
Project@Build -> [Source directory] -> robot_cleaner ->src ->单击鼠标右键-> new ->file ->File name:robot_cleaner.cpp
此时刷新Eclipse里的Project Explorer,可以看到“robot_cleaner”这个项目。
【问题】: 为何要在Terminal里建立Package再生成Eclipse File,不能直接在Eclipse里创建Package么?怎么创建?
=== 【Ubuntu 挂载共享文件夹命令:】 ===
sudo mount -t vboxsf shareforvbox /mnt/share
sudo mount -? /dev/sda1 /mnt/udisk
=== 【ROS Stack Package等各元件结构:】 ====
[Stack]
[Package1]
[Nodes]
[Messages]
[Services]
[Libraries]
[Tools]
package.xml
CMakeLists.txt
[/Package1]
[Package2]
[Nodes]
[Messages]
[Services]
[Libraries]
[Tools]
[/Package2]
[/Stack]![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)